LLVMFuzzerTestOneInput:
    7|  19.0k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
    8|       |  // Invalid files generate a lot of warnings, so switch off logging.
    9|  19.0k|  Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
   10|       |
   11|  19.0k|  try {
   12|  19.0k|    Exiv2::DataBuf data_copy(data, size);
   13|  19.0k|    Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(data_copy.c_data(), size);
   14|  19.0k|    assert(image.get() != 0);
   15|       |
   16|  19.0k|    image->readMetadata();
   17|  19.0k|    image->writeMetadata();
   18|       |
   19|  19.0k|  } catch (...) {
   20|       |    // Exiv2 throws an exception if the metadata is invalid.
   21|  10.4k|  }
   22|       |
   23|  19.0k|  return 0;
   24|  19.0k|}

_ZN5Exiv28AsfVideo7GUIDTagC2EjttNSt3__15arrayIhLm8EEE:
   82|    124|        data1_(data1), data2_(data2), data3_(data3), data4_(data4) {
   83|    124|    }
_ZNK5Exiv28AsfVideo12HeaderReader7getSizeEv:
  105|  4.54k|    [[nodiscard]] uint64_t getSize() const {
  106|  4.54k|      return size_;
  107|  4.54k|    }
_ZNK5Exiv28AsfVideo12HeaderReader16getRemainingSizeEv:
  109|    829|    [[nodiscard]] uint64_t getRemainingSize() const {
  110|    829|      return remaining_size_;
  111|    829|    }
_ZN5Exiv28AsfVideo12HeaderReader5getIdEv:
  113|  4.35k|    [[nodiscard]] DataBuf& getId() {
  114|  4.35k|      return IdBuf_;
  115|  4.35k|    }

_ZN5Exiv28IoCloserC2ERNS_7BasicIoE:
  249|  94.2k|  explicit IoCloser(BasicIo& bio) : bio_(bio) {
  250|  94.2k|  }
_ZN5Exiv28IoCloserD2Ev:
  252|  94.2k|  virtual ~IoCloser() {
  253|  94.2k|    close();
  254|  94.2k|  }
_ZN5Exiv28IoCloser5closeEv:
  260|  94.2k|  void close() {
  261|  94.2k|    if (bio_.isopen())
  ------------------
  |  Branch (261:9): [True: 94.2k, False: 0]
  ------------------
  262|  94.2k|      bio_.close();
  263|  94.2k|  }
_ZN5Exiv27BasicIoC2Ev:
   40|  60.5k|  BasicIo() = default;

_ZN5Exiv24IlocC2Ejjj:
   24|  6.95k|  explicit Iloc(uint32_t ID = 0, uint32_t start = 0, uint32_t length = 0) : ID_(ID), start_(start), length_(length) {
   25|  6.95k|  }

_ZN5Exiv25ErrorC2INSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS_9ErrorCodeERKT_:
  243|    643|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|    643|    setMsg(1);
  245|    643|  }
_ZN5Exiv213toBasicStringIcNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEENS2_IT_NS3_IS8_EENS5_IS8_EEEERKT0_:
  153|    644|std::basic_string<charT> toBasicString(const T& arg) {
  154|    644|  std::basic_ostringstream<charT> os;
  155|    644|  os << arg;
  156|    644|  return os.str();
  157|    644|}
_ZN5Exiv213toBasicStringIcA4_cEENSt3__112basic_stringIT_NS2_11char_traitsIS4_EENS2_9allocatorIS4_EEEERKT0_:
  153|  2.34k|std::basic_string<charT> toBasicString(const T& arg) {
  154|  2.34k|  std::basic_ostringstream<charT> os;
  155|  2.34k|  os << arg;
  156|  2.34k|  return os.str();
  157|  2.34k|}
_ZN5Exiv25ErrorC2IA10_cEENS_9ErrorCodeERKT_:
  243|    135|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|    135|    setMsg(1);
  245|    135|  }
_ZN5Exiv213toBasicStringIcA10_cEENSt3__112basic_stringIT_NS2_11char_traitsIS4_EENS2_9allocatorIS4_EEEERKT0_:
  153|    135|std::basic_string<charT> toBasicString(const T& arg) {
  154|    135|  std::basic_ostringstream<charT> os;
  155|    135|  os << arg;
  156|    135|  return os.str();
  157|    135|}
_ZN5Exiv25ErrorC2IA5_cEENS_9ErrorCodeERKT_:
  243|  1.10k|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|  1.10k|    setMsg(1);
  245|  1.10k|  }
_ZN5Exiv213toBasicStringIcA5_cEENSt3__112basic_stringIT_NS2_11char_traitsIS4_EENS2_9allocatorIS4_EEEERKT0_:
  153|  1.10k|std::basic_string<charT> toBasicString(const T& arg) {
  154|  1.10k|  std::basic_ostringstream<charT> os;
  155|  1.10k|  os << arg;
  156|  1.10k|  return os.str();
  157|  1.10k|}
_ZN5Exiv25ErrorC2IA4_cEENS_9ErrorCodeERKT_:
  243|  2.34k|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|  2.34k|    setMsg(1);
  245|  2.34k|  }
_ZN5Exiv25ErrorC2IA13_cEENS_9ErrorCodeERKT_:
  243|      2|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|      2|    setMsg(1);
  245|      2|  }
_ZN5Exiv213toBasicStringIcA13_cEENSt3__112basic_stringIT_NS2_11char_traitsIS4_EENS2_9allocatorIS4_EEEERKT0_:
  153|      2|std::basic_string<charT> toBasicString(const T& arg) {
  154|      2|  std::basic_ostringstream<charT> os;
  155|      2|  os << arg;
  156|      2|  return os.str();
  157|      2|}
_ZN5Exiv213toBasicStringIcPKcEENSt3__112basic_stringIT_NS3_11char_traitsIS5_EENS3_9allocatorIS5_EEEERKT0_:
  153|     21|std::basic_string<charT> toBasicString(const T& arg) {
  154|     21|  std::basic_ostringstream<charT> os;
  155|     21|  os << arg;
  156|     21|  return os.str();
  157|     21|}
_ZN5Exiv25ErrorC2INSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEjEENS_9ErrorCodeERKT_RKT0_:
  250|      1|      code_(code), arg1_(toBasicString<char>(arg1)), arg2_(toBasicString<char>(arg2)) {
  251|      1|    setMsg(2);
  252|      1|  }
_ZN5Exiv213toBasicStringIcjEENSt3__112basic_stringIT_NS1_11char_traitsIS3_EENS1_9allocatorIS3_EEEERKT0_:
  153|      1|std::basic_string<charT> toBasicString(const T& arg) {
  154|      1|  std::basic_ostringstream<charT> os;
  155|      1|  os << arg;
  156|      1|  return os.str();
  157|      1|}
_ZN5Exiv25ErrorC2IPKcEENS_9ErrorCodeERKT_:
  243|     21|  Error(ErrorCode code, const A& arg1) : code_(code), arg1_(toBasicString<char>(arg1)) {
  244|     21|    setMsg(1);
  245|     21|  }

_ZN5Exiv28ExifData5beginEv:
  438|  72.9k|  iterator begin() {
  439|  72.9k|    return exifMetadata_.begin();
  440|  72.9k|  }
_ZN5Exiv28ExifData3endEv:
  442|  5.51M|  iterator end() {
  443|  5.51M|    return exifMetadata_.end();
  444|  5.51M|  }
_ZNK5Exiv28ExifData5beginEv:
  455|  2.28k|  [[nodiscard]] const_iterator begin() const {
  456|  2.28k|    return exifMetadata_.begin();
  457|  2.28k|  }
_ZNK5Exiv28ExifData3endEv:
  459|   260k|  [[nodiscard]] const_iterator end() const {
  460|   260k|    return exifMetadata_.end();
  461|   260k|  }
_ZNK5Exiv28ExifData5emptyEv:
  468|  7.51k|  [[nodiscard]] bool empty() const {
  469|  7.51k|    return exifMetadata_.empty();
  470|  7.51k|  }
_ZN5Exiv210ExifParser6encodeERNSt3__16vectorIhNS1_9allocatorIhEEEENS_9ByteOrderERNS_8ExifDataE:
  564|  3.66k|  static void encode(Blob& blob, ByteOrder byteOrder, ExifData& exifData) {
  565|  3.66k|    encode(blob, nullptr, 0, byteOrder, exifData);
  566|  3.66k|  }

_ZNK5Exiv215ImageCtorParams6createEv:
   53|  9.04k|  bool create() const {
   54|  9.04k|    return create_;
   55|  9.04k|  }
_ZNK5Exiv215ImageCtorParams19max_recursion_depthEv:
   57|  32.3k|  size_t max_recursion_depth() const {
   58|  32.3k|    return max_recursion_depth_;
   59|  32.3k|  }
_ZNK5Exiv25Image17iccProfileDefinedEv:
  240|  5.10k|  [[nodiscard]] virtual bool iccProfileDefined() const {
  241|  5.10k|    return !iccProfile_.empty();
  242|  5.10k|  }
_ZN5Exiv25Image16setTypeSupportedENS_9ImageTypeEt:
  481|    114|  void setTypeSupported(ImageType imageType, uint16_t supportedMetadata) {
  482|    114|    imageType_ = imageType;
  483|    114|    supportedMetadata_ = supportedMetadata;
  484|    114|  }

_ZN5Exiv28IptcData5clearEv:
  199|  30.0k|  void clear() {
  200|  30.0k|    iptcMetadata_.clear();
  201|  30.0k|  }
_ZN5Exiv28IptcData3endEv:
  211|  91.6k|  iterator end() {
  212|  91.6k|    return iptcMetadata_.end();
  213|  91.6k|  }
_ZNK5Exiv28IptcData5beginEv:
  229|  2.02k|  [[nodiscard]] const_iterator begin() const {
  230|  2.02k|    return iptcMetadata_.begin();
  231|  2.02k|  }
_ZNK5Exiv28IptcData3endEv:
  233|  3.50k|  [[nodiscard]] const_iterator end() const {
  234|  3.50k|    return iptcMetadata_.end();
  235|  3.50k|  }
_ZNK5Exiv28IptcData5emptyEv:
  247|  21.5k|  [[nodiscard]] bool empty() const {
  248|  21.5k|    return iptcMetadata_.empty();
  249|  21.5k|  }

_ZN5Exiv28Internal11MatroskaTagC2EmNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS0_16matroskaTypeEnumENS0_19matroskaProcessEnumE:
   69|    396|      _id(id), _label(std::move(label)), _type(type), _process(process) {
   70|    396|  }
_ZN5Exiv28Internal11MatroskaTagC2EmNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   73|    152|      _id(id),
   74|    152|      _label(std::move(label)),
   75|    152|      _type(matroskaTypeEnum::UndefinedType),
   76|    152|      _process(matroskaProcessEnum::Undefined) {
   77|    152|  }
_ZNK5Exiv28Internal11MatroskaTageqEm:
   79|  3.13M|  bool operator==(uint64_t id) const {
   80|  3.13M|    return id == _id;
   81|  3.13M|  }
_ZNK5Exiv28Internal11MatroskaTag9isSkippedEv:
   83|  88.4k|  [[nodiscard]] bool isSkipped() const {
   84|  88.4k|    return _process == Skip;
   85|  88.4k|  }
_ZNK5Exiv28Internal11MatroskaTag11isCompositeEv:
   86|  59.4k|  [[nodiscard]] bool isComposite() const {
   87|  59.4k|    return _process == Composite;
   88|  59.4k|  }

_ZN5Exiv29MetadatumC2Ev:
  261|  7.41M|  Metadatum() = default;
_ZN5Exiv23KeyC2Ev:
   79|  10.8M|  Key() = default;
_ZN5Exiv23KeyC2ERKS0_:
   80|   317k|  Key(const Key&) = default;

_ZNK5Exiv212DecodeParams19max_recursion_depthEv:
   25|  18.9k|  size_t max_recursion_depth() const {
   26|  18.9k|    return max_recursion_depth_;
   27|  18.9k|  }

_ZN5Exiv212PreviewImageD2Ev:
   54|  1.37k|  ~PreviewImage() = default;

_ZN5Exiv213XmpProperties7XmpLockC2Ev:
   76|  2.06M|    XmpLock() : lock_(getMutex()) {
   77|  2.06M|    }

_ZNK5Exiv29RiffVideo12HeaderReader7getSizeEv:
   55|  3.68k|    [[nodiscard]] uint64_t getSize() const {
   56|  3.68k|      return size_;
   57|  3.68k|    }
_ZNK5Exiv29RiffVideo12HeaderReader5getIdEv:
   59|  32.0k|    [[nodiscard]] const std::string& getId() const {
   60|  32.0k|      return id_;
   61|  32.0k|    }

_ZN5Exiv28Internal9SliceBaseC2Emm:
   20|  67.1M|  SliceBase(size_t begin, size_t end) : begin_(begin), end_(end) {
   21|  67.1M|    if (begin >= end) {
  ------------------
  |  Branch (21:9): [True: 0, False: 67.1M]
  ------------------
   22|      0|      throw std::out_of_range("Begin must be smaller than end");
   23|      0|    }
   24|  67.1M|  }
_ZNK5Exiv28Internal9SliceBase4sizeEv:
   29|   134M|  [[nodiscard]] size_t size() const noexcept {
   30|       |    // cannot underflow, as we know that begin < end
   31|   134M|    return end_ - begin_;
   32|   134M|  }
_ZNK5Exiv28Internal9SliceBase10rangeCheckEm:
   41|   134M|  void rangeCheck(size_t index) const {
   42|   134M|    if (index >= size()) {
  ------------------
  |  Branch (42:9): [True: 0, False: 134M]
  ------------------
   43|      0|      throw std::out_of_range("Index outside of the slice");
   44|      0|    }
   45|   134M|  }
_ZN5Exiv25SliceIPKhEC2ES2_mm:
  451|  67.1M|      Internal::ConstSliceBase<Internal::PtrSliceStorage, const T*>(ptr, begin, end) {
  452|       |    // TODO: use using in C++11
  453|  67.1M|  }
_ZN5Exiv28Internal14ConstSliceBaseINS0_15PtrSliceStorageEPKhEC2ERS4_mm:
   90|  67.1M|  ConstSliceBase(data_type& data, size_t begin, size_t end) : SliceBase(begin, end), storage_(data, begin, end) {
   91|  67.1M|  }
_ZN5Exiv28Internal15PtrSliceStorageIPKhEC2ES3_mm:
  319|  67.1M|  PtrSliceStorage(storage_type ptr, size_t /*begin*/, size_t /*end*/) : data_(ptr) {
  320|  67.1M|    if (!ptr) {
  ------------------
  |  Branch (320:9): [True: 0, False: 67.1M]
  ------------------
  321|      0|      throw std::invalid_argument("Null pointer passed to slice constructor");
  322|      0|    }
  323|  67.1M|  }
_ZNK5Exiv28Internal14ConstSliceBaseINS0_15PtrSliceStorageEPKhE2atEm:
   99|   134M|  [[nodiscard]] const auto& at(size_t index) const {
  100|   134M|    rangeCheck(index);
  101|       |    // we know: begin_ < end <= size() <= SIZE_T_MAX
  102|       |    // and: index < end - begin
  103|       |    // thus: index + begin < end <= SIZE_T_MAX
  104|       |    // => no overflow is possible
  105|   134M|    return storage_.unsafeAt(begin_ + index);
  106|   134M|  }
_ZNK5Exiv28Internal15PtrSliceStorageIPKhE8unsafeAtEm:
  335|   134M|  [[nodiscard]] const auto& unsafeAt(size_t index) const noexcept {
  336|   134M|    return data_[index];
  337|   134M|  }
_ZN5Exiv214makeSliceUntilIKhEENS_5SliceIPT_EES4_m:
  527|  67.1M|[[nodiscard]] Slice<T*> makeSliceUntil(T* ptr, size_t end) {
  528|  67.1M|  return {ptr, 0, end};
  529|  67.1M|}

_ZN5Exiv27DataBuf5beginEv:
  158|  3.56M|  [[nodiscard]] auto begin() noexcept {
  159|  3.56M|    return pData_.begin();
  160|  3.56M|  }
_ZN5Exiv27DataBuf3endEv:
  162|  32.1k|  [[nodiscard]] auto end() noexcept {
  163|  32.1k|    return pData_.end();
  164|  32.1k|  }
_ZNK5Exiv27DataBuf5beginEv:
  166|  17.4k|  [[nodiscard]] auto begin() const noexcept {
  167|  17.4k|    return pData_.begin();
  168|  17.4k|  }
_ZNK5Exiv27DataBuf3endEv:
  170|  17.1k|  [[nodiscard]] auto end() const noexcept {
  171|  17.1k|    return pData_.end();
  172|  17.1k|  }
_ZNK5Exiv27DataBuf4sizeEv:
  174|  6.18M|  [[nodiscard]] size_t size() const {
  175|  6.18M|    return pData_.size();
  176|  6.18M|  }
_ZNK5Exiv27DataBuf5emptyEv:
  207|  49.5k|  [[nodiscard]] bool empty() const {
  208|  49.5k|    return pData_.empty();
  209|  49.5k|  }
_ZN5Exiv27DataBufC2Ev:
  126|  1.27M|  DataBuf() = default;
_ZN5Exiv27DataBufaSEOS0_:
  134|  9.48k|  DataBuf& operator=(DataBuf&& other) = default;
image.cpp:_ZN5Exiv24findIKN12_GLOBAL__N_18RegistryENS_9ImageTypeELm30EEEPKT_RAT1__S5_RKT0_:
  460|  32.4k|const T* find(T (&src)[N], const K& key) {
  461|  32.4k|  static_assert(N > 0, "Passed zero length find");
  462|  32.4k|  auto rc = std::find(src, src + N, key);
  463|  32.4k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 0, False: 32.4k]
  ------------------
  464|  32.4k|}
_ZN5Exiv28toStringItEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|   122k|std::string toString(const T& arg) {
  480|   122k|  return toStringHelper(arg, std::is_integral<T>());
  481|   122k|}
_ZN5Exiv214toStringHelperItEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|   122k|std::string toStringHelper(const T& arg, std::true_type) {
  469|   122k|  return std::to_string(arg);
  470|   122k|}
_ZN5Exiv29getUShortIPKhEEtRKNS_5SliceIT_EENS_9ByteOrderE:
  240|  67.1M|uint16_t getUShort(const Slice<T>& buf, ByteOrder byteOrder) {
  241|  67.1M|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (241:7): [True: 554k, False: 66.6M]
  ------------------
  242|   554k|    return static_cast<byte>(buf.at(1)) << 8 | static_cast<byte>(buf.at(0));
  243|   554k|  }
  244|  66.6M|  return static_cast<byte>(buf.at(0)) << 8 | static_cast<byte>(buf.at(1));
  245|  67.1M|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEhLm13EEEPKT_RAT1__S4_RKT0_:
  460|   571k|const T* find(T (&src)[N], const K& key) {
  461|   571k|  static_assert(N > 0, "Passed zero length find");
  462|   571k|  auto rc = std::find(src, src + N, key);
  463|   571k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 567k, False: 4.40k]
  ------------------
  464|   571k|}
types.cpp:_ZN5Exiv24findIKN12_GLOBAL__N_113TypeInfoTableENS_6TypeIdELm24EEEPKT_RAT1__S5_RKT0_:
  460|  7.62M|const T* find(T (&src)[N], const K& key) {
  461|  7.62M|  static_assert(N > 0, "Passed zero length find");
  462|  7.62M|  auto rc = std::find(src, src + N, key);
  463|  7.62M|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 2.13M, False: 5.48M]
  ------------------
  464|  7.62M|}
_ZN5Exiv28stringToIlEET_RKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  495|      7|T stringTo(const std::string& s, bool& ok) {
  496|      7|  std::istringstream is(s);
  497|      7|  T tmp = T();
  498|      7|  ok = static_cast<bool>(is >> tmp);
  499|      7|  std::string rest;
  500|      7|  is >> std::skipws >> rest;
  501|      7|  if (!rest.empty())
  ------------------
  |  Branch (501:7): [True: 0, False: 7]
  ------------------
  502|      0|    ok = false;
  503|      7|  return tmp;
  504|      7|}
_ZN5Exiv28toStringIjEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|  15.4k|std::string toString(const T& arg) {
  480|  15.4k|  return toStringHelper(arg, std::is_integral<T>());
  481|  15.4k|}
_ZN5Exiv214toStringHelperIjEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|  15.4k|std::string toStringHelper(const T& arg, std::true_type) {
  469|  15.4k|  return std::to_string(arg);
  470|  15.4k|}
_ZN5Exiv28toStringIsEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|  1.58k|std::string toString(const T& arg) {
  480|  1.58k|  return toStringHelper(arg, std::is_integral<T>());
  481|  1.58k|}
_ZN5Exiv214toStringHelperIsEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|  1.58k|std::string toStringHelper(const T& arg, std::true_type) {
  469|  1.58k|  return std::to_string(arg);
  470|  1.58k|}
_ZN5Exiv28toStringIiEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|   185k|std::string toString(const T& arg) {
  480|   185k|  return toStringHelper(arg, std::is_integral<T>());
  481|   185k|}
_ZN5Exiv214toStringHelperIiEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|   185k|std::string toStringHelper(const T& arg, std::true_type) {
  469|   185k|  return std::to_string(arg);
  470|   185k|}
_ZN5Exiv28toStringIfEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|  1.73k|std::string toString(const T& arg) {
  480|  1.73k|  return toStringHelper(arg, std::is_integral<T>());
  481|  1.73k|}
_ZN5Exiv214toStringHelperIfEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb0EEE:
  473|  1.73k|std::string toStringHelper(const T& arg, std::false_type) {
  474|  1.73k|  std::ostringstream os;
  475|  1.73k|  os << arg;
  476|  1.73k|  return os.str();
  477|  1.73k|}
_ZN5Exiv28toStringIdEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|   182k|std::string toString(const T& arg) {
  480|   182k|  return toStringHelper(arg, std::is_integral<T>());
  481|   182k|}
_ZN5Exiv214toStringHelperIdEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb0EEE:
  473|   182k|std::string toStringHelper(const T& arg, std::false_type) {
  474|   182k|  std::ostringstream os;
  475|   182k|  os << arg;
  476|   182k|  return os.str();
  477|   182k|}
_ZN5Exiv28toStringImEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|  42.6k|std::string toString(const T& arg) {
  480|  42.6k|  return toStringHelper(arg, std::is_integral<T>());
  481|  42.6k|}
_ZN5Exiv214toStringHelperImEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|  42.6k|std::string toStringHelper(const T& arg, std::true_type) {
  469|  42.6k|  return std::to_string(arg);
  470|  42.6k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm4EEEPKT_RAT1__S4_RKT0_:
  460|  1.05k|const T* find(T (&src)[N], const K& key) {
  461|  1.05k|  static_assert(N > 0, "Passed zero length find");
  462|  1.05k|  auto rc = std::find(src, src + N, key);
  463|  1.05k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 600, False: 456]
  ------------------
  464|  1.05k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm6EEEPKT_RAT1__S4_RKT0_:
  460|    509|const T* find(T (&src)[N], const K& key) {
  461|    509|  static_assert(N > 0, "Passed zero length find");
  462|    509|  auto rc = std::find(src, src + N, key);
  463|    509|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 215, False: 294]
  ------------------
  464|    509|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm5EEEPKT_RAT1__S4_RKT0_:
  460|  1.02k|const T* find(T (&src)[N], const K& key) {
  461|  1.02k|  static_assert(N > 0, "Passed zero length find");
  462|  1.02k|  auto rc = std::find(src, src + N, key);
  463|  1.02k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 747, False: 277]
  ------------------
  464|  1.02k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm198EEEPKT_RAT1__S4_RKT0_:
  460|  60.5k|const T* find(T (&src)[N], const K& key) {
  461|  60.5k|  static_assert(N > 0, "Passed zero length find");
  462|  60.5k|  auto rc = std::find(src, src + N, key);
  463|  60.5k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 1.05k, False: 59.5k]
  ------------------
  464|  60.5k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm2EEEPKT_RAT1__S4_RKT0_:
  460|  2.47k|const T* find(T (&src)[N], const K& key) {
  461|  2.47k|  static_assert(N > 0, "Passed zero length find");
  462|  2.47k|  auto rc = std::find(src, src + N, key);
  463|  2.47k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 1.65k, False: 823]
  ------------------
  464|  2.47k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm3EEEPKT_RAT1__S4_RKT0_:
  460|  5.15k|const T* find(T (&src)[N], const K& key) {
  461|  5.15k|  static_assert(N > 0, "Passed zero length find");
  462|  5.15k|  auto rc = std::find(src, src + N, key);
  463|  5.15k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 3.16k, False: 1.98k]
  ------------------
  464|  5.15k|}
_ZN5Exiv24findIKNS_8Internal11MatroskaTagEmLm7EEEPKT_RAT1__S4_RKT0_:
  460|  3.53k|const T* find(T (&src)[N], const K& key) {
  461|  3.53k|  static_assert(N > 0, "Passed zero length find");
  462|  3.53k|  auto rc = std::find(src, src + N, key);
  463|  3.53k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 2.90k, False: 633]
  ------------------
  464|  3.53k|}
_ZN5Exiv28toStringIPKhEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_:
  479|  1.33k|std::string toString(const T& arg) {
  480|  1.33k|  return toStringHelper(arg, std::is_integral<T>());
  481|  1.33k|}
_ZN5Exiv214toStringHelperIPKhEENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKT_NS3_17integral_constantIbLb0EEE:
  473|  1.33k|std::string toStringHelper(const T& arg, std::false_type) {
  474|  1.33k|  std::ostringstream os;
  475|  1.33k|  os << arg;
  476|  1.33k|  return os.str();
  477|  1.33k|}
_ZN5Exiv28toStringIlEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_:
  479|  1.74k|std::string toString(const T& arg) {
  480|  1.74k|  return toStringHelper(arg, std::is_integral<T>());
  481|  1.74k|}
_ZN5Exiv214toStringHelperIlEENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKT_NS1_17integral_constantIbLb1EEE:
  468|  1.74k|std::string toStringHelper(const T& arg, std::true_type) {
  469|  1.74k|  return std::to_string(arg);
  470|  1.74k|}
_ZN5Exiv28toStringIPhEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKT_:
  479|   489k|std::string toString(const T& arg) {
  480|   489k|  return toStringHelper(arg, std::is_integral<T>());
  481|   489k|}
_ZN5Exiv214toStringHelperIPhEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKT_NS2_17integral_constantIbLb0EEE:
  473|   489k|std::string toStringHelper(const T& arg, std::false_type) {
  474|   489k|  std::ostringstream os;
  475|   489k|  os << arg;
  476|   489k|  return os.str();
  477|   489k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEjLm6EEEPKT_RAT1__S4_RKT0_:
  460|    871|const T* find(T (&src)[N], const K& key) {
  461|    871|  static_assert(N > 0, "Passed zero length find");
  462|    871|  auto rc = std::find(src, src + N, key);
  463|    871|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 741, False: 130]
  ------------------
  464|    871|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm32EEEPKT_RAT1__SB_RKT0_:
  460|  5.86k|const T* find(T (&src)[N], const K& key) {
  461|  5.86k|  static_assert(N > 0, "Passed zero length find");
  462|  5.86k|  auto rc = std::find(src, src + N, key);
  463|  5.86k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 3.01k, False: 2.84k]
  ------------------
  464|  5.86k|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm61EEEPKT_RAT1__SB_RKT0_:
  460|  5.86k|const T* find(T (&src)[N], const K& key) {
  461|  5.86k|  static_assert(N > 0, "Passed zero length find");
  462|  5.86k|  auto rc = std::find(src, src + N, key);
  463|  5.86k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 5.32k, False: 547]
  ------------------
  464|  5.86k|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm2EEEPKT_RAT1__SB_RKT0_:
  460|  3.21k|const T* find(T (&src)[N], const K& key) {
  461|  3.21k|  static_assert(N > 0, "Passed zero length find");
  462|  3.21k|  auto rc = std::find(src, src + N, key);
  463|  3.21k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 2.17k, False: 1.03k]
  ------------------
  464|  3.21k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEjLm41EEEPKT_RAT1__S4_RKT0_:
  460|  66.4k|const T* find(T (&src)[N], const K& key) {
  461|  66.4k|  static_assert(N > 0, "Passed zero length find");
  462|  66.4k|  auto rc = std::find(src, src + N, key);
  463|  66.4k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 58.5k, False: 7.83k]
  ------------------
  464|  66.4k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEiLm3EEEPKT_RAT1__S4_RKT0_:
  460|  13.2k|const T* find(T (&src)[N], const K& key) {
  461|  13.2k|  static_assert(N > 0, "Passed zero length find");
  462|  13.2k|  auto rc = std::find(src, src + N, key);
  463|  13.2k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 5.33k, False: 7.94k]
  ------------------
  464|  13.2k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEiLm6EEEPKT_RAT1__S4_RKT0_:
  460|  2.12k|const T* find(T (&src)[N], const K& key) {
  461|  2.12k|  static_assert(N > 0, "Passed zero length find");
  462|  2.12k|  auto rc = std::find(src, src + N, key);
  463|  2.12k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 1.53k, False: 589]
  ------------------
  464|  2.12k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEiLm11EEEPKT_RAT1__S4_RKT0_:
  460|  2.12k|const T* find(T (&src)[N], const K& key) {
  461|  2.12k|  static_assert(N > 0, "Passed zero length find");
  462|  2.12k|  auto rc = std::find(src, src + N, key);
  463|  2.12k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 1.27k, False: 845]
  ------------------
  464|  2.12k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEiLm2EEEPKT_RAT1__S4_RKT0_:
  460|    359|const T* find(T (&src)[N], const K& key) {
  461|    359|  static_assert(N > 0, "Passed zero length find");
  462|    359|  auto rc = std::find(src, src + N, key);
  463|    359|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 151, False: 208]
  ------------------
  464|    359|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm86EEEPKT_RAT1__SB_RKT0_:
  460|   143k|const T* find(T (&src)[N], const K& key) {
  461|   143k|  static_assert(N > 0, "Passed zero length find");
  462|   143k|  auto rc = std::find(src, src + N, key);
  463|   143k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 132k, False: 10.7k]
  ------------------
  464|   143k|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm17EEEPKT_RAT1__SB_RKT0_:
  460|   121k|const T* find(T (&src)[N], const K& key) {
  461|   121k|  static_assert(N > 0, "Passed zero length find");
  462|   121k|  auto rc = std::find(src, src + N, key);
  463|   121k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 119k, False: 2.25k]
  ------------------
  464|   121k|}
_ZN5Exiv24findIKNS_8Internal10TagDetailsEtLm31EEEPKT_RAT1__S4_RKT0_:
  460|  2.44k|const T* find(T (&src)[N], const K& key) {
  461|  2.44k|  static_assert(N > 0, "Passed zero length find");
  462|  2.44k|  auto rc = std::find(src, src + N, key);
  463|  2.44k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 392, False: 2.05k]
  ------------------
  464|  2.44k|}
_ZN5Exiv24findIKNS_8Internal13TagVocabularyENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm16EEEPKT_RAT1__SB_RKT0_:
  460|  3.15k|const T* find(T (&src)[N], const K& key) {
  461|  3.15k|  static_assert(N > 0, "Passed zero length find");
  462|  3.15k|  auto rc = std::find(src, src + N, key);
  463|  3.15k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 1.34k, False: 1.81k]
  ------------------
  464|  3.15k|}
_ZN5Exiv24findIKNS_9GroupInfoENS_5IfdIdELm126EEEPKT_RAT1__S4_RKT0_:
  460|  5.99M|const T* find(T (&src)[N], const K& key) {
  461|  5.99M|  static_assert(N > 0, "Passed zero length find");
  462|  5.99M|  auto rc = std::find(src, src + N, key);
  463|  5.99M|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 0, False: 5.99M]
  ------------------
  464|  5.99M|}
_ZN5Exiv24findIKNS_9GroupInfoENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEELm126EEEPKT_RAT1__SA_RKT0_:
  460|  4.89M|const T* find(T (&src)[N], const K& key) {
  461|  4.89M|  static_assert(N > 0, "Passed zero length find");
  462|  4.89M|  auto rc = std::find(src, src + N, key);
  463|  4.89M|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 0, False: 4.89M]
  ------------------
  464|  4.89M|}
_ZN5Exiv24findIKNS_8Internal15TiffMappingInfoENS2_3KeyELm5EEEPKT_RAT1__S5_RKT0_:
  460|  4.05M|const T* find(T (&src)[N], const K& key) {
  461|  4.05M|  static_assert(N > 0, "Passed zero length find");
  462|  4.05M|  auto rc = std::find(src, src + N, key);
  463|  4.05M|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 4.04M, False: 8.80k]
  ------------------
  464|  4.05M|}
_ZN5Exiv27DataBufC2EOS0_:
  132|  3.50k|  DataBuf(DataBuf&&) = default;
_ZN5Exiv24findIKNS_9XmpNsInfoENS1_2NsELm47EEEPKT_RAT1__S4_RKT0_:
  460|  67.5k|const T* find(T (&src)[N], const K& key) {
  461|  67.5k|  static_assert(N > 0, "Passed zero length find");
  462|  67.5k|  auto rc = std::find(src, src + N, key);
  463|  67.5k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 23.4k, False: 44.0k]
  ------------------
  464|  67.5k|}
_ZN5Exiv24findIKNS_9XmpNsInfoENS1_6PrefixELm47EEEPKT_RAT1__S4_RKT0_:
  460|  1.09M|const T* find(T (&src)[N], const K& key) {
  461|  1.09M|  static_assert(N > 0, "Passed zero length find");
  462|  1.09M|  auto rc = std::find(src, src + N, key);
  463|  1.09M|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 101, False: 1.09M]
  ------------------
  464|  1.09M|}
_ZN5Exiv24findIKNS_8Internal14TiffMnRegistryENSt3__117basic_string_viewIcNS4_11char_traitsIcEEEELm26EEEPKT_RAT1__S9_RKT0_:
  460|  14.2k|const T* find(T (&src)[N], const K& key) {
  461|  14.2k|  static_assert(N > 0, "Passed zero length find");
  462|  14.2k|  auto rc = std::find(src, src + N, key);
  463|  14.2k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 4.68k, False: 9.58k]
  ------------------
  464|  14.2k|}
_ZN5Exiv24findIKNS_8Internal14TiffMnRegistryENS_5IfdIdELm26EEEPKT_RAT1__S5_RKT0_:
  460|  5.94k|const T* find(T (&src)[N], const K& key) {
  461|  5.94k|  static_assert(N > 0, "Passed zero length find");
  462|  5.94k|  auto rc = std::find(src, src + N, key);
  463|  5.94k|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 0, False: 5.94k]
  ------------------
  464|  5.94k|}
_ZN5Exiv24findIKNS_8Internal13NikonArrayIdxENS2_3KeyELm34EEEPKT_RAT1__S5_RKT0_:
  460|    955|const T* find(T (&src)[N], const K& key) {
  461|    955|  static_assert(N > 0, "Passed zero length find");
  462|    955|  auto rc = std::find(src, src + N, key);
  463|    955|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 184, False: 771]
  ------------------
  464|    955|}
_ZN5Exiv28stringToIjEET_RKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  495|    146|T stringTo(const std::string& s, bool& ok) {
  496|    146|  std::istringstream is(s);
  497|    146|  T tmp = T();
  498|    146|  ok = static_cast<bool>(is >> tmp);
  499|    146|  std::string rest;
  500|    146|  is >> std::skipws >> rest;
  501|    146|  if (!rest.empty())
  ------------------
  |  Branch (501:7): [True: 47, False: 99]
  ------------------
  502|     47|    ok = false;
  503|    146|  return tmp;
  504|    146|}
_ZN5Exiv24findIKPKcNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEELm19EEEPKT_RAT1__SB_RKT0_:
  460|     98|const T* find(T (&src)[N], const K& key) {
  461|     98|  static_assert(N > 0, "Passed zero length find");
  462|     98|  auto rc = std::find(src, src + N, key);
  463|     98|  return rc == src + N ? nullptr : rc;
  ------------------
  |  Branch (463:10): [True: 98, False: 0]
  ------------------
  464|     98|}

_ZNK5Exiv25Value6typeIdEv:
   85|  6.78M|  TypeId typeId() const {
   86|  6.78M|    return type_;
   87|  6.78M|  }
_ZNK5Exiv25Value5cloneEv:
   93|  9.84M|  UniquePtr clone() const {
   94|  9.84M|    return UniquePtr(clone_());
   95|  9.84M|  }
_ZNK5Exiv25Value2okEv:
  181|  47.3k|  bool ok() const {
  182|  47.3k|    return ok_;
  183|  47.3k|  }
_ZNK5Exiv222LangAltValueComparatorclERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
  795|  26.6k|  bool operator()(const std::string& str1, const std::string& str2) const {
  796|  26.6k|    if (str1.size() != str2.size())
  ------------------
  |  Branch (796:9): [True: 15.2k, False: 11.3k]
  ------------------
  797|  15.2k|      return str1.size() > str2.size();
  798|       |
  799|  11.3k|    auto f = [](unsigned char a, unsigned char b) { return std::tolower(a) > std::tolower(b); };
  800|  11.3k|    return std::lexicographical_compare(str1.begin(), str1.end(), str2.begin(), str2.end(), f);
  801|  26.6k|  }
_ZN5Exiv27getTypeItEENS_6TypeIdEv:
 1083|  47.7k|inline TypeId getType<uint16_t>() {
 1084|  47.7k|  return unsignedShort;
 1085|  47.7k|}
_ZN5Exiv27getTypeIjEENS_6TypeIdEv:
 1088|  3.34k|inline TypeId getType<uint32_t>() {
 1089|  3.34k|  return unsignedLong;
 1090|  3.34k|}
_ZN5Exiv27getTypeINSt3__14pairIjjEEEENS_6TypeIdEv:
 1093|  9.79k|inline TypeId getType<URational>() {
 1094|  9.79k|  return unsignedRational;
 1095|  9.79k|}
_ZN5Exiv27getTypeIsEENS_6TypeIdEv:
 1098|  22.5k|inline TypeId getType<int16_t>() {
 1099|  22.5k|  return signedShort;
 1100|  22.5k|}
_ZN5Exiv27getTypeIiEENS_6TypeIdEv:
 1103|  24.4k|inline TypeId getType<int32_t>() {
 1104|  24.4k|  return signedLong;
 1105|  24.4k|}
_ZN5Exiv27getTypeINSt3__14pairIiiEEEENS_6TypeIdEv:
 1108|  8.92k|inline TypeId getType<Rational>() {
 1109|  8.92k|  return signedRational;
 1110|  8.92k|}
_ZN5Exiv27getTypeIfEENS_6TypeIdEv:
 1113|  4.95k|inline TypeId getType<float>() {
 1114|  4.95k|  return tiffFloat;
 1115|  4.95k|}
_ZN5Exiv27getTypeIdEENS_6TypeIdEv:
 1118|  9.93k|inline TypeId getType<double>() {
 1119|  9.93k|  return tiffDouble;
 1120|  9.93k|}
_ZN5Exiv28getValueItEET_PKhNS_9ByteOrderE:
 1314|  1.04M|inline uint16_t getValue(const byte* buf, ByteOrder byteOrder) {
 1315|  1.04M|  return getUShort(buf, byteOrder);
 1316|  1.04M|}
_ZN5Exiv28getValueIjEET_PKhNS_9ByteOrderE:
 1319|  1.54M|inline uint32_t getValue(const byte* buf, ByteOrder byteOrder) {
 1320|  1.54M|  return getULong(buf, byteOrder);
 1321|  1.54M|}
_ZN5Exiv28getValueINSt3__14pairIjjEEEET_PKhNS_9ByteOrderE:
 1324|   646k|inline URational getValue(const byte* buf, ByteOrder byteOrder) {
 1325|   646k|  return getURational(buf, byteOrder);
 1326|   646k|}
_ZN5Exiv28getValueIsEET_PKhNS_9ByteOrderE:
 1329|   233k|inline int16_t getValue(const byte* buf, ByteOrder byteOrder) {
 1330|   233k|  return getShort(buf, byteOrder);
 1331|   233k|}
_ZN5Exiv28getValueIiEET_PKhNS_9ByteOrderE:
 1334|   501k|inline int32_t getValue(const byte* buf, ByteOrder byteOrder) {
 1335|   501k|  return getLong(buf, byteOrder);
 1336|   501k|}
_ZN5Exiv28getValueINSt3__14pairIiiEEEET_PKhNS_9ByteOrderE:
 1339|  66.9k|inline Rational getValue(const byte* buf, ByteOrder byteOrder) {
 1340|  66.9k|  return getRational(buf, byteOrder);
 1341|  66.9k|}
_ZN5Exiv28getValueIfEET_PKhNS_9ByteOrderE:
 1344|  42.8k|inline float getValue(const byte* buf, ByteOrder byteOrder) {
 1345|  42.8k|  return getFloat(buf, byteOrder);
 1346|  42.8k|}
_ZN5Exiv28getValueIdEET_PKhNS_9ByteOrderE:
 1349|   287k|inline double getValue(const byte* buf, ByteOrder byteOrder) {
 1350|   287k|  return getDouble(buf, byteOrder);
 1351|   287k|}
_ZN5Exiv26toDataItEEmPhT_NS_9ByteOrderE:
 1372|   930k|inline size_t toData(byte* buf, uint16_t t, ByteOrder byteOrder) {
 1373|   930k|  return us2Data(buf, t, byteOrder);
 1374|   930k|}
_ZN5Exiv26toDataIjEEmPhT_NS_9ByteOrderE:
 1380|   337k|inline size_t toData(byte* buf, uint32_t t, ByteOrder byteOrder) {
 1381|   337k|  return ul2Data(buf, t, byteOrder);
 1382|   337k|}
_ZN5Exiv26toDataINSt3__14pairIjjEEEEmPhT_NS_9ByteOrderE:
 1388|   614k|inline size_t toData(byte* buf, URational t, ByteOrder byteOrder) {
 1389|   614k|  return ur2Data(buf, t, byteOrder);
 1390|   614k|}
_ZN5Exiv26toDataIsEEmPhT_NS_9ByteOrderE:
 1396|   229k|inline size_t toData(byte* buf, int16_t t, ByteOrder byteOrder) {
 1397|   229k|  return s2Data(buf, t, byteOrder);
 1398|   229k|}
_ZN5Exiv26toDataIiEEmPhT_NS_9ByteOrderE:
 1404|   342k|inline size_t toData(byte* buf, int32_t t, ByteOrder byteOrder) {
 1405|   342k|  return l2Data(buf, t, byteOrder);
 1406|   342k|}
_ZN5Exiv26toDataINSt3__14pairIiiEEEEmPhT_NS_9ByteOrderE:
 1412|  88.1k|inline size_t toData(byte* buf, Rational t, ByteOrder byteOrder) {
 1413|  88.1k|  return r2Data(buf, t, byteOrder);
 1414|  88.1k|}
_ZN5Exiv26toDataIfEEmPhT_NS_9ByteOrderE:
 1420|  50.7k|inline size_t toData(byte* buf, float t, ByteOrder byteOrder) {
 1421|  50.7k|  return f2Data(buf, t, byteOrder);
 1422|  50.7k|}
_ZN5Exiv26toDataIdEEmPhT_NS_9ByteOrderE:
 1428|   179k|inline size_t toData(byte* buf, double t, ByteOrder byteOrder) {
 1429|   179k|  return d2Data(buf, t, byteOrder);
 1430|   179k|}
_ZNK5Exiv29ValueTypeIdE7toInt64Em:
 1548|  4.51k|inline int64_t ValueType<double>::toInt64(size_t n) const {
 1549|  4.51k|  return float_to_integer_helper<int64_t>(n);
 1550|  4.51k|}
_ZNK5Exiv29ValueTypeIdE8toUint32Em:
 1553|  11.6k|inline uint32_t ValueType<double>::toUint32(size_t n) const {
 1554|  11.6k|  return float_to_integer_helper<uint32_t>(n);
 1555|  11.6k|}
_ZNK5Exiv29ValueTypeIfE7toInt64Em:
 1558|  5.62k|inline int64_t ValueType<float>::toInt64(size_t n) const {
 1559|  5.62k|  return float_to_integer_helper<int64_t>(n);
 1560|  5.62k|}
_ZNK5Exiv29ValueTypeIfE8toUint32Em:
 1562|  12.2k|inline uint32_t ValueType<float>::toUint32(size_t n) const {
 1563|  12.2k|  return float_to_integer_helper<uint32_t>(n);
 1564|  12.2k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE7toInt64Em:
 1567|  3.35k|inline int64_t ValueType<Rational>::toInt64(size_t n) const {
 1568|  3.35k|  return rational_to_integer_helper<int64_t>(n);
 1569|  3.35k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE8toUint32Em:
 1571|  4.70k|inline uint32_t ValueType<Rational>::toUint32(size_t n) const {
 1572|  4.70k|  return rational_to_integer_helper<uint32_t>(n);
 1573|  4.70k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE7toInt64Em:
 1576|    835|inline int64_t ValueType<URational>::toInt64(size_t n) const {
 1577|    835|  return rational_to_integer_helper<int64_t>(n);
 1578|    835|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE8toUint32Em:
 1580|  5.55k|inline uint32_t ValueType<URational>::toUint32(size_t n) const {
 1581|  5.55k|  return rational_to_integer_helper<uint32_t>(n);
 1582|  5.55k|}
_ZNK5Exiv29ValueTypeIdE23float_to_integer_helperIlEET_m:
 1212|  4.51k|  I float_to_integer_helper(size_t n) const {
 1213|  4.51k|    const auto v = value_.at(n);
 1214|  4.51k|    if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
  ------------------
  |  Branch (1214:9): [True: 3.90k, False: 619]
  ------------------
 1215|  3.90k|        v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
  ------------------
  |  Branch (1215:9): [True: 3.11k, False: 786]
  ------------------
 1216|  3.11k|      return static_cast<I>(std::lround(v));
 1217|  3.11k|    }
 1218|  1.40k|    return 0;
 1219|  4.51k|  }
_ZNK5Exiv29ValueTypeIdE23float_to_integer_helperIjEET_m:
 1212|  11.6k|  I float_to_integer_helper(size_t n) const {
 1213|  11.6k|    const auto v = value_.at(n);
 1214|  11.6k|    if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
  ------------------
  |  Branch (1214:9): [True: 9.83k, False: 1.84k]
  ------------------
 1215|  9.83k|        v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
  ------------------
  |  Branch (1215:9): [True: 8.13k, False: 1.70k]
  ------------------
 1216|  8.13k|      return static_cast<I>(std::lround(v));
 1217|  8.13k|    }
 1218|  3.54k|    return 0;
 1219|  11.6k|  }
_ZNK5Exiv29ValueTypeIfE23float_to_integer_helperIlEET_m:
 1212|  5.62k|  I float_to_integer_helper(size_t n) const {
 1213|  5.62k|    const auto v = value_.at(n);
 1214|  5.62k|    if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
  ------------------
  |  Branch (1214:9): [True: 5.05k, False: 565]
  ------------------
 1215|  5.05k|        v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
  ------------------
  |  Branch (1215:9): [True: 4.21k, False: 846]
  ------------------
 1216|  4.21k|      return static_cast<I>(std::lround(v));
 1217|  4.21k|    }
 1218|  1.41k|    return 0;
 1219|  5.62k|  }
_ZNK5Exiv29ValueTypeIfE23float_to_integer_helperIjEET_m:
 1212|  12.2k|  I float_to_integer_helper(size_t n) const {
 1213|  12.2k|    const auto v = value_.at(n);
 1214|  12.2k|    if (static_cast<decltype(v)>(std::numeric_limits<I>::min()) <= v &&
  ------------------
  |  Branch (1214:9): [True: 10.1k, False: 2.04k]
  ------------------
 1215|  10.1k|        v <= static_cast<decltype(v)>(std::numeric_limits<I>::max())) {
  ------------------
  |  Branch (1215:9): [True: 8.67k, False: 1.49k]
  ------------------
 1216|  8.67k|      return static_cast<I>(std::lround(v));
 1217|  8.67k|    }
 1218|  3.53k|    return 0;
 1219|  12.2k|  }
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE26rational_to_integer_helperIlEET_m:
 1223|  3.35k|  I rational_to_integer_helper(size_t n) const {
 1224|  3.35k|    auto a = value_.at(n).first;
 1225|  3.35k|    auto b = value_.at(n).second;
 1226|       |
 1227|       |    // Protect against divide-by-zero.
 1228|  3.35k|    if (b <= 0) {
  ------------------
  |  Branch (1228:9): [True: 1.19k, False: 2.15k]
  ------------------
 1229|  1.19k|      return 0;
 1230|  1.19k|    }
 1231|       |
 1232|       |    // Check for integer overflow.
 1233|  2.15k|#ifdef __cpp_if_constexpr
 1234|  2.15k|    if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
 1235|       |#else
 1236|       |    if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
 1237|       |#endif
 1238|       |      // conversion does not change sign
 1239|  2.15k|      const auto imin = std::numeric_limits<I>::min();
 1240|  2.15k|      const auto imax = std::numeric_limits<I>::max();
 1241|  2.15k|      if (imax < b || a < imin || imax < a) {
  ------------------
  |  Branch (1241:11): [True: 0, False: 2.15k]
  |  Branch (1241:23): [True: 0, False: 2.15k]
  |  Branch (1241:35): [True: 0, False: 2.15k]
  ------------------
 1242|      0|        return 0;
 1243|      0|      }
 1244|  2.15k|#ifdef __cpp_if_constexpr
 1245|       |    } else if constexpr (std::is_signed_v<I>) {
 1246|       |#else
 1247|       |    } else if (std::is_signed<I>::value) {
 1248|       |#endif
 1249|       |      // conversion is from unsigned to signed
 1250|       |      const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
 1251|       |      if (imax < b || imax < a) {
 1252|       |        return 0;
 1253|       |      }
 1254|       |    } else {
 1255|       |      // conversion is from signed to unsigned
 1256|       |      const auto imax = std::numeric_limits<I>::max();
 1257|       |      if (a < 0) {
 1258|       |        return 0;
 1259|       |      }
 1260|       |      // Inputs are not negative so convert them to unsigned.
 1261|       |      const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
 1262|       |      const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
 1263|       |      if (imax < b_u || imax < a_u) {
 1264|       |        return 0;
 1265|       |      }
 1266|       |    }
 1267|       |
 1268|  2.15k|    return static_cast<I>(a) / static_cast<I>(b);
 1269|  3.35k|  }
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE26rational_to_integer_helperIjEET_m:
 1223|  4.70k|  I rational_to_integer_helper(size_t n) const {
 1224|  4.70k|    auto a = value_.at(n).first;
 1225|  4.70k|    auto b = value_.at(n).second;
 1226|       |
 1227|       |    // Protect against divide-by-zero.
 1228|  4.70k|    if (b <= 0) {
  ------------------
  |  Branch (1228:9): [True: 1.00k, False: 3.70k]
  ------------------
 1229|  1.00k|      return 0;
 1230|  1.00k|    }
 1231|       |
 1232|       |    // Check for integer overflow.
 1233|  3.70k|#ifdef __cpp_if_constexpr
 1234|       |    if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
 1235|       |#else
 1236|       |    if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
 1237|       |#endif
 1238|       |      // conversion does not change sign
 1239|       |      const auto imin = std::numeric_limits<I>::min();
 1240|       |      const auto imax = std::numeric_limits<I>::max();
 1241|       |      if (imax < b || a < imin || imax < a) {
 1242|       |        return 0;
 1243|       |      }
 1244|       |#ifdef __cpp_if_constexpr
 1245|       |    } else if constexpr (std::is_signed_v<I>) {
 1246|       |#else
 1247|       |    } else if (std::is_signed<I>::value) {
 1248|       |#endif
 1249|       |      // conversion is from unsigned to signed
 1250|       |      const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
 1251|       |      if (imax < b || imax < a) {
 1252|       |        return 0;
 1253|       |      }
 1254|  3.70k|    } else {
 1255|       |      // conversion is from signed to unsigned
 1256|  3.70k|      const auto imax = std::numeric_limits<I>::max();
 1257|  3.70k|      if (a < 0) {
  ------------------
  |  Branch (1257:11): [True: 755, False: 2.94k]
  ------------------
 1258|    755|        return 0;
 1259|    755|      }
 1260|       |      // Inputs are not negative so convert them to unsigned.
 1261|  2.94k|      const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
 1262|  2.94k|      const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
 1263|  2.94k|      if (imax < b_u || imax < a_u) {
  ------------------
  |  Branch (1263:11): [True: 0, False: 2.94k]
  |  Branch (1263:25): [True: 0, False: 2.94k]
  ------------------
 1264|      0|        return 0;
 1265|      0|      }
 1266|  2.94k|    }
 1267|       |
 1268|  2.94k|    return static_cast<I>(a) / static_cast<I>(b);
 1269|  4.70k|  }
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE26rational_to_integer_helperIlEET_m:
 1223|    835|  I rational_to_integer_helper(size_t n) const {
 1224|    835|    auto a = value_.at(n).first;
 1225|    835|    auto b = value_.at(n).second;
 1226|       |
 1227|       |    // Protect against divide-by-zero.
 1228|    835|    if (b <= 0) {
  ------------------
  |  Branch (1228:9): [True: 191, False: 644]
  ------------------
 1229|    191|      return 0;
 1230|    191|    }
 1231|       |
 1232|       |    // Check for integer overflow.
 1233|    644|#ifdef __cpp_if_constexpr
 1234|       |    if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
 1235|       |#else
 1236|       |    if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
 1237|       |#endif
 1238|       |      // conversion does not change sign
 1239|       |      const auto imin = std::numeric_limits<I>::min();
 1240|       |      const auto imax = std::numeric_limits<I>::max();
 1241|       |      if (imax < b || a < imin || imax < a) {
 1242|       |        return 0;
 1243|       |      }
 1244|       |#ifdef __cpp_if_constexpr
 1245|    644|    } else if constexpr (std::is_signed_v<I>) {
 1246|       |#else
 1247|       |    } else if (std::is_signed<I>::value) {
 1248|       |#endif
 1249|       |      // conversion is from unsigned to signed
 1250|    644|      const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
 1251|    644|      if (imax < b || imax < a) {
  ------------------
  |  Branch (1251:11): [True: 0, False: 644]
  |  Branch (1251:23): [True: 0, False: 644]
  ------------------
 1252|      0|        return 0;
 1253|      0|      }
 1254|       |    } else {
 1255|       |      // conversion is from signed to unsigned
 1256|       |      const auto imax = std::numeric_limits<I>::max();
 1257|       |      if (a < 0) {
 1258|       |        return 0;
 1259|       |      }
 1260|       |      // Inputs are not negative so convert them to unsigned.
 1261|       |      const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
 1262|       |      const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
 1263|       |      if (imax < b_u || imax < a_u) {
 1264|       |        return 0;
 1265|       |      }
 1266|       |    }
 1267|       |
 1268|    644|    return static_cast<I>(a) / static_cast<I>(b);
 1269|    835|  }
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE26rational_to_integer_helperIjEET_m:
 1223|  5.55k|  I rational_to_integer_helper(size_t n) const {
 1224|  5.55k|    auto a = value_.at(n).first;
 1225|  5.55k|    auto b = value_.at(n).second;
 1226|       |
 1227|       |    // Protect against divide-by-zero.
 1228|  5.55k|    if (b <= 0) {
  ------------------
  |  Branch (1228:9): [True: 472, False: 5.08k]
  ------------------
 1229|    472|      return 0;
 1230|    472|    }
 1231|       |
 1232|       |    // Check for integer overflow.
 1233|  5.08k|#ifdef __cpp_if_constexpr
 1234|  5.08k|    if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
 1235|       |#else
 1236|       |    if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
 1237|       |#endif
 1238|       |      // conversion does not change sign
 1239|  5.08k|      const auto imin = std::numeric_limits<I>::min();
 1240|  5.08k|      const auto imax = std::numeric_limits<I>::max();
 1241|  5.08k|      if (imax < b || a < imin || imax < a) {
  ------------------
  |  Branch (1241:11): [True: 0, False: 5.08k]
  |  Branch (1241:23): [True: 0, False: 5.08k]
  |  Branch (1241:35): [True: 0, False: 5.08k]
  ------------------
 1242|      0|        return 0;
 1243|      0|      }
 1244|  5.08k|#ifdef __cpp_if_constexpr
 1245|       |    } else if constexpr (std::is_signed_v<I>) {
 1246|       |#else
 1247|       |    } else if (std::is_signed<I>::value) {
 1248|       |#endif
 1249|       |      // conversion is from unsigned to signed
 1250|       |      const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
 1251|       |      if (imax < b || imax < a) {
 1252|       |        return 0;
 1253|       |      }
 1254|       |    } else {
 1255|       |      // conversion is from signed to unsigned
 1256|       |      const auto imax = std::numeric_limits<I>::max();
 1257|       |      if (a < 0) {
 1258|       |        return 0;
 1259|       |      }
 1260|       |      // Inputs are not negative so convert them to unsigned.
 1261|       |      const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
 1262|       |      const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
 1263|       |      if (imax < b_u || imax < a_u) {
 1264|       |        return 0;
 1265|       |      }
 1266|       |    }
 1267|       |
 1268|  5.08k|    return static_cast<I>(a) / static_cast<I>(b);
 1269|  5.55k|  }
_ZN5Exiv29ValueTypeItEC2Ev:
 1433|  47.7k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  47.7k|}
_ZN5Exiv25ValueD2Ev:
   43|  12.5M|  virtual ~Value() = default;
_ZN5Exiv29ValueTypeItE4readEPKhmNS_9ByteOrderE:
 1467|  46.7k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  46.7k|  value_.clear();
 1469|  46.7k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  46.7k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 46.7k, False: 0]
  |  Branch (1470:17): [True: 480, False: 46.3k]
  ------------------
 1471|    480|    len = (len / ts) * ts;
 1472|  1.09M|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 1.04M, False: 46.7k]
  ------------------
 1473|  1.04M|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|  1.04M|  }
 1475|  46.7k|  return 0;
 1476|  46.7k|}
_ZN5Exiv29ValueTypeItE4readERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 1479|    869|int ValueType<T>::read(const std::string& buf) {
 1480|    869|  std::istringstream is(buf);
 1481|    869|  T tmp;
 1482|    869|  ValueList val;
 1483|  2.02k|  while (is >> tmp)
  ------------------
  |  Branch (1483:10): [True: 1.15k, False: 869]
  ------------------
 1484|  1.15k|    val.push_back(tmp);
 1485|    869|  if (!is.eof())
  ------------------
  |  Branch (1485:7): [True: 4, False: 865]
  ------------------
 1486|      4|    return 1;
 1487|    865|  value_ = std::move(val);
 1488|    865|  return 0;
 1489|    869|}
_ZN5Exiv29ValueTypeItE11setDataAreaEPKhm:
 1649|  1.19k|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|  1.19k|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 914, False: 277]
  ------------------
 1651|    914|    pDataArea_ = Blob(buf, buf + len);
 1652|    277|  else
 1653|    277|    pDataArea_.clear();
 1654|  1.19k|  return 0;
 1655|  1.19k|}
_ZNK5Exiv29ValueTypeItE4copyEPhNS_9ByteOrderE:
 1492|  48.3k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  48.3k|  size_t offset = 0;
 1494|   930k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 930k, False: 48.3k]
  ------------------
 1495|   930k|    offset += toData(buf + offset, val, byteOrder);
 1496|   930k|  }
 1497|  48.3k|  return offset;
 1498|  48.3k|}
_ZNK5Exiv29ValueTypeItE5countEv:
 1501|   240k|size_t ValueType<T>::count() const {
 1502|   240k|  return value_.size();
 1503|   240k|}
_ZNK5Exiv29ValueTypeItE4sizeEv:
 1506|   294k|size_t ValueType<T>::size() const {
 1507|   294k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|   294k|}
_ZNK5Exiv29ValueTypeItE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|    413|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    413|  auto end = value_.end();
 1518|    413|  auto i = value_.begin();
 1519|  9.65k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 9.23k, False: 413]
  ------------------
 1520|  9.23k|    os << std::setprecision(15) << *i;
 1521|  9.23k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 9.07k, False: 162]
  ------------------
 1522|  9.07k|      os << " ";
 1523|  9.23k|  }
 1524|    413|  return os;
 1525|    413|}
_ZNK5Exiv29ValueTypeItE7toInt64Em:
 1535|   108k|int64_t ValueType<T>::toInt64(size_t n) const {
 1536|   108k|  ok_ = true;
 1537|   108k|  return static_cast<int64_t>(value_.at(n));
 1538|   108k|}
_ZNK5Exiv29ValueTypeItE8toUint32Em:
 1540|   127k|uint32_t ValueType<T>::toUint32(size_t n) const {
 1541|   127k|  ok_ = true;
 1542|   127k|  return static_cast<uint32_t>(value_.at(n));
 1543|   127k|}
_ZNK5Exiv29ValueTypeItE12sizeDataAreaEv:
 1639|  4.72k|size_t ValueType<T>::sizeDataArea() const {
 1640|  4.72k|  return pDataArea_.size();
 1641|  4.72k|}
_ZNK5Exiv29ValueTypeItE8dataAreaEv:
 1644|    928|DataBuf ValueType<T>::dataArea() const {
 1645|    928|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    928|}
_ZNK5Exiv29ValueTypeItE6clone_Ev:
 1511|   137k|ValueType<T>* ValueType<T>::clone_() const {
 1512|   137k|  return new ValueType<T>(*this);
 1513|   137k|}
_ZN5Exiv29ValueTypeItEC2ERKS1_:
 1447|   137k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|   137k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 2.35k, False: 134k]
  ------------------
 1449|  2.35k|    pDataArea_ = rhs.pDataArea_;
 1450|   137k|}
_ZN5Exiv25ValueC2ERKS0_:
  225|  9.30M|  Value(const Value&) = default;
_ZN5Exiv29ValueTypeIjE4readEPKhmNS_9ByteOrderE:
 1467|  45.6k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  45.6k|  value_.clear();
 1469|  45.6k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  45.6k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 45.6k, False: 0]
  |  Branch (1470:17): [True: 52, False: 45.5k]
  ------------------
 1471|     52|    len = (len / ts) * ts;
 1472|  1.59M|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 1.54M, False: 45.6k]
  ------------------
 1473|  1.54M|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|  1.54M|  }
 1475|  45.6k|  return 0;
 1476|  45.6k|}
_ZN5Exiv29ValueTypeIjE11setDataAreaEPKhm:
 1649|    634|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    634|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 453, False: 181]
  ------------------
 1651|    453|    pDataArea_ = Blob(buf, buf + len);
 1652|    181|  else
 1653|    181|    pDataArea_.clear();
 1654|    634|  return 0;
 1655|    634|}
_ZNK5Exiv29ValueTypeIjE4copyEPhNS_9ByteOrderE:
 1492|  24.6k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  24.6k|  size_t offset = 0;
 1494|   337k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 337k, False: 24.6k]
  ------------------
 1495|   337k|    offset += toData(buf + offset, val, byteOrder);
 1496|   337k|  }
 1497|  24.6k|  return offset;
 1498|  24.6k|}
_ZNK5Exiv29ValueTypeIjE5countEv:
 1501|   113k|size_t ValueType<T>::count() const {
 1502|   113k|  return value_.size();
 1503|   113k|}
_ZNK5Exiv29ValueTypeIjE4sizeEv:
 1506|  99.5k|size_t ValueType<T>::size() const {
 1507|  99.5k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  99.5k|}
_ZNK5Exiv29ValueTypeIjE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|  2.93k|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|  2.93k|  auto end = value_.end();
 1518|  2.93k|  auto i = value_.begin();
 1519|  44.7k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 41.8k, False: 2.93k]
  ------------------
 1520|  41.8k|    os << std::setprecision(15) << *i;
 1521|  41.8k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 39.2k, False: 2.58k]
  ------------------
 1522|  39.2k|      os << " ";
 1523|  41.8k|  }
 1524|  2.93k|  return os;
 1525|  2.93k|}
_ZNK5Exiv29ValueTypeIjE7toInt64Em:
 1535|  5.07k|int64_t ValueType<T>::toInt64(size_t n) const {
 1536|  5.07k|  ok_ = true;
 1537|  5.07k|  return static_cast<int64_t>(value_.at(n));
 1538|  5.07k|}
_ZNK5Exiv29ValueTypeIjE8toUint32Em:
 1540|  39.5k|uint32_t ValueType<T>::toUint32(size_t n) const {
 1541|  39.5k|  ok_ = true;
 1542|  39.5k|  return static_cast<uint32_t>(value_.at(n));
 1543|  39.5k|}
_ZNK5Exiv29ValueTypeIjE12sizeDataAreaEv:
 1639|  7.29k|size_t ValueType<T>::sizeDataArea() const {
 1640|  7.29k|  return pDataArea_.size();
 1641|  7.29k|}
_ZNK5Exiv29ValueTypeIjE8dataAreaEv:
 1644|    822|DataBuf ValueType<T>::dataArea() const {
 1645|    822|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    822|}
_ZNK5Exiv29ValueTypeIjE6clone_Ev:
 1511|   146k|ValueType<T>* ValueType<T>::clone_() const {
 1512|   146k|  return new ValueType<T>(*this);
 1513|   146k|}
_ZN5Exiv29ValueTypeIjEC2ERKS1_:
 1447|   146k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|   146k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 469, False: 145k]
  ------------------
 1449|    469|    pDataArea_ = rhs.pDataArea_;
 1450|   146k|}
_ZN5Exiv29ValueTypeINSt3__14pairIjjEEEC2Ev:
 1433|  9.79k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  9.79k|}
_ZN5Exiv29ValueTypeINSt3__14pairIjjEEE4readEPKhmNS_9ByteOrderE:
 1467|  9.40k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  9.40k|  value_.clear();
 1469|  9.40k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  9.40k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 9.40k, False: 0]
  |  Branch (1470:17): [True: 0, False: 9.40k]
  ------------------
 1471|      0|    len = (len / ts) * ts;
 1472|   656k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 646k, False: 9.40k]
  ------------------
 1473|   646k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|   646k|  }
 1475|  9.40k|  return 0;
 1476|  9.40k|}
_ZN5Exiv29ValueTypeINSt3__14pairIjjEEE11setDataAreaEPKhm:
 1649|  1.61k|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|  1.61k|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 903, False: 710]
  ------------------
 1651|    903|    pDataArea_ = Blob(buf, buf + len);
 1652|    710|  else
 1653|    710|    pDataArea_.clear();
 1654|  1.61k|  return 0;
 1655|  1.61k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE4copyEPhNS_9ByteOrderE:
 1492|  7.63k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  7.63k|  size_t offset = 0;
 1494|   614k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 614k, False: 7.63k]
  ------------------
 1495|   614k|    offset += toData(buf + offset, val, byteOrder);
 1496|   614k|  }
 1497|  7.63k|  return offset;
 1498|  7.63k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE5countEv:
 1501|  23.0k|size_t ValueType<T>::count() const {
 1502|  23.0k|  return value_.size();
 1503|  23.0k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE4sizeEv:
 1506|  20.0k|size_t ValueType<T>::size() const {
 1507|  20.0k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  20.0k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE5writeERNS1_13basic_ostreamIcNS1_11char_traitsIcEEEE:
 1516|    502|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    502|  auto end = value_.end();
 1518|    502|  auto i = value_.begin();
 1519|   181k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 180k, False: 502]
  ------------------
 1520|   180k|    os << std::setprecision(15) << *i;
 1521|   180k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 180k, False: 378]
  ------------------
 1522|   180k|      os << " ";
 1523|   180k|  }
 1524|    502|  return os;
 1525|    502|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE12sizeDataAreaEv:
 1639|  2.14k|size_t ValueType<T>::sizeDataArea() const {
 1640|  2.14k|  return pDataArea_.size();
 1641|  2.14k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE8dataAreaEv:
 1644|    344|DataBuf ValueType<T>::dataArea() const {
 1645|    344|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    344|}
_ZNK5Exiv29ValueTypeINSt3__14pairIjjEEE6clone_Ev:
 1511|  28.9k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  28.9k|  return new ValueType<T>(*this);
 1513|  28.9k|}
_ZN5Exiv29ValueTypeINSt3__14pairIjjEEEC2ERKS4_:
 1447|  28.9k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  28.9k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 1.35k, False: 27.5k]
  ------------------
 1449|  1.35k|    pDataArea_ = rhs.pDataArea_;
 1450|  28.9k|}
_ZN5Exiv29ValueTypeIsEC2Ev:
 1433|  22.5k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  22.5k|}
_ZN5Exiv29ValueTypeIsE4readEPKhmNS_9ByteOrderE:
 1467|  19.0k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  19.0k|  value_.clear();
 1469|  19.0k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  19.0k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 19.0k, False: 0]
  |  Branch (1470:17): [True: 34, False: 19.0k]
  ------------------
 1471|     34|    len = (len / ts) * ts;
 1472|   252k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 233k, False: 19.0k]
  ------------------
 1473|   233k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|   233k|  }
 1475|  19.0k|  return 0;
 1476|  19.0k|}
_ZN5Exiv29ValueTypeIsE4readERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 1479|  3.45k|int ValueType<T>::read(const std::string& buf) {
 1480|  3.45k|  std::istringstream is(buf);
 1481|  3.45k|  T tmp;
 1482|  3.45k|  ValueList val;
 1483|  23.0k|  while (is >> tmp)
  ------------------
  |  Branch (1483:10): [True: 19.6k, False: 3.45k]
  ------------------
 1484|  19.6k|    val.push_back(tmp);
 1485|  3.45k|  if (!is.eof())
  ------------------
  |  Branch (1485:7): [True: 0, False: 3.45k]
  ------------------
 1486|      0|    return 1;
 1487|  3.45k|  value_ = std::move(val);
 1488|  3.45k|  return 0;
 1489|  3.45k|}
_ZN5Exiv29ValueTypeIsE11setDataAreaEPKhm:
 1649|    702|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    702|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 427, False: 275]
  ------------------
 1651|    427|    pDataArea_ = Blob(buf, buf + len);
 1652|    275|  else
 1653|    275|    pDataArea_.clear();
 1654|    702|  return 0;
 1655|    702|}
_ZNK5Exiv29ValueTypeIsE4copyEPhNS_9ByteOrderE:
 1492|  6.94k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  6.94k|  size_t offset = 0;
 1494|   229k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 229k, False: 6.94k]
  ------------------
 1495|   229k|    offset += toData(buf + offset, val, byteOrder);
 1496|   229k|  }
 1497|  6.94k|  return offset;
 1498|  6.94k|}
_ZNK5Exiv29ValueTypeIsE5countEv:
 1501|  67.7k|size_t ValueType<T>::count() const {
 1502|  67.7k|  return value_.size();
 1503|  67.7k|}
_ZNK5Exiv29ValueTypeIsE4sizeEv:
 1506|  36.1k|size_t ValueType<T>::size() const {
 1507|  36.1k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  36.1k|}
_ZNK5Exiv29ValueTypeIsE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|    478|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    478|  auto end = value_.end();
 1518|    478|  auto i = value_.begin();
 1519|  36.2k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 35.7k, False: 478]
  ------------------
 1520|  35.7k|    os << std::setprecision(15) << *i;
 1521|  35.7k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 35.4k, False: 269]
  ------------------
 1522|  35.4k|      os << " ";
 1523|  35.7k|  }
 1524|    478|  return os;
 1525|    478|}
_ZNK5Exiv29ValueTypeIsE7toInt64Em:
 1535|  17.5k|int64_t ValueType<T>::toInt64(size_t n) const {
 1536|  17.5k|  ok_ = true;
 1537|  17.5k|  return static_cast<int64_t>(value_.at(n));
 1538|  17.5k|}
_ZNK5Exiv29ValueTypeIsE8toUint32Em:
 1540|  62.6k|uint32_t ValueType<T>::toUint32(size_t n) const {
 1541|  62.6k|  ok_ = true;
 1542|  62.6k|  return static_cast<uint32_t>(value_.at(n));
 1543|  62.6k|}
_ZNK5Exiv29ValueTypeIsE12sizeDataAreaEv:
 1639|  1.18k|size_t ValueType<T>::sizeDataArea() const {
 1640|  1.18k|  return pDataArea_.size();
 1641|  1.18k|}
_ZNK5Exiv29ValueTypeIsE8dataAreaEv:
 1644|    313|DataBuf ValueType<T>::dataArea() const {
 1645|    313|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    313|}
_ZNK5Exiv29ValueTypeIsE6clone_Ev:
 1511|  52.2k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  52.2k|  return new ValueType<T>(*this);
 1513|  52.2k|}
_ZN5Exiv29ValueTypeIsEC2ERKS1_:
 1447|  52.2k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  52.2k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 640, False: 51.6k]
  ------------------
 1449|    640|    pDataArea_ = rhs.pDataArea_;
 1450|  52.2k|}
_ZN5Exiv29ValueTypeIiEC2Ev:
 1433|  24.4k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  24.4k|}
_ZN5Exiv29ValueTypeIiE4readEPKhmNS_9ByteOrderE:
 1467|  24.4k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  24.4k|  value_.clear();
 1469|  24.4k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  24.4k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 24.4k, False: 0]
  |  Branch (1470:17): [True: 93, False: 24.3k]
  ------------------
 1471|     93|    len = (len / ts) * ts;
 1472|   526k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 501k, False: 24.4k]
  ------------------
 1473|   501k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|   501k|  }
 1475|  24.4k|  return 0;
 1476|  24.4k|}
_ZN5Exiv29ValueTypeIiE11setDataAreaEPKhm:
 1649|    713|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    713|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 357, False: 356]
  ------------------
 1651|    357|    pDataArea_ = Blob(buf, buf + len);
 1652|    356|  else
 1653|    356|    pDataArea_.clear();
 1654|    713|  return 0;
 1655|    713|}
_ZNK5Exiv29ValueTypeIiE4copyEPhNS_9ByteOrderE:
 1492|  42.4k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  42.4k|  size_t offset = 0;
 1494|   342k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 342k, False: 42.4k]
  ------------------
 1495|   342k|    offset += toData(buf + offset, val, byteOrder);
 1496|   342k|  }
 1497|  42.4k|  return offset;
 1498|  42.4k|}
_ZNK5Exiv29ValueTypeIiE5countEv:
 1501|   102k|size_t ValueType<T>::count() const {
 1502|   102k|  return value_.size();
 1503|   102k|}
_ZNK5Exiv29ValueTypeIiE4sizeEv:
 1506|   358k|size_t ValueType<T>::size() const {
 1507|   358k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|   358k|}
_ZNK5Exiv29ValueTypeIiE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|    346|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    346|  auto end = value_.end();
 1518|    346|  auto i = value_.begin();
 1519|    967|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 621, False: 346]
  ------------------
 1520|    621|    os << std::setprecision(15) << *i;
 1521|    621|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 468, False: 153]
  ------------------
 1522|    468|      os << " ";
 1523|    621|  }
 1524|    346|  return os;
 1525|    346|}
_ZNK5Exiv29ValueTypeIiE7toInt64Em:
 1535|  7.81k|int64_t ValueType<T>::toInt64(size_t n) const {
 1536|  7.81k|  ok_ = true;
 1537|  7.81k|  return static_cast<int64_t>(value_.at(n));
 1538|  7.81k|}
_ZNK5Exiv29ValueTypeIiE8toUint32Em:
 1540|  12.3k|uint32_t ValueType<T>::toUint32(size_t n) const {
 1541|  12.3k|  ok_ = true;
 1542|  12.3k|  return static_cast<uint32_t>(value_.at(n));
 1543|  12.3k|}
_ZNK5Exiv29ValueTypeIiE12sizeDataAreaEv:
 1639|  2.89k|size_t ValueType<T>::sizeDataArea() const {
 1640|  2.89k|  return pDataArea_.size();
 1641|  2.89k|}
_ZNK5Exiv29ValueTypeIiE8dataAreaEv:
 1644|    363|DataBuf ValueType<T>::dataArea() const {
 1645|    363|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    363|}
_ZNK5Exiv29ValueTypeIiE6clone_Ev:
 1511|  95.8k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  95.8k|  return new ValueType<T>(*this);
 1513|  95.8k|}
_ZN5Exiv29ValueTypeIiEC2ERKS1_:
 1447|  95.8k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  95.8k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 730, False: 95.1k]
  ------------------
 1449|    730|    pDataArea_ = rhs.pDataArea_;
 1450|  95.8k|}
_ZN5Exiv29ValueTypeINSt3__14pairIiiEEEC2Ev:
 1433|  8.92k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  8.92k|}
_ZN5Exiv29ValueTypeINSt3__14pairIiiEEE4readEPKhmNS_9ByteOrderE:
 1467|  8.92k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  8.92k|  value_.clear();
 1469|  8.92k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  8.92k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 8.92k, False: 0]
  |  Branch (1470:17): [True: 0, False: 8.92k]
  ------------------
 1471|      0|    len = (len / ts) * ts;
 1472|  75.8k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 66.9k, False: 8.92k]
  ------------------
 1473|  66.9k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|  66.9k|  }
 1475|  8.92k|  return 0;
 1476|  8.92k|}
_ZN5Exiv29ValueTypeINSt3__14pairIiiEEE11setDataAreaEPKhm:
 1649|    772|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    772|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 372, False: 400]
  ------------------
 1651|    372|    pDataArea_ = Blob(buf, buf + len);
 1652|    400|  else
 1653|    400|    pDataArea_.clear();
 1654|    772|  return 0;
 1655|    772|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE4copyEPhNS_9ByteOrderE:
 1492|  5.56k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  5.56k|  size_t offset = 0;
 1494|  88.1k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 88.1k, False: 5.56k]
  ------------------
 1495|  88.1k|    offset += toData(buf + offset, val, byteOrder);
 1496|  88.1k|  }
 1497|  5.56k|  return offset;
 1498|  5.56k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE5countEv:
 1501|  24.5k|size_t ValueType<T>::count() const {
 1502|  24.5k|  return value_.size();
 1503|  24.5k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE4sizeEv:
 1506|  16.0k|size_t ValueType<T>::size() const {
 1507|  16.0k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  16.0k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE5writeERNS1_13basic_ostreamIcNS1_11char_traitsIcEEEE:
 1516|  1.23k|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|  1.23k|  auto end = value_.end();
 1518|  1.23k|  auto i = value_.begin();
 1519|  13.6k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 12.4k, False: 1.23k]
  ------------------
 1520|  12.4k|    os << std::setprecision(15) << *i;
 1521|  12.4k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 11.4k, False: 946]
  ------------------
 1522|  11.4k|      os << " ";
 1523|  12.4k|  }
 1524|  1.23k|  return os;
 1525|  1.23k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE12sizeDataAreaEv:
 1639|  1.38k|size_t ValueType<T>::sizeDataArea() const {
 1640|  1.38k|  return pDataArea_.size();
 1641|  1.38k|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE8dataAreaEv:
 1644|     72|DataBuf ValueType<T>::dataArea() const {
 1645|     72|  return {pDataArea_.data(), pDataArea_.size()};
 1646|     72|}
_ZNK5Exiv29ValueTypeINSt3__14pairIiiEEE6clone_Ev:
 1511|  26.0k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  26.0k|  return new ValueType<T>(*this);
 1513|  26.0k|}
_ZN5Exiv29ValueTypeINSt3__14pairIiiEEEC2ERKS4_:
 1447|  26.0k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  26.0k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 503, False: 25.5k]
  ------------------
 1449|    503|    pDataArea_ = rhs.pDataArea_;
 1450|  26.0k|}
_ZN5Exiv29ValueTypeIfEC2Ev:
 1433|  4.95k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  4.95k|}
_ZN5Exiv29ValueTypeIfE4readEPKhmNS_9ByteOrderE:
 1467|  4.95k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  4.95k|  value_.clear();
 1469|  4.95k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  4.95k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 4.95k, False: 0]
  |  Branch (1470:17): [True: 0, False: 4.95k]
  ------------------
 1471|      0|    len = (len / ts) * ts;
 1472|  47.8k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 42.8k, False: 4.95k]
  ------------------
 1473|  42.8k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|  42.8k|  }
 1475|  4.95k|  return 0;
 1476|  4.95k|}
_ZN5Exiv29ValueTypeIfE11setDataAreaEPKhm:
 1649|    583|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    583|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 475, False: 108]
  ------------------
 1651|    475|    pDataArea_ = Blob(buf, buf + len);
 1652|    108|  else
 1653|    108|    pDataArea_.clear();
 1654|    583|  return 0;
 1655|    583|}
_ZNK5Exiv29ValueTypeIfE4copyEPhNS_9ByteOrderE:
 1492|  3.39k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  3.39k|  size_t offset = 0;
 1494|  50.7k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 50.7k, False: 3.39k]
  ------------------
 1495|  50.7k|    offset += toData(buf + offset, val, byteOrder);
 1496|  50.7k|  }
 1497|  3.39k|  return offset;
 1498|  3.39k|}
_ZNK5Exiv29ValueTypeIfE5countEv:
 1501|  23.6k|size_t ValueType<T>::count() const {
 1502|  23.6k|  return value_.size();
 1503|  23.6k|}
_ZNK5Exiv29ValueTypeIfE4sizeEv:
 1506|  8.65k|size_t ValueType<T>::size() const {
 1507|  8.65k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  8.65k|}
_ZNK5Exiv29ValueTypeIfE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|    427|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    427|  auto end = value_.end();
 1518|    427|  auto i = value_.begin();
 1519|   111k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 111k, False: 427]
  ------------------
 1520|   111k|    os << std::setprecision(15) << *i;
 1521|   111k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 111k, False: 388]
  ------------------
 1522|   111k|      os << " ";
 1523|   111k|  }
 1524|    427|  return os;
 1525|    427|}
_ZNK5Exiv29ValueTypeIfE12sizeDataAreaEv:
 1639|  3.40k|size_t ValueType<T>::sizeDataArea() const {
 1640|  3.40k|  return pDataArea_.size();
 1641|  3.40k|}
_ZNK5Exiv29ValueTypeIfE8dataAreaEv:
 1644|    163|DataBuf ValueType<T>::dataArea() const {
 1645|    163|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    163|}
_ZNK5Exiv29ValueTypeIfE6clone_Ev:
 1511|  17.4k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  17.4k|  return new ValueType<T>(*this);
 1513|  17.4k|}
_ZN5Exiv29ValueTypeIfEC2ERKS1_:
 1447|  17.4k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  17.4k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 740, False: 16.6k]
  ------------------
 1449|    740|    pDataArea_ = rhs.pDataArea_;
 1450|  17.4k|}
_ZN5Exiv29ValueTypeIdEC2Ev:
 1433|  9.93k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  9.93k|}
_ZN5Exiv29ValueTypeIdE4readEPKhmNS_9ByteOrderE:
 1467|  9.93k|int ValueType<T>::read(const byte* buf, size_t len, ByteOrder byteOrder) {
 1468|  9.93k|  value_.clear();
 1469|  9.93k|  size_t ts = TypeInfo::typeSize(typeId());
 1470|  9.93k|  if (ts > 0 && len % ts != 0)
  ------------------
  |  Branch (1470:7): [True: 9.93k, False: 0]
  |  Branch (1470:17): [True: 0, False: 9.93k]
  ------------------
 1471|      0|    len = (len / ts) * ts;
 1472|   297k|  for (size_t i = 0; i < len; i += ts) {
  ------------------
  |  Branch (1472:22): [True: 287k, False: 9.93k]
  ------------------
 1473|   287k|    value_.push_back(getValue<T>(buf + i, byteOrder));
 1474|   287k|  }
 1475|  9.93k|  return 0;
 1476|  9.93k|}
_ZN5Exiv29ValueTypeIdE11setDataAreaEPKhm:
 1649|    971|int ValueType<T>::setDataArea(const byte* buf, size_t len) {
 1650|    971|  if (len > 0)
  ------------------
  |  Branch (1650:7): [True: 593, False: 378]
  ------------------
 1651|    593|    pDataArea_ = Blob(buf, buf + len);
 1652|    378|  else
 1653|    378|    pDataArea_.clear();
 1654|    971|  return 0;
 1655|    971|}
_ZNK5Exiv29ValueTypeIdE4copyEPhNS_9ByteOrderE:
 1492|  5.30k|size_t ValueType<T>::copy(byte* buf, ByteOrder byteOrder) const {
 1493|  5.30k|  size_t offset = 0;
 1494|   179k|  for (const auto& val : value_) {
  ------------------
  |  Branch (1494:24): [True: 179k, False: 5.30k]
  ------------------
 1495|   179k|    offset += toData(buf + offset, val, byteOrder);
 1496|   179k|  }
 1497|  5.30k|  return offset;
 1498|  5.30k|}
_ZNK5Exiv29ValueTypeIdE5countEv:
 1501|  27.0k|size_t ValueType<T>::count() const {
 1502|  27.0k|  return value_.size();
 1503|  27.0k|}
_ZNK5Exiv29ValueTypeIdE4sizeEv:
 1506|  16.4k|size_t ValueType<T>::size() const {
 1507|  16.4k|  return TypeInfo::typeSize(typeId()) * value_.size();
 1508|  16.4k|}
_ZNK5Exiv29ValueTypeIdE5writeERNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
 1516|    459|std::ostream& ValueType<T>::write(std::ostream& os) const {
 1517|    459|  auto end = value_.end();
 1518|    459|  auto i = value_.begin();
 1519|  3.18k|  while (i != end) {
  ------------------
  |  Branch (1519:10): [True: 2.72k, False: 459]
  ------------------
 1520|  2.72k|    os << std::setprecision(15) << *i;
 1521|  2.72k|    if (++i != end)
  ------------------
  |  Branch (1521:9): [True: 2.40k, False: 317]
  ------------------
 1522|  2.40k|      os << " ";
 1523|  2.72k|  }
 1524|    459|  return os;
 1525|    459|}
_ZNK5Exiv29ValueTypeIdE12sizeDataAreaEv:
 1639|  2.97k|size_t ValueType<T>::sizeDataArea() const {
 1640|  2.97k|  return pDataArea_.size();
 1641|  2.97k|}
_ZNK5Exiv29ValueTypeIdE8dataAreaEv:
 1644|    225|DataBuf ValueType<T>::dataArea() const {
 1645|    225|  return {pDataArea_.data(), pDataArea_.size()};
 1646|    225|}
_ZNK5Exiv29ValueTypeIdE6clone_Ev:
 1511|  30.0k|ValueType<T>* ValueType<T>::clone_() const {
 1512|  30.0k|  return new ValueType<T>(*this);
 1513|  30.0k|}
_ZN5Exiv29ValueTypeIdEC2ERKS1_:
 1447|  30.0k|ValueType<T>::ValueType(const ValueType<T>& rhs) : Value(rhs.typeId()), value_(rhs.value_) {
 1448|  30.0k|  if (!rhs.pDataArea_.empty())
  ------------------
  |  Branch (1448:7): [True: 521, False: 29.5k]
  ------------------
 1449|    521|    pDataArea_ = rhs.pDataArea_;
 1450|  30.0k|}
_ZZNK5Exiv222LangAltValueComparatorclERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_ENKUlhhE_clEhh:
  799|   291k|    auto f = [](unsigned char a, unsigned char b) { return std::tolower(a) > std::tolower(b); };
_ZN5Exiv29ValueTypeIjEC2Ev:
 1433|  3.34k|ValueType<T>::ValueType() : Value(getType<T>()) {
 1434|  3.34k|}

_ZNK5Exiv27XmpData9usePacketEv:
  217|  14.9k|  [[nodiscard]] bool usePacket() const {
  218|  14.9k|    return usePacket_;
  219|  14.9k|  }
_ZN5Exiv27XmpData9usePacketEb:
  222|  37.8k|  bool usePacket(bool b) {
  223|  37.8k|    bool r = usePacket_;
  224|  37.8k|    usePacket_ = b;
  225|  37.8k|    return r;
  226|  37.8k|  }
_ZN5Exiv27XmpData9setPacketENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  228|  33.2k|  void setPacket(std::string xmpPacket) {
  229|  33.2k|    xmpPacket_ = std::move(xmpPacket);
  230|  33.2k|    usePacket(false);
  231|  33.2k|  }
_ZNK5Exiv27XmpData10nsBindingsEv:
  261|  63.2k|  [[nodiscard]] const std::map<std::string, std::string>& nsBindings() const {
  262|  63.2k|    return nsBindings_;
  263|  63.2k|  }
_ZN5Exiv27XmpDataC2Ev:
  141|  39.5k|  XmpData() = default;
_ZN5Exiv28XmpdatumaSINS_5ValueEEERS0_RKT_:
  396|  18.9k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|  18.9k|    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|  18.9k|  return *this;
  406|  18.9k|}
_ZN5Exiv28XmpdatumaSINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEERS0_RKT_:
  396|  44.3k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|  44.3k|    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|  44.3k|  return *this;
  406|  44.3k|}
_ZN5Exiv28XmpdatumaSIdEERS0_RKT_:
  396|   182k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|   182k|    setValue(Exiv2::toString(value));
  405|   182k|  return *this;
  406|   182k|}
_ZN5Exiv28XmpdatumaSImEERS0_RKT_:
  396|  13.1k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  13.1k|    setValue(Exiv2::toString(value));
  405|  13.1k|  return *this;
  406|  13.1k|}
_ZN5Exiv28XmpdatumaSIjEERS0_RKT_:
  396|  15.4k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  15.4k|    setValue(Exiv2::toString(value));
  405|  15.4k|  return *this;
  406|  15.4k|}
_ZN5Exiv28XmpdatumaSIPKhEERS0_RKT_:
  396|  1.33k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  1.33k|    setValue(Exiv2::toString(value));
  405|  1.33k|  return *this;
  406|  1.33k|}
_ZN5Exiv28XmpdatumaSIA4_cEERS0_RKT_:
  396|  1.42k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|  1.42k|    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|  1.42k|  return *this;
  406|  1.42k|}
_ZN5Exiv28XmpdatumaSIlEERS0_RKT_:
  396|  1.74k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  1.74k|    setValue(Exiv2::toString(value));
  405|  1.74k|  return *this;
  406|  1.74k|}
_ZN5Exiv28XmpdatumaSIfEERS0_RKT_:
  396|  1.73k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  1.73k|    setValue(Exiv2::toString(value));
  405|  1.73k|  return *this;
  406|  1.73k|}
_ZN5Exiv28XmpdatumaSIA18_cEERS0_RKT_:
  396|    310|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|    310|    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|    310|  return *this;
  406|    310|}
_ZN5Exiv28XmpdatumaSItEERS0_RKT_:
  396|   122k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|   122k|    setValue(Exiv2::toString(value));
  405|   122k|  return *this;
  406|   122k|}
_ZN5Exiv28XmpdatumaSIsEERS0_RKT_:
  396|  1.58k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|  1.58k|    setValue(Exiv2::toString(value));
  405|  1.58k|  return *this;
  406|  1.58k|}
_ZN5Exiv28XmpdatumaSIPhEERS0_RKT_:
  396|   181k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|   181k|    setValue(Exiv2::toString(value));
  405|   181k|  return *this;
  406|   181k|}
_ZN5Exiv28XmpdatumaSIPKcEERS0_RKT_:
  396|  16.7k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|  16.7k|    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|  16.7k|  return *this;
  406|  16.7k|}
_ZN5Exiv28XmpdatumaSIiEERS0_RKT_:
  396|   183k|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|       |    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|   183k|    setValue(Exiv2::toString(value));
  405|   183k|  return *this;
  406|   183k|}
_ZN5Exiv28XmpdatumaSIA12_cEERS0_RKT_:
  396|     50|Xmpdatum& Xmpdatum::operator=(const T& value) {
  397|       |  if constexpr (std::is_same_v<T, bool>)
  398|       |    setValue(value ? "True" : "False");
  399|       |  else if constexpr (std::is_convertible_v<T, std::string>)
  400|     50|    setValue(value);
  401|       |  else if constexpr (std::is_base_of_v<Value, T>)
  402|       |    setValue(&value);
  403|       |  else
  404|       |    setValue(Exiv2::toString(value));
  405|     50|  return *this;
  406|     50|}

_ZNK5Exiv28AsfVideo7GUIDTageqERKS1_:
   42|  8.79k|bool AsfVideo::GUIDTag::operator==(const AsfVideo::GUIDTag& other) const {
   43|  8.79k|  return data1_ == other.data1_ && data2_ == other.data2_ && data3_ == other.data3_ && data4_ == other.data4_;
  ------------------
  |  Branch (43:10): [True: 3.33k, False: 5.46k]
  |  Branch (43:36): [True: 3.29k, False: 42]
  |  Branch (43:62): [True: 3.25k, False: 34]
  |  Branch (43:88): [True: 3.25k, False: 4]
  ------------------
   44|  8.79k|}
_ZN5Exiv28AsfVideo7GUIDTagC2EPKh:
   46|  14.4k|AsfVideo::GUIDTag::GUIDTag(const uint8_t* bytes) {
   47|  14.4k|  data1_ = Exiv2::getULong(bytes, ByteOrder::littleEndian);
   48|  14.4k|  data2_ = Exiv2::getUShort(bytes + DWORD, ByteOrder::littleEndian);
   49|  14.4k|  data3_ = Exiv2::getUShort(bytes + DWORD + WORD, ByteOrder::littleEndian);
   50|  14.4k|  std::copy(bytes + QWORD, bytes + (2 * QWORD), data4_.begin());
   51|  14.4k|}
_ZNK5Exiv28AsfVideo7GUIDTag9to_stringEv:
   53|    607|std::string AsfVideo::GUIDTag::to_string() const {
   54|       |  // Concatenate all strings into a single string
   55|       |  // Convert the string to uppercase
   56|       |  // Example of output 399595EC-8667-4E2D-8FDB-98814CE76C1E
   57|    607|  return stringFormat("{:08X}-{:04X}-{:04X}-{:02X}{:02X}-{:02X}{:02X}{:02X}{:02X}{:02X}{:02X}", data1_, data2_, data3_,
  ------------------
  |  |   18|    607|#define stringFormat std::format
  ------------------
   58|    607|                      data4_[0], data4_[1], data4_[2], data4_[3], data4_[4], data4_[5], data4_[6], data4_[7]);
   59|    607|}
_ZNK5Exiv28AsfVideo7GUIDTagltERKS1_:
   61|  35.5k|bool AsfVideo::GUIDTag::operator<(const GUIDTag& other) const {
   62|  35.5k|  if (data1_ != other.data1_)
  ------------------
  |  Branch (62:7): [True: 26.3k, False: 9.21k]
  ------------------
   63|  26.3k|    return data1_ < other.data1_;
   64|  9.21k|  if (data2_ != other.data2_)
  ------------------
  |  Branch (64:7): [True: 164, False: 9.04k]
  ------------------
   65|    164|    return data2_ < other.data2_;
   66|  9.04k|  if (data3_ != other.data3_)
  ------------------
  |  Branch (66:7): [True: 545, False: 8.50k]
  ------------------
   67|    545|    return data3_ < other.data3_;
   68|  8.50k|  return std::lexicographical_compare(data4_.begin(), data4_.end(), other.data4_.begin(), other.data4_.end());
   69|  9.04k|}
_ZN5Exiv28AsfVideoC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  183|  1.08k|    Image(ImageType::asf, mdNone, std::move(io), params) {
  184|  1.08k|}  // AsfVideo::AsfVideo
_ZNK5Exiv28AsfVideo8mimeTypeEv:
  186|  1.08k|std::string AsfVideo::mimeType() const {
  187|  1.08k|  return "video/asf";
  188|  1.08k|}
_ZN5Exiv28AsfVideo13writeMetadataEv:
  190|      5|void AsfVideo::writeMetadata() {
  191|      5|}
_ZN5Exiv28AsfVideo12readMetadataEv:
  193|  1.08k|void AsfVideo::readMetadata() {
  194|  1.08k|  if (io_->open() != 0)
  ------------------
  |  Branch (194:7): [True: 0, False: 1.08k]
  ------------------
  195|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  196|       |
  197|       |  // Ensure that this is the correct image type
  198|  1.08k|  if (!isAsfType(*io_, false)) {
  ------------------
  |  Branch (198:7): [True: 0, False: 1.08k]
  ------------------
  199|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (199:9): [True: 0, False: 0]
  |  Branch (199:25): [True: 0, False: 0]
  ------------------
  200|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  201|      0|    throw Error(ErrorCode::kerNotAnImage, "ASF");
  202|      0|  }
  203|       |
  204|  1.08k|  IoCloser closer(*io_);
  205|  1.08k|  clearMetadata();
  206|  1.08k|  io_->seek(0, BasicIo::beg);
  207|  1.08k|  height_ = width_ = 1;
  208|       |
  209|  1.08k|  xmpData()["Xmp.video.FileSize"] = io_->size() / 1048576.;
  210|  1.08k|  xmpData()["Xmp.video.MimeType"] = mimeType();
  211|       |
  212|  1.08k|  decodeBlock(0);
  213|       |
  214|  1.08k|  xmpData_["Xmp.video.AspectRatio"] = getAspectRatio(width_, height_);
  215|  1.08k|}  // AsfVideo::readMetadata
_ZN5Exiv28AsfVideo12HeaderReaderC2ERKNSt3__110unique_ptrINS_7BasicIoENS2_14default_deleteIS4_EEEE:
  217|  4.54k|AsfVideo::HeaderReader::HeaderReader(const BasicIo::UniquePtr& io) : IdBuf_(GUID) {
  218|  4.54k|  if (io->size() >= io->tell() + GUID + QWORD) {
  ------------------
  |  Branch (218:7): [True: 4.54k, False: 0]
  ------------------
  219|  4.54k|    io->readOrThrow(IdBuf_.data(), IdBuf_.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  220|       |
  221|  4.54k|    size_ = readQWORDTag(io);
  222|  4.54k|    if (size_ >= GUID + QWORD)
  ------------------
  |  Branch (222:9): [True: 2.28k, False: 2.25k]
  ------------------
  223|  2.28k|      remaining_size_ = size_ - GUID - QWORD;
  224|  4.54k|  }
  225|  4.54k|}
_ZN5Exiv28AsfVideo11decodeBlockEm:
  227|  4.60k|void AsfVideo::decodeBlock(size_t depth) {
  228|  4.60k|  Internal::enforce(GUID + QWORD <= io_->size() - io_->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  229|  4.60k|  HeaderReader objectHeader(io_);
  230|       |#ifdef EXIV2_DEBUG_MESSAGES
  231|       |  EXV_INFO << "decodeBlock = " << GUIDTag(objectHeader.getId().data()).to_string()
  232|       |           << "\tsize= " << objectHeader.getSize() << "\t " << io_->tell() << "/" << io_->size() << '\n';
  233|       |#endif
  234|  4.60k|  Internal::enforce(objectHeader.getSize() <= io_->size() - io_->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  235|  4.60k|  auto tag = GUIDReferenceTags.find(GUIDTag(objectHeader.getId().data()));
  236|       |
  237|  4.60k|  if (tag != GUIDReferenceTags.end()) {
  ------------------
  |  Branch (237:7): [True: 3.65k, False: 951]
  ------------------
  238|  3.65k|    if (tag->second == "Header")
  ------------------
  |  Branch (238:9): [True: 1.16k, False: 2.48k]
  ------------------
  239|  1.16k|      decodeHeader(depth + 1);
  240|  2.48k|    else if (tag->second == "File_Properties")
  ------------------
  |  Branch (240:14): [True: 613, False: 1.87k]
  ------------------
  241|    613|      fileProperties();
  242|  1.87k|    else if (tag->second == "Stream_Properties")
  ------------------
  |  Branch (242:14): [True: 677, False: 1.19k]
  ------------------
  243|    677|      streamProperties();
  244|  1.19k|    else if (tag->second == "Header_Extension")
  ------------------
  |  Branch (244:14): [True: 99, False: 1.09k]
  ------------------
  245|     99|      headerExtension();
  246|  1.09k|    else if (tag->second == "Codec_List")
  ------------------
  |  Branch (246:14): [True: 176, False: 921]
  ------------------
  247|    176|      codecList();
  248|    921|    else if (tag->second == "Extended_Content_Description")
  ------------------
  |  Branch (248:14): [True: 409, False: 512]
  ------------------
  249|    409|      extendedContentDescription();
  250|    512|    else if (tag->second == "Content_Description")
  ------------------
  |  Branch (250:14): [True: 258, False: 254]
  ------------------
  251|    258|      contentDescription();
  252|    254|    else if (tag->second == "Extended_Stream_Properties")
  ------------------
  |  Branch (252:14): [True: 125, False: 129]
  ------------------
  253|    125|      extendedStreamProperties();
  254|    129|    else if (tag->second == "Degradable_JPEG_Media")
  ------------------
  |  Branch (254:14): [True: 0, False: 129]
  ------------------
  255|      0|      DegradableJPEGMedia();
  256|    129|    else {  // tag found but not processed
  257|       |      // Make sure that the remaining size is non-zero, so that we won't
  258|       |      // keep revisiting the same location in the file.
  259|    129|      const uint64_t remaining_size = objectHeader.getRemainingSize();
  260|    129|      Internal::enforce(remaining_size > 0, Exiv2::ErrorCode::kerCorruptedMetadata);
  261|    129|      io_->seekOrThrow(io_->tell() + remaining_size, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  262|    129|    }
  263|  3.65k|  } else {  // tag not found
  264|       |    // Make sure that the remaining size is non-zero, so that we won't keep
  265|       |    // revisiting the same location in the file.
  266|    951|    const uint64_t remaining_size = objectHeader.getRemainingSize();
  267|    951|    Internal::enforce(remaining_size > 0, Exiv2::ErrorCode::kerCorruptedMetadata);
  268|    951|    io_->seekOrThrow(io_->tell() + remaining_size, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  269|    951|  }
  270|       |
  271|  4.60k|}  // AsfVideo::decodeBlock
_ZN5Exiv28AsfVideo12decodeHeaderEm:
  273|  1.16k|void AsfVideo::decodeHeader(size_t depth) {
  274|  1.16k|  Internal::enforce(depth <= max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata);
  275|  1.16k|  DataBuf nbHeadersBuf(DWORD + 1);
  276|  1.16k|  io_->readOrThrow(nbHeadersBuf.data(), DWORD, Exiv2::ErrorCode::kerCorruptedMetadata);
  277|       |
  278|  1.16k|  uint32_t nb_headers = Exiv2::getULong(nbHeadersBuf.data(), littleEndian);
  279|  1.16k|  Internal::enforce(nb_headers < std::numeric_limits<uint32_t>::max(), Exiv2::ErrorCode::kerCorruptedMetadata);
  280|  1.16k|  io_->seekOrThrow(io_->tell() + (BYTE * 2), BasicIo::beg,
  281|  1.16k|                   ErrorCode::kerFailedToReadImageData);  // skip two reserved tags
  282|  4.68k|  for (uint32_t i = 0; i < nb_headers; i++) {
  ------------------
  |  Branch (282:24): [True: 3.51k, False: 1.16k]
  ------------------
  283|  3.51k|    decodeBlock(depth);
  284|  3.51k|  }
  285|  1.16k|}
_ZN5Exiv28AsfVideo24extendedStreamPropertiesEv:
  287|    125|void AsfVideo::extendedStreamProperties() {
  288|    125|  xmpData()["Xmp.video.StartTimecode"] = readQWORDTag(io_);  // Start Time
  289|    125|  xmpData()["Xmp.video.EndTimecode"] = readWORDTag(io_);     // End Time
  290|       |
  291|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Data Bitrate
  292|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Buffer Size
  293|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Initial Buffer Fullness
  294|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Alternate Data Bitrate
  295|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Alternate Buffer Size
  296|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Alternate Initial Buffer Fullness
  297|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Maximum Object Size
  298|    125|  io_->seek(io_->tell() + DWORD, BasicIo::beg);  // ignore Flags Buffer Size
  299|    125|  io_->seek(io_->tell() + WORD, BasicIo::beg);   // ignore Flags Stream Number
  300|    125|  io_->seek(io_->tell() + WORD, BasicIo::beg);   // ignore Stream Language ID Index
  301|       |
  302|    125|  xmpData()["Xmp.video.FrameRate"] = readWORDTag(io_);  // Average Time Per Frame
  303|    125|  uint16_t stream_name_count = readWORDTag(io_);
  304|    125|  uint16_t payload_ext_sys_count = readWORDTag(io_);
  305|       |
  306|    690|  for (uint16_t i = 0; i < stream_name_count; i++) {
  ------------------
  |  Branch (306:24): [True: 565, False: 125]
  ------------------
  307|    565|    io_->seek(io_->tell() + WORD, BasicIo::beg);  // ignore Language ID Index
  308|    565|    uint16_t stream_length = readWORDTag(io_);
  309|    565|    if (stream_length)
  ------------------
  |  Branch (309:9): [True: 279, False: 286]
  ------------------
  310|    279|      io_->seek(io_->tell() + stream_length, BasicIo::beg);  // ignore Stream name
  311|    565|  }
  312|       |
  313|    547|  for (uint16_t i = 0; i < payload_ext_sys_count; i++) {
  ------------------
  |  Branch (313:24): [True: 422, False: 125]
  ------------------
  314|    422|    io_->seek(io_->tell() + GUID, BasicIo::beg);  // ignore Extension System ID
  315|    422|    io_->seek(io_->tell() + WORD, BasicIo::beg);  // ignore Extension Data Size
  316|    422|    uint16_t ext_sys_info_length = readWORDTag(io_);
  317|    422|    if (ext_sys_info_length)
  ------------------
  |  Branch (317:9): [True: 111, False: 311]
  ------------------
  318|    111|      io_->seek(io_->tell() + ext_sys_info_length, BasicIo::beg);  // ignore Extension System Info
  319|    422|  }
  320|    125|}  // AsfVideo::extendedStreamProperties
_ZN5Exiv28AsfVideo16streamPropertiesEv:
  337|    677|void AsfVideo::streamProperties() {
  338|    677|  DataBuf streamTypedBuf(GUID);
  339|    677|  io_->readOrThrow(streamTypedBuf.data(), streamTypedBuf.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  340|       |
  341|    677|  enum class streamTypeInfo { Audio = 1, Video = 2 };
  342|    677|  auto stream = streamTypeInfo{0};
  343|       |
  344|    677|  auto tag_stream_type = GUIDReferenceTags.find(GUIDTag(streamTypedBuf.data()));
  345|    677|  if (tag_stream_type != GUIDReferenceTags.end()) {
  ------------------
  |  Branch (345:7): [True: 339, False: 338]
  ------------------
  346|    339|    if (tag_stream_type->second == "Audio_Media")
  ------------------
  |  Branch (346:9): [True: 12, False: 327]
  ------------------
  347|     12|      stream = streamTypeInfo::Audio;
  348|    327|    else if (tag_stream_type->second == "Video_Media")
  ------------------
  |  Branch (348:14): [True: 18, False: 309]
  ------------------
  349|     18|      stream = streamTypeInfo::Video;
  350|       |
  351|    339|    io_->seek(io_->tell() + GUID, BasicIo::beg);  // ignore Error Correction Type
  352|       |
  353|    339|    uint64_t time_offset = readQWORDTag(io_);
  354|    339|    if (stream == streamTypeInfo::Video)
  ------------------
  |  Branch (354:9): [True: 18, False: 321]
  ------------------
  355|     18|      xmpData()["Xmp.video.TimeOffset"] = time_offset;
  356|    321|    else if (stream == streamTypeInfo::Audio)
  ------------------
  |  Branch (356:14): [True: 12, False: 309]
  ------------------
  357|     12|      xmpData()["Xmp.audio.TimeOffset"] = time_offset;
  358|       |
  359|    339|    auto specific_data_length = readDWORDTag(io_);
  360|    339|    auto correction_data_length = readDWORDTag(io_);
  361|       |
  362|    339|    io_->seek(io_->tell() + WORD /*Flags*/ + DWORD /*Reserved*/ + specific_data_length + correction_data_length,
  363|    339|              BasicIo::beg);
  364|    339|  }
  365|       |
  366|    677|}  // AsfVideo::streamProperties
_ZN5Exiv28AsfVideo9codecListEv:
  368|    176|void AsfVideo::codecList() {
  369|    176|  io_->seek(io_->tell() + GUID /*reserved*/, BasicIo::beg);
  370|    176|  auto entries_count = readDWORDTag(io_);
  371|    924|  for (uint32_t i = 0; i < entries_count; i++) {
  ------------------
  |  Branch (371:24): [True: 748, False: 176]
  ------------------
  372|    748|    uint16_t codec_type = readWORDTag(io_) * 2;
  373|    748|    std::string codec = (codec_type == 1) ? "Xmp.video" : "Xmp.audio";
  ------------------
  |  Branch (373:25): [True: 0, False: 748]
  ------------------
  374|       |
  375|    748|    if (uint16_t codec_name_length = readWORDTag(io_) * 2)
  ------------------
  |  Branch (375:18): [True: 637, False: 111]
  ------------------
  376|    637|      xmpData()[codec + std::string(".CodecName")] = readStringWcharTag(io_, codec_name_length);
  377|       |
  378|    748|    if (uint16_t codec_desc_length = readWORDTag(io_))
  ------------------
  |  Branch (378:18): [True: 592, False: 156]
  ------------------
  379|    592|      xmpData()[codec + std::string(".CodecDescription")] = readStringWcharTag(io_, codec_desc_length);
  380|       |
  381|    748|    uint16_t codec_info_length = readWORDTag(io_);
  382|    748|    Internal::enforce(codec_info_length && codec_info_length < io_->size() - io_->tell(),
  ------------------
  |  Branch (382:23): [True: 627, False: 121]
  |  Branch (382:44): [True: 604, False: 23]
  ------------------
  383|    748|                      Exiv2::ErrorCode::kerCorruptedMetadata);
  384|    748|    xmpData()[codec + std::string(".CodecInfo")] = readStringTag(io_, codec_info_length);
  385|    748|  }
  386|    176|}  // AsfVideo::codecList
_ZNK5Exiv28AsfVideo15headerExtensionEv:
  388|     99|void AsfVideo::headerExtension() const {
  389|     99|  io_->seek(io_->tell() + GUID /*reserved1*/ + WORD /*Reserved2*/, BasicIo::beg);
  390|     99|  auto header_ext_data_length = readDWORDTag(io_);
  391|     99|  io_->seek(io_->tell() + header_ext_data_length, BasicIo::beg);
  392|     99|}  // AsfVideo::headerExtension
_ZN5Exiv28AsfVideo26extendedContentDescriptionEv:
  394|    409|void AsfVideo::extendedContentDescription() {
  395|    409|  uint16_t content_descriptor_count = readWORDTag(io_);
  396|    409|  std::string value;
  397|       |
  398|  27.5k|  for (uint16_t i = 0; i < content_descriptor_count; i++) {
  ------------------
  |  Branch (398:24): [True: 27.2k, False: 300]
  ------------------
  399|  27.2k|    if (uint16_t descriptor_name_length = readWORDTag(io_))
  ------------------
  |  Branch (399:18): [True: 4.37k, False: 22.8k]
  ------------------
  400|  4.37k|      value += readStringWcharTag(io_, descriptor_name_length);  // Descriptor Name
  401|       |
  402|  27.2k|    uint16_t descriptor_value_data_type = readWORDTag(io_);
  403|  27.2k|    if (uint16_t descriptor_value_length = readWORDTag(io_)) {
  ------------------
  |  Branch (403:18): [True: 4.92k, False: 22.3k]
  ------------------
  404|       |      // Descriptor Value
  405|  4.92k|      switch (descriptor_value_data_type) {
  ------------------
  |  Branch (405:15): [True: 2.91k, False: 2.01k]
  ------------------
  406|    938|        case 0 /*Unicode string */:
  ------------------
  |  Branch (406:9): [True: 938, False: 3.99k]
  ------------------
  407|    938|          value += std::string(": ") + readStringWcharTag(io_, descriptor_value_length);
  408|    938|          break;
  409|     78|        case 1 /*BYTE array  */:
  ------------------
  |  Branch (409:9): [True: 78, False: 4.85k]
  ------------------
  410|     78|          value += std::string(": ") + readStringTag(io_, descriptor_value_length);
  411|     78|          break;
  412|    289|        case 2 /*BOOL*/:
  ------------------
  |  Branch (412:9): [True: 289, False: 4.63k]
  ------------------
  413|    289|          value += std::string(": ") + std::to_string(readWORDTag(io_));
  414|    289|          break;
  415|  1.11k|        case 3 /*DWORD */:
  ------------------
  |  Branch (415:9): [True: 1.11k, False: 3.81k]
  ------------------
  416|  1.11k|          value += std::string(": ") + std::to_string(readDWORDTag(io_));
  417|  1.11k|          break;
  418|    129|        case 4 /*QWORD */:
  ------------------
  |  Branch (418:9): [True: 129, False: 4.79k]
  ------------------
  419|    129|          value += std::string(": ") + std::to_string(readQWORDTag(io_));
  420|    129|          break;
  421|    364|        case 5 /*WORD*/:
  ------------------
  |  Branch (421:9): [True: 364, False: 4.56k]
  ------------------
  422|    364|          value += std::string(": ") + std::to_string(readWORDTag(io_));
  423|    364|          break;
  424|  4.92k|      }
  425|  4.92k|    }
  426|  27.1k|    value += std::string(", ");
  427|  27.1k|  }
  428|       |
  429|    300|  xmpData()["Xmp.video.ExtendedContentDescription"] = value;
  430|    300|}  // AsfVideo::extendedContentDescription
_ZN5Exiv28AsfVideo18contentDescriptionEv:
  432|    258|void AsfVideo::contentDescription() {
  433|    258|  uint16_t title_length = readWORDTag(io_);
  434|    258|  uint16_t author_length = readWORDTag(io_);
  435|    258|  uint16_t copyright_length = readWORDTag(io_);
  436|    258|  uint16_t desc_length = readWORDTag(io_);
  437|    258|  uint16_t rating_length = readWORDTag(io_);
  438|       |
  439|    258|  if (title_length)
  ------------------
  |  Branch (439:7): [True: 183, False: 75]
  ------------------
  440|    183|    xmpData()["Xmp.video.Title"] = readStringWcharTag(io_, title_length);
  441|       |
  442|    258|  if (author_length)
  ------------------
  |  Branch (442:7): [True: 116, False: 142]
  ------------------
  443|    116|    xmpData()["Xmp.video.Author"] = readStringWcharTag(io_, author_length);
  444|       |
  445|    258|  if (copyright_length)
  ------------------
  |  Branch (445:7): [True: 65, False: 193]
  ------------------
  446|     65|    xmpData()["Xmp.video.Copyright"] = readStringWcharTag(io_, copyright_length);
  447|       |
  448|    258|  if (desc_length)
  ------------------
  |  Branch (448:7): [True: 101, False: 157]
  ------------------
  449|    101|    xmpData()["Xmp.video.Description"] = readStringWcharTag(io_, desc_length);
  450|       |
  451|    258|  if (rating_length)
  ------------------
  |  Branch (451:7): [True: 36, False: 222]
  ------------------
  452|     36|    xmpData()["Xmp.video.Rating"] = readStringWcharTag(io_, rating_length);
  453|       |
  454|    258|}  // AsfVideo::extendedContentDescription
_ZN5Exiv28AsfVideo14filePropertiesEv:
  456|    613|void AsfVideo::fileProperties() {
  457|    613|  DataBuf FileIddBuf(GUID);
  458|    613|  io_->readOrThrow(FileIddBuf.data(), FileIddBuf.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  459|    613|  xmpData()["Xmp.video.FileID"] = GUIDTag(FileIddBuf.data()).to_string();
  460|    613|  xmpData()["Xmp.video.FileLength"] = readQWORDTag(io_);
  461|    613|  xmpData()["Xmp.video.CreationDate"] = readQWORDTag(io_);
  462|    613|  xmpData()["Xmp.video.DataPackets"] = readQWORDTag(io_);
  463|    613|  xmpData()["Xmp.video.duration"] = readQWORDTag(io_);
  464|    613|  xmpData()["Xmp.video.SendDuration"] = readQWORDTag(io_);
  465|    613|  xmpData()["Xmp.video.Preroll"] = readQWORDTag(io_);
  466|       |
  467|    613|  io_->seek(io_->tell() + DWORD + DWORD + DWORD,
  468|    613|            BasicIo::beg);  // ignore Flags, Minimum Data Packet Size and Maximum Data Packet Size
  469|    613|  xmpData()["Xmp.video.MaxBitRate"] = readDWORDTag(io_);
  470|    613|}  // AsfVideo::fileProperties
_ZN5Exiv214newAsfInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  472|  1.08k|Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  473|  1.08k|  auto image = std::make_unique<AsfVideo>(std::move(io), params);
  474|  1.08k|  if (!image->good()) {
  ------------------
  |  Branch (474:7): [True: 0, False: 1.08k]
  ------------------
  475|      0|    return nullptr;
  476|      0|  }
  477|  1.08k|  return image;
  478|  1.08k|}
_ZN5Exiv29isAsfTypeERNS_7BasicIoEb:
  480|  9.04k|bool isAsfType(BasicIo& iIo, bool advance) {
  481|  9.04k|  byte buf[GUID];
  482|  9.04k|  iIo.read(buf, GUID);
  483|       |
  484|  9.04k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (484:7): [True: 0, False: 9.04k]
  |  Branch (484:22): [True: 245, False: 8.79k]
  ------------------
  485|    245|    return false;
  486|    245|  }
  487|       |
  488|  8.79k|  bool matched = isASFType(buf);
  489|  8.79k|  if (!advance || !matched) {
  ------------------
  |  Branch (489:7): [True: 8.79k, False: 0]
  |  Branch (489:19): [True: 0, False: 0]
  ------------------
  490|  8.79k|    iIo.seek(0, BasicIo::beg);
  491|  8.79k|  }
  492|       |
  493|  8.79k|  return matched;
  494|  9.04k|}
asfvideo.cpp:_ZN5Exiv2L9isASFTypeEPKh:
  178|  8.79k|static bool isASFType(const byte buf[]) {
  179|  8.79k|  return Header == AsfVideo::GUIDTag(buf);
  180|  8.79k|}

_ZN5Exiv27BasicIoD2Ev:
   60|  60.5k|BasicIo::~BasicIo() = default;
_ZN5Exiv27BasicIo11readOrThrowEPhmNS_9ErrorCodeE:
   62|  3.34M|void BasicIo::readOrThrow(byte* buf, size_t rcount, ErrorCode err) {
   63|  3.34M|  const size_t nread = read(buf, rcount);
   64|  3.34M|  Internal::enforce(nread == rcount, err);
   65|  3.34M|  Internal::enforce(!error(), err);
   66|  3.34M|}
_ZN5Exiv27BasicIo11seekOrThrowElNS0_8PositionENS_9ErrorCodeE:
   68|  10.1k|void BasicIo::seekOrThrow(int64_t offset, Position pos, ErrorCode err) {
   69|  10.1k|  const int r = seek(offset, pos);
   70|  10.1k|  Internal::enforce(r == 0, err);
   71|  10.1k|}
_ZN5Exiv25MemIo4ImplC2EPKhm:
  627|  33.1k|MemIo::Impl::Impl(const byte* data, size_t size) : data_(const_cast<byte*>(data)), size_(size) {
  628|  33.1k|}
_ZN5Exiv25MemIo4Impl7reserveEm:
  681|  5.69M|void MemIo::Impl::reserve(size_t wcount) {
  682|  5.69M|  const size_t need = wcount + idx_;
  683|  5.69M|  size_t blockSize = 32 * 1024;  // 32768
  684|  5.69M|  const size_t maxBlockSize = 4 * 1024 * 1024;
  685|       |
  686|  5.69M|  if (!isMalloced_) {
  ------------------
  |  Branch (686:7): [True: 20.0k, False: 5.67M]
  ------------------
  687|       |    // Minimum size for 1st block
  688|  20.0k|    auto size = std::max<size_t>(blockSize * (1 + need / blockSize), size_);
  689|  20.0k|    auto data = static_cast<byte*>(std::malloc(size));
  690|  20.0k|    if (!data) {
  ------------------
  |  Branch (690:9): [True: 0, False: 20.0k]
  ------------------
  691|      0|      throw Error(ErrorCode::kerMallocFailed);
  692|      0|    }
  693|  20.0k|    if (data_) {
  ------------------
  |  Branch (693:9): [True: 0, False: 20.0k]
  ------------------
  694|      0|      std::memcpy(data, data_, size_);
  695|      0|    }
  696|  20.0k|    data_ = data;
  697|  20.0k|    sizeAlloced_ = size;
  698|  20.0k|    isMalloced_ = true;
  699|  20.0k|  }
  700|       |
  701|  5.69M|  if (need > size_) {
  ------------------
  |  Branch (701:7): [True: 4.56M, False: 1.13M]
  ------------------
  702|  4.56M|    if (need > sizeAlloced_) {
  ------------------
  |  Branch (702:9): [True: 12.5k, False: 4.54M]
  ------------------
  703|  12.5k|      blockSize = std::min(2 * sizeAlloced_, maxBlockSize);
  704|       |      // Allocate in blocks
  705|  12.5k|      size_t want = blockSize * (1 + need / blockSize);
  706|  12.5k|      data_ = static_cast<byte*>(std::realloc(data_, want));
  707|  12.5k|      if (!data_) {
  ------------------
  |  Branch (707:11): [True: 0, False: 12.5k]
  ------------------
  708|      0|        throw Error(ErrorCode::kerMallocFailed);
  709|      0|      }
  710|  12.5k|      sizeAlloced_ = want;
  711|  12.5k|    }
  712|  4.56M|    size_ = need;
  713|  4.56M|  }
  714|  5.69M|}
_ZN5Exiv25MemIoC2Ev:
  716|  27.4k|MemIo::MemIo() : p_(std::make_unique<Impl>()) {
  717|  27.4k|}
_ZN5Exiv25MemIoC2EPKhm:
  719|  33.1k|MemIo::MemIo(const byte* data, size_t size) : p_(std::make_unique<Impl>(data, size)) {
  720|  33.1k|}
_ZN5Exiv25MemIoD2Ev:
  722|  60.5k|MemIo::~MemIo() {
  723|  60.5k|  if (p_->isMalloced_) {
  ------------------
  |  Branch (723:7): [True: 19.6k, False: 40.8k]
  ------------------
  724|  19.6k|    std::free(p_->data_);
  725|  19.6k|  }
  726|  60.5k|}
_ZN5Exiv25MemIo5writeEPKhm:
  728|  5.66M|size_t MemIo::write(const byte* data, size_t wcount) {
  729|  5.66M|  p_->reserve(wcount);
  730|  5.66M|  if (data) {
  ------------------
  |  Branch (730:7): [True: 4.53M, False: 1.13M]
  ------------------
  731|  4.53M|    std::memcpy(&p_->data_[p_->idx_], data, wcount);
  732|  4.53M|  }
  733|  5.66M|  p_->idx_ += wcount;
  734|  5.66M|  return wcount;
  735|  5.66M|}
_ZN5Exiv25MemIo8transferERNS_7BasicIoE:
  737|  13.4k|void MemIo::transfer(BasicIo& src) {
  738|  13.4k|  if (auto memIo = dynamic_cast<MemIo*>(&src)) {
  ------------------
  |  Branch (738:12): [True: 13.4k, False: 0]
  ------------------
  739|       |    // Optimization if src is another instance of MemIo
  740|  13.4k|    if (p_->isMalloced_) {
  ------------------
  |  Branch (740:9): [True: 314, False: 13.1k]
  ------------------
  741|    314|      std::free(p_->data_);
  742|    314|    }
  743|  13.4k|    p_->idx_ = 0;
  744|  13.4k|    p_->data_ = memIo->p_->data_;
  745|  13.4k|    p_->size_ = memIo->p_->size_;
  746|  13.4k|    p_->isMalloced_ = memIo->p_->isMalloced_;
  747|  13.4k|    memIo->p_->idx_ = 0;
  748|  13.4k|    memIo->p_->data_ = nullptr;
  749|  13.4k|    memIo->p_->size_ = 0;
  750|  13.4k|    memIo->p_->isMalloced_ = false;
  751|  13.4k|  } else {
  752|       |    // Generic reopen to reset position to start
  753|      0|    if (src.open() != 0) {
  ------------------
  |  Branch (753:9): [True: 0, False: 0]
  ------------------
  754|      0|      throw Error(ErrorCode::kerDataSourceOpenFailed, src.path(), strError());
  755|      0|    }
  756|      0|    p_->idx_ = 0;
  757|      0|    write(src);
  758|      0|    src.close();
  759|      0|  }
  760|  13.4k|  if (error() || src.error())
  ------------------
  |  Branch (760:7): [True: 0, False: 13.4k]
  |  Branch (760:18): [True: 0, False: 13.4k]
  ------------------
  761|      0|    throw Error(ErrorCode::kerMemoryTransferFailed, strError());
  762|  13.4k|}
_ZN5Exiv25MemIo4putbEh:
  782|  26.1k|int MemIo::putb(byte data) {
  783|  26.1k|  p_->reserve(1);
  784|  26.1k|  p_->data_[p_->idx_++] = data;
  785|  26.1k|  return data;
  786|  26.1k|}
_ZN5Exiv25MemIo4seekElNS_7BasicIo8PositionE:
  788|   951k|int MemIo::seek(int64_t offset, Position pos) {
  789|   951k|  int64_t newIdx = 0;
  790|       |
  791|   951k|  switch (pos) {
  ------------------
  |  Branch (791:11): [True: 951k, False: 0]
  ------------------
  792|   667k|    case BasicIo::cur:
  ------------------
  |  Branch (792:5): [True: 667k, False: 283k]
  ------------------
  793|   667k|      newIdx = p_->idx_ + offset;
  794|   667k|      break;
  795|   283k|    case BasicIo::beg:
  ------------------
  |  Branch (795:5): [True: 283k, False: 667k]
  ------------------
  796|   283k|      newIdx = offset;
  797|   283k|      break;
  798|    123|    case BasicIo::end:
  ------------------
  |  Branch (798:5): [True: 123, False: 951k]
  ------------------
  799|    123|      newIdx = p_->size_ + offset;
  800|    123|      break;
  801|   951k|  }
  802|       |
  803|   951k|  if (newIdx < 0)
  ------------------
  |  Branch (803:7): [True: 0, False: 951k]
  ------------------
  804|      0|    return 1;
  805|       |
  806|   951k|  if (newIdx > static_cast<int64_t>(p_->size_)) {
  ------------------
  |  Branch (806:7): [True: 5.41k, False: 945k]
  ------------------
  807|  5.41k|    p_->eof_ = true;
  808|  5.41k|    return 1;
  809|  5.41k|  }
  810|       |
  811|   945k|  p_->idx_ = static_cast<size_t>(newIdx);
  812|   945k|  p_->eof_ = false;
  813|   945k|  return 0;
  814|   951k|}
_ZN5Exiv25MemIo4mmapEb:
  816|  52.8k|byte* MemIo::mmap(bool /*isWriteable*/) {
  817|  52.8k|  return p_->data_;
  818|  52.8k|}
_ZNK5Exiv25MemIo4tellEv:
  824|   661k|size_t MemIo::tell() const {
  825|   661k|  return p_->idx_;
  826|   661k|}
_ZNK5Exiv25MemIo4sizeEv:
  828|   430k|size_t MemIo::size() const {
  829|   430k|  return p_->size_;
  830|   430k|}
_ZN5Exiv25MemIo4openEv:
  832|   127k|int MemIo::open() {
  833|   127k|  p_->idx_ = 0;
  834|   127k|  p_->eof_ = false;
  835|   127k|  return 0;
  836|   127k|}
_ZNK5Exiv25MemIo6isopenEv:
  838|  99.3k|bool MemIo::isopen() const {
  839|  99.3k|  return true;
  840|  99.3k|}
_ZN5Exiv25MemIo5closeEv:
  842|  97.4k|int MemIo::close() {
  843|  97.4k|  return 0;
  844|  97.4k|}
_ZN5Exiv25MemIo4readEm:
  846|   139k|DataBuf MemIo::read(size_t rcount) {
  847|   139k|  DataBuf buf(rcount);
  848|   139k|  size_t readCount = read(buf.data(), buf.size());
  849|   139k|  buf.resize(readCount);
  850|   139k|  return buf;
  851|   139k|}
_ZN5Exiv25MemIo4readEPhm:
  853|  4.41M|size_t MemIo::read(byte* buf, size_t rcount) {
  854|  4.41M|  const auto avail = std::max<size_t>(p_->size_ - p_->idx_, 0);
  855|  4.41M|  const auto allow = std::min<size_t>(rcount, avail);
  856|  4.41M|  if (allow > 0) {
  ------------------
  |  Branch (856:7): [True: 4.28M, False: 138k]
  ------------------
  857|  4.28M|    std::memcpy(buf, &p_->data_[p_->idx_], allow);
  858|  4.28M|  }
  859|  4.41M|  p_->idx_ += allow;
  860|  4.41M|  if (rcount > avail) {
  ------------------
  |  Branch (860:7): [True: 13.2k, False: 4.40M]
  ------------------
  861|  13.2k|    p_->eof_ = true;
  862|  13.2k|  }
  863|  4.41M|  return allow;
  864|  4.41M|}
_ZN5Exiv25MemIo4getbEv:
  866|  11.9M|int MemIo::getb() {
  867|  11.9M|  if (p_->idx_ >= p_->size_) {
  ------------------
  |  Branch (867:7): [True: 930, False: 11.8M]
  ------------------
  868|    930|    p_->eof_ = true;
  869|    930|    return EOF;
  870|    930|  }
  871|  11.8M|  return p_->data_[p_->idx_++];
  872|  11.9M|}
_ZNK5Exiv25MemIo5errorEv:
  874|  5.23M|int MemIo::error() const {
  875|  5.23M|  return 0;
  876|  5.23M|}
_ZNK5Exiv25MemIo3eofEv:
  878|   826k|bool MemIo::eof() const {
  879|   826k|  return p_->eof_;
  880|   826k|}
_ZNK5Exiv25MemIo4pathEv:
  882|  10.7k|const std::string& MemIo::path() const noexcept {
  883|  10.7k|  static std::string _path{"MemIo"};
  884|  10.7k|  return _path;
  885|  10.7k|}
_ZN5Exiv25MemIo16populateFakeDataEv:
  887|    221|void MemIo::populateFakeData() {
  888|    221|}
_ZN5Exiv25MemIo4ImplC2Ev:
  607|  27.4k|  Impl() = default;                     //!< Default constructor

_ZN5Exiv29BmffImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   87|  2.06k|    Image(ImageType::bmff, mdExif | mdIptc | mdXmp, std::move(io), params) {
   88|  2.06k|}  // BmffImage::BmffImage
_ZN5Exiv29BmffImage7fullBoxEj:
  109|  43.8k|bool BmffImage::fullBox(uint32_t box) {
  110|  43.8k|  return box == TAG::meta || box == TAG::iinf || box == TAG::iloc || box == TAG::thmb || box == TAG::prvw;
  ------------------
  |  Branch (110:10): [True: 1.42k, False: 42.4k]
  |  Branch (110:30): [True: 321, False: 42.1k]
  |  Branch (110:50): [True: 2.05k, False: 40.0k]
  |  Branch (110:70): [True: 8.69k, False: 31.3k]
  |  Branch (110:90): [True: 233, False: 31.1k]
  ------------------
  111|  43.8k|}
_ZNK5Exiv29BmffImage10pixelWidthEv:
  151|    170|uint32_t BmffImage::pixelWidth() const {
  152|    170|  auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
  153|    170|  if (imageWidth == exifData_.end() || imageWidth->count() == 0)
  ------------------
  |  Branch (153:7): [True: 167, False: 3]
  |  Branch (153:7): [True: 169, False: 1]
  |  Branch (153:40): [True: 2, False: 1]
  ------------------
  154|    169|    return pixelWidth_;
  155|      1|  return imageWidth->toUint32();
  156|    170|}
_ZNK5Exiv29BmffImage11pixelHeightEv:
  158|    170|uint32_t BmffImage::pixelHeight() const {
  159|    170|  auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
  160|    170|  if (imageHeight == exifData_.end() || imageHeight->count() == 0)
  ------------------
  |  Branch (160:7): [True: 164, False: 6]
  |  Branch (160:7): [True: 167, False: 3]
  |  Branch (160:41): [True: 3, False: 3]
  ------------------
  161|    167|    return pixelHeight_;
  162|      3|  return imageHeight->toUint32();
  163|    170|}
_ZN5Exiv29BmffImage8uuidNameERKNS_7DataBufE:
  165|    805|std::string BmffImage::uuidName(const Exiv2::DataBuf& uuid) {
  166|    805|  const char* uuidCano = "\x85\xC0\xB6\x87\x82\xF\x11\xE0\x81\x11\xF4\xCE\x46\x2B\x6A\x48";
  167|    805|  const char* uuidXmp = "\xBE\x7A\xCF\xCB\x97\xA9\x42\xE8\x9C\x71\x99\x94\x91\xE3\xAF\xAC";
  168|    805|  const char* uuidCanp = "\xEA\xF4\x2B\x5E\x1C\x98\x4B\x88\xB9\xFB\xB7\xDC\x40\x6E\x4D\x16";
  169|    805|  if (uuid.cmpBytes(0, uuidCano, 16) == 0)
  ------------------
  |  Branch (169:7): [True: 34, False: 771]
  ------------------
  170|     34|    return "cano";
  171|    771|  if (uuid.cmpBytes(0, uuidXmp, 16) == 0)
  ------------------
  |  Branch (171:7): [True: 95, False: 676]
  ------------------
  172|     95|    return "xmp";
  173|    676|  if (uuid.cmpBytes(0, uuidCanp, 16) == 0)
  ------------------
  |  Branch (173:7): [True: 577, False: 99]
  ------------------
  174|    577|    return "canp";
  175|     99|  return "";
  176|    676|}
_ZN5Exiv29BmffImage16brotliUncompressEPKhmRNS_7DataBufE:
  184|    122|void BmffImage::brotliUncompress(const byte* compressedBuf, size_t compressedBufSize, DataBuf& arr) {
  185|    122|  auto decoder = BrotliDecoder(BrotliDecoderCreateInstance(nullptr, nullptr, nullptr), BrotliDecoderDestroyInstance);
  186|    122|  size_t uncompressedLen = compressedBufSize * 2;  // just a starting point
  187|    122|  BrotliDecoderResult result = BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
  188|    122|  int dos = 0;
  189|    122|  size_t available_in = compressedBufSize;
  190|    122|  const byte* next_in = compressedBuf;
  191|    122|  size_t available_out;
  192|    122|  byte* next_out;
  193|    122|  size_t total_out = 0;
  194|       |
  195|    418|  while (result != BROTLI_DECODER_RESULT_SUCCESS) {
  ------------------
  |  Branch (195:10): [True: 354, False: 64]
  ------------------
  196|    354|    arr.alloc(uncompressedLen);
  197|    354|    available_out = uncompressedLen - total_out;
  198|    354|    next_out = arr.data() + total_out;
  199|    354|    result =
  200|    354|        BrotliDecoderDecompressStream(decoder.get(), &available_in, &next_in, &available_out, &next_out, &total_out);
  201|    354|    if (result == BROTLI_DECODER_RESULT_SUCCESS) {
  ------------------
  |  Branch (201:9): [True: 64, False: 290]
  ------------------
  202|     64|      arr.resize(total_out);
  203|    290|    } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
  ------------------
  |  Branch (203:16): [True: 258, False: 32]
  ------------------
  204|    258|      uncompressedLen *= 2;
  205|       |      // DoS protection - can't be bigger than 128k
  206|    258|      if (uncompressedLen > 131072) {
  ------------------
  |  Branch (206:11): [True: 58, False: 200]
  ------------------
  207|     58|        if (++dos > 1 || total_out > 131072)
  ------------------
  |  Branch (207:13): [True: 25, False: 33]
  |  Branch (207:26): [True: 1, False: 32]
  ------------------
  208|     26|          break;
  209|     32|        uncompressedLen = 131072;
  210|     32|      }
  211|    258|    } else if (result == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT) {
  ------------------
  |  Branch (211:16): [True: 11, False: 21]
  ------------------
  212|       |      // compressed input buffer in incomplete
  213|     11|      throw Error(ErrorCode::kerFailedToReadImageData);
  214|     21|    } else {
  215|       |      // something bad happened
  216|     21|      throw Error(ErrorCode::kerErrorMessage, BrotliDecoderErrorString(BrotliDecoderGetErrorCode(decoder.get())));
  217|     21|    }
  218|    354|  }
  219|       |
  220|     90|  if (result != BROTLI_DECODER_RESULT_SUCCESS) {
  ------------------
  |  Branch (220:7): [True: 26, False: 64]
  ------------------
  221|     26|    throw Error(ErrorCode::kerFailedToReadImageData);
  222|     26|  }
  223|     90|}
_ZN5Exiv29BmffImage10boxHandlerERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEENS_20PrintStructureOptionEmm:
  227|  44.7k|                               uint64_t pbox_end, size_t depth) {
  228|  44.7k|  const size_t address = io_->tell();
  229|       |  // never visit a box twice!
  230|  44.7k|  if (depth == 0)
  ------------------
  |  Branch (230:7): [True: 28.0k, False: 16.7k]
  ------------------
  231|  28.0k|    visits_.clear();
  232|  44.7k|  if (visits_.contains(address) || visits_.size() > visits_max_ || depth >= max_recursion_depth_) {
  ------------------
  |  Branch (232:7): [True: 0, False: 44.7k]
  |  Branch (232:36): [True: 50, False: 44.7k]
  |  Branch (232:68): [True: 1, False: 44.7k]
  ------------------
  233|     51|    throw Error(ErrorCode::kerCorruptedMetadata);
  234|     51|  }
  235|  44.7k|  visits_.insert(address);
  236|       |
  237|       |#ifdef EXIV2_DEBUG_MESSAGES
  238|       |  bool bTrace = true;
  239|       |#else
  240|  44.7k|  bool bTrace = option == kpsBasic || option == kpsRecursive;
  ------------------
  |  Branch (240:17): [True: 0, False: 44.7k]
  |  Branch (240:39): [True: 0, False: 44.7k]
  ------------------
  241|  44.7k|#endif
  242|       |
  243|       |  // 8-byte buffer for parsing the box length and type.
  244|  44.7k|  byte hdrbuf[2 * sizeof(uint32_t)];
  245|       |
  246|  44.7k|  size_t hdrsize = sizeof(hdrbuf);
  247|  44.7k|  Internal::enforce(hdrsize <= static_cast<size_t>(pbox_end - address), Exiv2::ErrorCode::kerCorruptedMetadata);
  248|  44.7k|  if (io_->read(hdrbuf, sizeof(hdrbuf)) != sizeof(hdrbuf))
  ------------------
  |  Branch (248:7): [True: 0, False: 44.7k]
  ------------------
  249|      0|    return pbox_end;
  250|       |
  251|       |  // The box length is encoded as a uint32_t by default, but the special value 1 means
  252|       |  // that it's a uint64_t.
  253|  44.7k|  uint64_t box_length = getULong(&hdrbuf[0], endian_);
  254|  44.7k|  uint32_t box_type = getULong(&hdrbuf[sizeof(uint32_t)], endian_);
  255|  44.7k|  bool bLF = true;
  256|       |
  257|  44.7k|  if (bTrace) {
  ------------------
  |  Branch (257:7): [True: 0, False: 44.7k]
  ------------------
  258|      0|    bLF = true;
  259|      0|    out << Internal::indent(depth) << "Exiv2::BmffImage::boxHandler: " << toAscii(box_type)
  260|      0|        << stringFormat(" {:8}->{} ", address, box_length);
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  261|      0|  }
  262|       |
  263|  44.7k|  if (box_length == 1) {
  ------------------
  |  Branch (263:7): [True: 170, False: 44.5k]
  ------------------
  264|       |    // The box size is encoded as a uint64_t, so we need to read another 8 bytes.
  265|    170|    hdrsize += 8;
  266|    170|    Internal::enforce(hdrsize <= static_cast<size_t>(pbox_end - address), Exiv2::ErrorCode::kerCorruptedMetadata);
  267|    170|    DataBuf data(8);
  268|    170|    io_->read(data.data(), data.size());
  269|    170|    box_length = data.read_uint64(0, endian_);
  270|    170|  }
  271|       |
  272|  44.7k|  if (box_length == 0) {
  ------------------
  |  Branch (272:7): [True: 15.1k, False: 29.5k]
  ------------------
  273|       |    // Zero length is also valid and indicates box extends to the end of file.
  274|  15.1k|    box_length = pbox_end - address;
  275|  15.1k|  }
  276|       |
  277|       |  // read data in box and restore file position
  278|  44.7k|  const size_t restore = io_->tell();
  279|  44.7k|  Internal::enforce(box_length >= hdrsize, Exiv2::ErrorCode::kerCorruptedMetadata);
  280|  44.7k|  Internal::enforce(box_length - hdrsize <= pbox_end - restore, Exiv2::ErrorCode::kerCorruptedMetadata);
  281|       |
  282|  44.7k|  const auto buffer_size = box_length - hdrsize;
  283|  44.7k|  if (skipBox(box_type)) {
  ------------------
  |  Branch (283:7): [True: 258, False: 44.4k]
  ------------------
  284|    258|    if (bTrace) {
  ------------------
  |  Branch (284:9): [True: 0, False: 258]
  ------------------
  285|      0|      out << '\n';
  286|      0|    }
  287|       |    // The enforce() above checks that restore + buffer_size won't
  288|       |    // exceed pbox_end, and by implication, won't exceed LONG_MAX
  289|    258|    return restore + buffer_size;
  290|    258|  }
  291|       |
  292|  44.4k|  DataBuf data(static_cast<size_t>(buffer_size));
  293|  44.4k|  const size_t box_end = restore + data.size();
  294|  44.4k|  io_->read(data.data(), data.size());
  295|  44.4k|  io_->seek(restore, BasicIo::beg);
  296|       |
  297|  44.4k|  size_t skip = 0;  // read position in data.pData_
  298|  44.4k|  uint8_t version = 0;
  299|  44.4k|  uint32_t flags = 0;
  300|       |
  301|  44.4k|  if (fullBox(box_type)) {
  ------------------
  |  Branch (301:7): [True: 12.7k, False: 31.7k]
  ------------------
  302|  12.7k|    Internal::enforce(data.size() - skip >= 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  303|  12.7k|    flags = data.read_uint32(skip, endian_);  // version/flags
  304|  12.7k|    version = static_cast<uint8_t>(flags >> 24);
  305|  12.7k|    flags &= 0x00ffffff;
  306|  12.7k|    skip += 4;
  307|  12.7k|  }
  308|       |
  309|  44.4k|  switch (box_type) {
  310|       |    //  See notes in skipBox()
  311|  3.81k|    case TAG::ftyp: {
  ------------------
  |  Branch (311:5): [True: 3.81k, False: 40.6k]
  ------------------
  312|  3.81k|      Internal::enforce(data.size() >= 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  313|  3.81k|      fileType_ = data.read_uint32(0, endian_);
  314|  3.81k|      if (bTrace) {
  ------------------
  |  Branch (314:11): [True: 0, False: 3.81k]
  ------------------
  315|      0|        out << "brand: " << toAscii(fileType_);
  316|      0|      }
  317|  3.81k|    } break;
  318|       |
  319|       |    // 8.11.6.1
  320|    319|    case TAG::iinf: {
  ------------------
  |  Branch (320:5): [True: 319, False: 44.1k]
  ------------------
  321|    319|      if (bTrace) {
  ------------------
  |  Branch (321:11): [True: 0, False: 319]
  ------------------
  322|      0|        out << '\n';
  323|      0|        bLF = false;
  324|      0|      }
  325|       |
  326|    319|      Internal::enforce(data.size() - skip >= 2, Exiv2::ErrorCode::kerCorruptedMetadata);
  327|    319|      uint16_t n = data.read_uint16(skip, endian_);
  328|    319|      skip += 2;
  329|       |
  330|    319|      io_->seek(skip, BasicIo::cur);
  331|    960|      while (n-- > 0) {
  ------------------
  |  Branch (331:14): [True: 641, False: 319]
  ------------------
  332|    641|        io_->seek(boxHandler(out, option, box_end, depth + 1), BasicIo::beg);
  333|    641|      }
  334|    319|    } break;
  335|       |
  336|       |    // 8.11.6.2
  337|    718|    case TAG::infe: {  // .__._.__hvc1_ 2 0 0 1 0 1 0 0 104 118 99 49 0
  ------------------
  |  Branch (337:5): [True: 718, False: 43.7k]
  ------------------
  338|    718|      Internal::enforce(data.size() - skip >= 8, Exiv2::ErrorCode::kerCorruptedMetadata);
  339|    718|      /* getULong (data.pData_+skip,endian_) ; */ skip += 4;
  340|    718|      uint16_t ID = data.read_uint16(skip, endian_);
  341|    718|      skip += 2;
  342|    718|      /* getShort(data.pData_+skip,endian_) ; */ skip += 2;  // protection
  343|    718|      std::string id;
  344|       |      // Check that the string has a '\0' terminator.
  345|    718|      const char* str = data.c_str(skip);
  346|    718|      const size_t maxlen = data.size() - skip;
  347|    718|      Internal::enforce(maxlen > 0 && strnlen(str, maxlen) < maxlen, Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (347:25): [True: 710, False: 8]
  |  Branch (347:39): [True: 698, False: 12]
  ------------------
  348|    718|      std::string name(str);
  349|    718|      if (Internal::contains(name, "Exif")) {  // "Exif" or "ExifExif"
  ------------------
  |  Branch (349:11): [True: 259, False: 459]
  ------------------
  350|    259|        exifID_ = ID;
  351|    259|        id = " *** Exif ***";
  352|    459|      } else if (Internal::contains(name, "mime\0xmp") || Internal::contains(name, "mime\0application/rdf+xml")) {
  ------------------
  |  Branch (352:18): [True: 239, False: 220]
  |  Branch (352:59): [True: 0, False: 220]
  ------------------
  353|    219|        xmpID_ = ID;
  354|    219|        id = " *** XMP ***";
  355|    219|      }
  356|    718|      if (bTrace) {
  ------------------
  |  Branch (356:11): [True: 0, False: 718]
  ------------------
  357|      0|        out << stringFormat("ID = {:3} {} {}", ID, name, id);
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  358|      0|      }
  359|    718|    } break;
  360|       |
  361|     31|    case TAG::moov:
  ------------------
  |  Branch (361:5): [True: 31, False: 44.4k]
  ------------------
  362|     87|    case TAG::iprp:
  ------------------
  |  Branch (362:5): [True: 56, False: 44.4k]
  ------------------
  363|  12.1k|    case TAG::ipco:
  ------------------
  |  Branch (363:5): [True: 12.0k, False: 32.3k]
  ------------------
  364|  13.5k|    case TAG::meta: {
  ------------------
  |  Branch (364:5): [True: 1.41k, False: 43.0k]
  ------------------
  365|  13.5k|      if (bTrace) {
  ------------------
  |  Branch (365:11): [True: 0, False: 13.5k]
  ------------------
  366|      0|        out << '\n';
  367|      0|        bLF = false;
  368|      0|      }
  369|  13.5k|      io_->seek(skip, BasicIo::cur);
  370|  29.0k|      while (io_->tell() < box_end) {
  ------------------
  |  Branch (370:14): [True: 15.4k, False: 13.5k]
  ------------------
  371|  15.4k|        io_->seek(boxHandler(out, option, box_end, depth + 1), BasicIo::beg);
  372|  15.4k|      }
  373|       |      // post-process meta box to recover Exif and XMP
  374|  13.5k|      if (box_type == TAG::meta) {
  ------------------
  |  Branch (374:11): [True: 620, False: 12.9k]
  ------------------
  375|    620|        auto ilo = ilocs_.find(exifID_);
  376|    620|        if (ilo != ilocs_.end()) {
  ------------------
  |  Branch (376:13): [True: 66, False: 554]
  ------------------
  377|     66|          const Iloc& iloc = ilo->second;
  378|     66|          if (bTrace) {
  ------------------
  |  Branch (378:15): [True: 0, False: 66]
  ------------------
  379|      0|            out << Internal::indent(depth) << "Exiv2::BMFF Exif: " << iloc.toString() << '\n';
  380|      0|          }
  381|     66|          parseTiff(Internal::Tag::root, iloc.length_, iloc.start_);
  382|     66|        }
  383|    620|        ilo = ilocs_.find(xmpID_);
  384|    620|        if (ilo != ilocs_.end()) {
  ------------------
  |  Branch (384:13): [True: 86, False: 534]
  ------------------
  385|     86|          const Iloc& iloc = ilo->second;
  386|     86|          if (bTrace) {
  ------------------
  |  Branch (386:15): [True: 0, False: 86]
  ------------------
  387|      0|            out << Internal::indent(depth) << "Exiv2::BMFF XMP: " << iloc.toString() << '\n';
  388|      0|          }
  389|     86|          parseXmp(iloc.length_, iloc.start_);
  390|     86|        }
  391|    620|        ilocs_.clear();
  392|    620|      }
  393|  13.5k|    } break;
  394|       |
  395|       |    // 8.11.3.1
  396|  2.05k|    case TAG::iloc: {
  ------------------
  |  Branch (396:5): [True: 2.05k, False: 42.4k]
  ------------------
  397|  2.05k|      Internal::enforce(data.size() - skip >= 2, Exiv2::ErrorCode::kerCorruptedMetadata);
  398|  2.05k|      uint8_t u = data.read_uint8(skip++);
  399|  2.05k|      uint16_t offsetSize = u >> 4;
  400|  2.05k|      uint16_t lengthSize = u & 0xF;
  401|       |#if 0
  402|       |                uint16_t indexSize  = 0       ;
  403|       |                u             = data.read_uint8(skip++);
  404|       |                if ( version == 1 || version == 2 ) {
  405|       |                    indexSize = u & 0xF ;
  406|       |                }
  407|       |#else
  408|  2.05k|      skip++;
  409|  2.05k|#endif
  410|  2.05k|      Internal::enforce(data.size() - skip >= (version < 2u ? 2u : 4u), Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (410:48): [True: 1.94k, False: 109]
  ------------------
  411|  2.05k|      uint32_t itemCount = version < 2 ? data.read_uint16(skip, endian_) : data.read_uint32(skip, endian_);
  ------------------
  |  Branch (411:28): [True: 1.94k, False: 109]
  ------------------
  412|  2.05k|      skip += version < 2 ? 2 : 4;
  ------------------
  |  Branch (412:15): [True: 1.94k, False: 109]
  ------------------
  413|  2.05k|      if (itemCount && itemCount < box_length / 14 && offsetSize == 4 && lengthSize == 4 &&
  ------------------
  |  Branch (413:11): [True: 1.63k, False: 415]
  |  Branch (413:24): [True: 1.13k, False: 502]
  |  Branch (413:55): [True: 1.11k, False: 15]
  |  Branch (413:74): [True: 714, False: 404]
  ------------------
  414|    714|          ((box_length - 16) % itemCount) == 0) {
  ------------------
  |  Branch (414:11): [True: 635, False: 79]
  ------------------
  415|    635|        if (bTrace) {
  ------------------
  |  Branch (415:13): [True: 0, False: 635]
  ------------------
  416|      0|          out << '\n';
  417|      0|          bLF = false;
  418|      0|        }
  419|    635|        auto step = (static_cast<size_t>(box_length) - 16) / itemCount;  // length of data per item.
  420|    635|        size_t base = skip;
  421|  6.46k|        for (uint32_t i = 0; i < itemCount; i++) {
  ------------------
  |  Branch (421:30): [True: 5.82k, False: 635]
  ------------------
  422|  5.82k|          skip = base + (i * step);  // move in 14, 16 or 18 byte steps
  423|  5.82k|          Internal::enforce(data.size() - skip >= (version > 2u ? 4u : 2u), Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (423:52): [True: 177, False: 5.65k]
  ------------------
  424|  5.82k|          Internal::enforce(data.size() - skip >= step, Exiv2::ErrorCode::kerCorruptedMetadata);
  425|  5.82k|          uint32_t ID = version > 2 ? data.read_uint32(skip, endian_) : data.read_uint16(skip, endian_);
  ------------------
  |  Branch (425:25): [True: 149, False: 5.68k]
  ------------------
  426|  5.82k|          auto offset = [&data, skip, step] {
  427|  5.82k|            if (step == 14 || step == 16)
  428|  5.82k|              return data.read_uint32(skip + step - 8, endian_);
  429|  5.82k|            if (step == 18)
  430|  5.82k|              return data.read_uint32(skip + 4, endian_);
  431|  5.82k|            return 0u;
  432|  5.82k|          }();
  433|       |
  434|  5.82k|          uint32_t ldata = data.read_uint32(skip + step - 4, endian_);
  435|  5.82k|          if (bTrace) {
  ------------------
  |  Branch (435:15): [True: 0, False: 5.82k]
  ------------------
  436|      0|            out << Internal::indent(depth)
  437|      0|                << stringFormat("{:8} | {:8} |   ID | {:4} | {:6},{:6}\n", address + skip, step, ID, offset, ldata);
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  438|      0|          }
  439|       |          // save data for post-processing in meta box
  440|  5.82k|          if (offset && ldata && ID != unknownID_) {
  ------------------
  |  Branch (440:15): [True: 5.02k, False: 807]
  |  Branch (440:25): [True: 4.41k, False: 606]
  |  Branch (440:34): [True: 3.99k, False: 425]
  ------------------
  441|  3.99k|            ilocs_[ID] = Iloc{ID, offset, ldata};
  442|  3.99k|          }
  443|  5.82k|        }
  444|    635|      }
  445|  2.05k|    } break;
  446|       |
  447|    505|    case TAG::ispe: {
  ------------------
  |  Branch (447:5): [True: 505, False: 43.9k]
  ------------------
  448|    505|      Internal::enforce(data.size() - skip >= 12, Exiv2::ErrorCode::kerCorruptedMetadata);
  449|    505|      skip += 4;
  450|    505|      uint32_t width = data.read_uint32(skip, endian_);
  451|    505|      skip += 4;
  452|    505|      uint32_t height = data.read_uint32(skip, endian_);
  453|    505|      skip += 4;
  454|    505|      if (bTrace) {
  ------------------
  |  Branch (454:11): [True: 0, False: 505]
  ------------------
  455|      0|        out << stringFormat("pixelWidth_, pixelHeight_ = {}, {}", width, height);
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  456|      0|      }
  457|       |      // HEIC files can have multiple ispe records
  458|       |      // Store largest width/height
  459|    505|      if (width > pixelWidth_ && height > pixelHeight_) {
  ------------------
  |  Branch (459:11): [True: 267, False: 238]
  |  Branch (459:34): [True: 50, False: 217]
  ------------------
  460|     50|        pixelWidth_ = width;
  461|     50|        pixelHeight_ = height;
  462|     50|      }
  463|    505|    } break;
  464|       |
  465|       |    // 12.1.5.2
  466|    828|    case TAG::colr: {
  ------------------
  |  Branch (466:5): [True: 828, False: 43.6k]
  ------------------
  467|    828|      if (data.size() >= (skip + 4 + 8)) {  // .____.HLino..__mntrR 2 0 0 0 0 12 72 76 105 110 111 2 16 ...
  ------------------
  |  Branch (467:11): [True: 757, False: 71]
  ------------------
  468|       |        // https://www.ics.uci.edu/~dan/class/267/papers/jpeg2000.pdf
  469|    757|        uint8_t meth = data.read_uint8(skip + 0);
  470|    757|        uint8_t prec = data.read_uint8(skip + 1);
  471|    757|        uint8_t approx = data.read_uint8(skip + 2);
  472|    757|        auto colour_type = std::string(data.c_str(), 4);
  473|    757|        skip += 4;
  474|    757|        if (colour_type == "rICC" || colour_type == "prof") {
  ------------------
  |  Branch (474:13): [True: 249, False: 508]
  |  Branch (474:38): [True: 44, False: 464]
  ------------------
  475|    293|          DataBuf profile(data.c_data(skip), data.size() - skip);
  476|    293|          setIccProfile(std::move(profile));
  477|    464|        } else if (meth == 2 && prec == 0 && approx == 0) {
  ------------------
  |  Branch (477:20): [True: 30, False: 434]
  |  Branch (477:33): [True: 19, False: 11]
  |  Branch (477:46): [True: 14, False: 5]
  ------------------
  478|       |          // JP2000 files have a 3 byte head // 2 0 0 icc......
  479|     14|          skip -= 1;
  480|     14|          DataBuf profile(data.c_data(skip), data.size() - skip);
  481|     14|          setIccProfile(std::move(profile));
  482|     14|        }
  483|    757|      }
  484|    828|    } break;
  485|       |
  486|    805|    case TAG::uuid: {
  ------------------
  |  Branch (486:5): [True: 805, False: 43.6k]
  ------------------
  487|    805|      DataBuf uuid(16);
  488|    805|      io_->read(uuid.data(), uuid.size());
  489|    805|      std::string name = uuidName(uuid);
  490|    805|      if (bTrace) {
  ------------------
  |  Branch (490:11): [True: 0, False: 805]
  ------------------
  491|      0|        out << " uuidName " << name << '\n';
  492|      0|        bLF = false;
  493|      0|      }
  494|    805|      if (name == "cano" || name == "canp") {
  ------------------
  |  Branch (494:11): [True: 34, False: 771]
  |  Branch (494:29): [True: 577, False: 194]
  ------------------
  495|    611|        if (name == "canp") {
  ------------------
  |  Branch (495:13): [True: 577, False: 34]
  ------------------
  496|       |          // based on
  497|       |          // https://github.com/lclevy/canon_cr3/blob/7be75d6/parse_cr3.py#L271
  498|    577|          io_->seek(8, BasicIo::cur);
  499|    577|        }
  500|  1.25k|        while (io_->tell() < box_end) {
  ------------------
  |  Branch (500:16): [True: 639, False: 611]
  ------------------
  501|    639|          io_->seek(boxHandler(out, option, box_end, depth + 1), BasicIo::beg);
  502|    639|        }
  503|    611|      } else if (name == "xmp") {
  ------------------
  |  Branch (503:18): [True: 95, False: 99]
  ------------------
  504|     95|        parseXmp(box_length, io_->tell());
  505|     95|      }
  506|    805|    } break;
  507|       |
  508|    306|    case TAG::cmt1:
  ------------------
  |  Branch (508:5): [True: 306, False: 44.1k]
  ------------------
  509|    306|      parseTiff(Internal::Tag::root, box_length);
  510|    306|      break;
  511|  1.49k|    case TAG::cmt2:
  ------------------
  |  Branch (511:5): [True: 1.49k, False: 42.9k]
  ------------------
  512|  1.49k|      parseTiff(Internal::Tag::cmt2, box_length);
  513|  1.49k|      break;
  514|    467|    case TAG::cmt3:
  ------------------
  |  Branch (514:5): [True: 467, False: 43.9k]
  ------------------
  515|    467|      parseTiff(Internal::Tag::cmt3, box_length);
  516|    467|      break;
  517|    627|    case TAG::cmt4:
  ------------------
  |  Branch (517:5): [True: 627, False: 43.8k]
  ------------------
  518|    627|      parseTiff(Internal::Tag::cmt4, box_length);
  519|    627|      break;
  520|  4.78k|    case TAG::exif:
  ------------------
  |  Branch (520:5): [True: 4.78k, False: 39.6k]
  ------------------
  521|  4.78k|      parseTiff(Internal::Tag::root, buffer_size, io_->tell());
  522|  4.78k|      break;
  523|    131|    case TAG::xml:
  ------------------
  |  Branch (523:5): [True: 131, False: 44.3k]
  ------------------
  524|    131|      parseXmp(buffer_size, io_->tell());
  525|    131|      break;
  526|    123|    case TAG::brob: {
  ------------------
  |  Branch (526:5): [True: 123, False: 44.3k]
  ------------------
  527|    123|      Internal::enforce(data.size() >= 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  528|    123|      uint32_t realType = data.read_uint32(0, endian_);
  529|    123|      if (bTrace) {
  ------------------
  |  Branch (529:11): [True: 0, False: 123]
  ------------------
  530|      0|        out << "type: " << toAscii(realType);
  531|      0|      }
  532|    123|#ifdef EXV_HAVE_BROTLI
  533|    123|      DataBuf arr;
  534|    123|      brotliUncompress(data.c_data(4), data.size() - 4, arr);
  535|    123|      const DecodeParams dp(max_recursion_depth_);
  536|    123|      if (realType == TAG::exif) {
  ------------------
  |  Branch (536:11): [True: 0, False: 123]
  ------------------
  537|      0|        uint32_t offset = Safe::add(arr.read_uint32(0, endian_), 4u);
  538|      0|        Internal::enforce(Safe::add(offset, 4u) < arr.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  539|      0|        Internal::TiffParserWorker::decode(exifData(), iptcData(), xmpData(), arr.c_data(offset), arr.size() - offset,
  540|      0|                                           Internal::Tag::root, Internal::TiffMapping::findDecoder, dp);
  541|    123|      } else if (realType == TAG::xml) {
  ------------------
  |  Branch (541:18): [True: 20, False: 103]
  ------------------
  542|     20|        try {
  543|     20|          Exiv2::XmpParser::decode(xmpData(), std::string(arr.c_str(), arr.size()), dp);
  544|     20|        } catch (...) {
  545|      0|          throw Error(ErrorCode::kerFailedToReadImageData);
  546|      0|        }
  547|     20|      }
  548|    123|#endif
  549|    123|    } break;
  550|  8.69k|    case TAG::thmb:
  ------------------
  |  Branch (550:5): [True: 8.69k, False: 35.7k]
  ------------------
  551|  8.69k|      switch (version) {
  552|     27|        case 0:  // JPEG
  ------------------
  |  Branch (552:9): [True: 27, False: 8.67k]
  ------------------
  553|     27|          parseCr3Preview(data, out, bTrace, version, skip, skip + 2, skip + 4, skip + 12);
  554|     27|          break;
  555|  8.65k|        case 1:  // HDR
  ------------------
  |  Branch (555:9): [True: 8.65k, False: 46]
  ------------------
  556|  8.65k|          parseCr3Preview(data, out, bTrace, version, skip + 2, skip + 4, skip + 8, skip + 12);
  557|  8.65k|          break;
  558|     19|        default:
  ------------------
  |  Branch (558:9): [True: 19, False: 8.67k]
  ------------------
  559|     19|          break;
  560|  8.69k|      }
  561|  8.69k|      break;
  562|  8.69k|    case TAG::prvw:
  ------------------
  |  Branch (562:5): [True: 233, False: 44.2k]
  ------------------
  563|    233|      switch (version) {
  564|    195|        case 0:  // JPEG
  ------------------
  |  Branch (564:9): [True: 195, False: 38]
  ------------------
  565|    196|        case 1:  // HDR
  ------------------
  |  Branch (565:9): [True: 1, False: 232]
  ------------------
  566|    196|          parseCr3Preview(data, out, bTrace, version, skip + 2, skip + 4, skip + 8, skip + 12);
  567|    196|          break;
  568|     37|        default:
  ------------------
  |  Branch (568:9): [True: 37, False: 196]
  ------------------
  569|     37|          break;
  570|    233|      }
  571|    233|      break;
  572|       |
  573|  4.37k|    default:
  ------------------
  |  Branch (573:5): [True: 4.37k, False: 40.0k]
  ------------------
  574|  4.37k|      break; /* do nothing */
  575|  44.4k|  }
  576|  31.5k|  if (bLF && bTrace)
  ------------------
  |  Branch (576:7): [True: 31.5k, False: 0]
  |  Branch (576:14): [True: 0, False: 31.5k]
  ------------------
  577|      0|    out << '\n';
  578|       |
  579|       |  // return address of next box
  580|  31.5k|  return box_end;
  581|  44.4k|}
_ZN5Exiv29BmffImage9parseTiffEjmm:
  583|  4.84k|void BmffImage::parseTiff(uint32_t root_tag, uint64_t length, uint64_t start) {
  584|  4.84k|  Internal::enforce(start <= io_->size(), ErrorCode::kerCorruptedMetadata);
  585|  4.84k|  Internal::enforce(length <= io_->size() - start, ErrorCode::kerCorruptedMetadata);
  586|  4.84k|  Internal::enforce(start <= static_cast<uint64_t>(std::numeric_limits<int64_t>::max()),
  587|  4.84k|                    ErrorCode::kerCorruptedMetadata);
  588|  4.84k|  Internal::enforce(length <= std::numeric_limits<size_t>::max(), ErrorCode::kerCorruptedMetadata);
  589|       |
  590|       |  // read and parse exif data
  591|  4.84k|  const size_t restore = io_->tell();
  592|  4.84k|  DataBuf exif(static_cast<size_t>(length));
  593|  4.84k|  io_->seek(static_cast<int64_t>(start), BasicIo::beg);
  594|  4.84k|  if (exif.size() > 8 && io_->read(exif.data(), exif.size()) == exif.size()) {
  ------------------
  |  Branch (594:7): [True: 1.20k, False: 3.64k]
  |  Branch (594:26): [True: 1.20k, False: 0]
  ------------------
  595|       |    // hunt for "II" or "MM"
  596|  1.20k|    const size_t eof = std::numeric_limits<size_t>::max();  // impossible value for punt
  597|  1.20k|    size_t punt = eof;
  598|   386k|    for (size_t i = 0; i < exif.size() - 9 && punt == eof; ++i) {
  ------------------
  |  Branch (598:24): [True: 385k, False: 373]
  |  Branch (598:47): [True: 384k, False: 833]
  ------------------
  599|   384k|      auto charCurrent = exif.read_uint8(i);
  600|   384k|      auto charNext = exif.read_uint8(i + 1);
  601|   384k|      if (charCurrent == charNext && (charCurrent == 'I' || charCurrent == 'M'))
  ------------------
  |  Branch (601:11): [True: 153k, False: 231k]
  |  Branch (601:39): [True: 54, False: 153k]
  |  Branch (601:61): [True: 862, False: 152k]
  ------------------
  602|    916|        punt = i;
  603|   384k|    }
  604|  1.20k|    if (punt != eof) {
  ------------------
  |  Branch (604:9): [True: 916, False: 290]
  ------------------
  605|    916|      const DecodeParams dp(max_recursion_depth_);
  606|    916|      Internal::TiffParserWorker::decode(exifData(), iptcData(), xmpData(), exif.c_data(punt), exif.size() - punt,
  607|    916|                                         root_tag, Internal::TiffMapping::findDecoder, dp);
  608|    916|    }
  609|  1.20k|  }
  610|  4.84k|  io_->seek(restore, BasicIo::beg);
  611|  4.84k|}
_ZN5Exiv29BmffImage9parseTiffEjm:
  613|  2.89k|void BmffImage::parseTiff(uint32_t root_tag, uint64_t length) {
  614|  2.89k|  if (length > 8) {
  ------------------
  |  Branch (614:7): [True: 346, False: 2.54k]
  ------------------
  615|    346|    Internal::enforce(length - 8 <= io_->size() - io_->tell(), ErrorCode::kerCorruptedMetadata);
  616|    346|    Internal::enforce(length - 8 <= std::numeric_limits<size_t>::max(), ErrorCode::kerCorruptedMetadata);
  617|    346|    DataBuf data(static_cast<size_t>(length - 8u));
  618|    346|    const size_t bufRead = io_->read(data.data(), data.size());
  619|       |
  620|    346|    if (io_->error())
  ------------------
  |  Branch (620:9): [True: 0, False: 346]
  ------------------
  621|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  622|    346|    if (bufRead != data.size())
  ------------------
  |  Branch (622:9): [True: 0, False: 346]
  ------------------
  623|      0|      throw Error(ErrorCode::kerInputDataReadFailed);
  624|       |
  625|    346|    const DecodeParams dp(max_recursion_depth_);
  626|    346|    Internal::TiffParserWorker::decode(exifData(), iptcData(), xmpData(), data.c_data(), data.size(), root_tag,
  627|    346|                                       Internal::TiffMapping::findDecoder, dp);
  628|    346|  }
  629|  2.89k|}
_ZN5Exiv29BmffImage8parseXmpEmm:
  631|    312|void BmffImage::parseXmp(uint64_t length, uint64_t start) {
  632|    312|  Internal::enforce(start <= io_->size(), ErrorCode::kerCorruptedMetadata);
  633|    312|  Internal::enforce(length <= io_->size() - start, ErrorCode::kerCorruptedMetadata);
  634|       |
  635|    312|  const size_t restore = io_->tell();
  636|    312|  io_->seek(static_cast<int64_t>(start), BasicIo::beg);
  637|       |
  638|    312|  auto lengthSizeT = static_cast<size_t>(length);
  639|    312|  DataBuf xmp(lengthSizeT + 1);
  640|    312|  xmp.write_uint8(lengthSizeT, 0);  // ensure xmp is null terminated!
  641|    312|  if (io_->read(xmp.data(), lengthSizeT) != lengthSizeT)
  ------------------
  |  Branch (641:7): [True: 0, False: 312]
  ------------------
  642|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  643|    312|  if (io_->error())
  ------------------
  |  Branch (643:7): [True: 0, False: 312]
  ------------------
  644|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  645|    312|  try {
  646|    312|    const DecodeParams dp(max_recursion_depth_);
  647|    312|    Exiv2::XmpParser::decode(xmpData(), std::string(xmp.c_str()), dp);
  648|    312|  } catch (...) {
  649|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  650|      0|  }
  651|       |
  652|    281|  io_->seek(restore, BasicIo::beg);
  653|    281|}
_ZN5Exiv29BmffImage15parseCr3PreviewERKNS_7DataBufERNSt3__113basic_ostreamIcNS4_11char_traitsIcEEEEbhmmmm:
  658|  8.87k|                                size_t relative_position) {
  659|       |  // Derived from https://github.com/lclevy/canon_cr3
  660|  8.87k|  const size_t here = io_->tell();
  661|  8.87k|  Internal::enforce(here <= std::numeric_limits<size_t>::max() - relative_position, ErrorCode::kerCorruptedMetadata);
  662|  8.87k|  NativePreview nativePreview;
  663|  8.87k|  nativePreview.position_ = here + relative_position;
  664|  8.87k|  nativePreview.width_ = data.read_uint16(width_offset, endian_);
  665|  8.87k|  nativePreview.height_ = data.read_uint16(height_offset, endian_);
  666|  8.87k|  nativePreview.size_ = data.read_uint32(size_offset, endian_);
  667|  8.87k|  nativePreview.filter_ = "";
  668|  8.87k|  nativePreview.mimeType_ = [version] {
  669|  8.87k|    if (version == 0)
  670|  8.87k|      return "image/jpeg";
  671|  8.87k|    return "application/octet-stream";
  672|  8.87k|  }();
  673|  8.87k|  if (bTrace) {
  ------------------
  |  Branch (673:7): [True: 0, False: 8.87k]
  ------------------
  674|      0|    out << stringFormat("width,height,size = {},{},{}", nativePreview.width_, nativePreview.height_,
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  675|      0|                        nativePreview.size_);
  676|      0|  }
  677|  8.87k|  nativePreviews_.push_back(std::move(nativePreview));
  678|  8.87k|}
_ZNK5Exiv29BmffImage11openOrThrowEv:
  697|  2.06k|void BmffImage::openOrThrow() const {
  698|  2.06k|  if (io_->open() != 0) {
  ------------------
  |  Branch (698:7): [True: 0, False: 2.06k]
  ------------------
  699|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  700|      0|  }
  701|       |  // Ensure that this is the correct image type
  702|  2.06k|  if (!isBmffType(*io_, false)) {
  ------------------
  |  Branch (702:7): [True: 0, False: 2.06k]
  ------------------
  703|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (703:9): [True: 0, False: 0]
  |  Branch (703:25): [True: 0, False: 0]
  ------------------
  704|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  705|      0|    throw Error(ErrorCode::kerNotAnImage, "BMFF");
  706|      0|  }
  707|  2.06k|}
_ZN5Exiv29BmffImage12readMetadataEv:
  709|  2.06k|void BmffImage::readMetadata() {
  710|  2.06k|  openOrThrow();
  711|  2.06k|  IoCloser closer(*io_);
  712|       |
  713|  2.06k|  clearMetadata();
  714|  2.06k|  ilocs_.clear();
  715|  2.06k|  visits_max_ = io_->size() / 16;
  716|  2.06k|  unknownID_ = 0xffff;
  717|  2.06k|  exifID_ = unknownID_;
  718|  2.06k|  xmpID_ = unknownID_;
  719|       |
  720|  2.06k|  uint64_t address = 0;
  721|  2.06k|  const auto file_end = io_->size();
  722|  30.0k|  while (address < file_end) {
  ------------------
  |  Branch (722:10): [True: 28.0k, False: 2.06k]
  ------------------
  723|  28.0k|    io_->seek(address, BasicIo::beg);
  724|  28.0k|    address = boxHandler(std::cout, kpsNone, file_end, 0);
  725|  28.0k|  }
  726|  2.06k|  bReadMetadata_ = true;
  727|  2.06k|}  // BmffImage::readMetadata
_ZN5Exiv29BmffImage13writeMetadataEv:
  765|    783|void BmffImage::writeMetadata() {
  766|       |  // bmff files are read-only
  767|    783|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "BMFF"));
  768|    783|}  // BmffImage::writeMetadata
_ZN5Exiv215newBmffInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  772|  2.06k|Image::UniquePtr newBmffInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  773|  2.06k|  auto image = std::make_unique<BmffImage>(std::move(io), params);
  774|  2.06k|  if (!image->good()) {
  ------------------
  |  Branch (774:7): [True: 0, False: 2.06k]
  ------------------
  775|      0|    return nullptr;
  776|      0|  }
  777|  2.06k|  return image;
  778|  2.06k|}
_ZN5Exiv210isBmffTypeERNS_7BasicIoEb:
  780|  7.14k|bool isBmffType(BasicIo& iIo, bool advance) {
  781|  7.14k|  const int32_t len = 12;
  782|  7.14k|  byte buf[len];
  783|  7.14k|  iIo.read(buf, len);
  784|  7.14k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (784:7): [True: 0, False: 7.14k]
  |  Branch (784:22): [True: 245, False: 6.90k]
  ------------------
  785|    245|    return false;
  786|    245|  }
  787|       |
  788|       |  // bmff should start with "ftyp"
  789|  6.90k|  bool const is_ftyp = (buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p');
  ------------------
  |  Branch (789:25): [True: 6.25k, False: 646]
  |  Branch (789:42): [True: 6.22k, False: 34]
  |  Branch (789:59): [True: 6.19k, False: 24]
  |  Branch (789:76): [True: 6.19k, False: 1]
  ------------------
  790|       |  // jxl files have a special start indicator of "JXL "
  791|  6.90k|  bool const is_jxl = (buf[4] == 'J' && buf[5] == 'X' && buf[6] == 'L' && buf[7] == ' ');
  ------------------
  |  Branch (791:24): [True: 79, False: 6.82k]
  |  Branch (791:41): [True: 40, False: 39]
  |  Branch (791:58): [True: 16, False: 24]
  |  Branch (791:75): [True: 12, False: 4]
  ------------------
  792|       |
  793|  6.90k|  bool matched = is_jxl || is_ftyp;
  ------------------
  |  Branch (793:18): [True: 12, False: 6.88k]
  |  Branch (793:28): [True: 6.19k, False: 693]
  ------------------
  794|  6.90k|  if (!advance || !matched) {
  ------------------
  |  Branch (794:7): [True: 6.90k, False: 0]
  |  Branch (794:19): [True: 0, False: 0]
  ------------------
  795|  6.90k|    iIo.seek(0, BasicIo::beg);
  796|  6.90k|  }
  797|  6.90k|  return matched;
  798|  7.14k|}
bmffimage.cpp:_ZN5Exiv2L7skipBoxEj:
  113|  44.1k|static bool skipBox(uint32_t box) {
  114|       |  // Allows boxHandler() to optimise the reading of files by identifying
  115|       |  // box types that we're not interested in. Box types listed here must
  116|       |  // not appear in the cases in switch (box_type) in boxHandler().
  117|  44.1k|  return box == 0 || box == TAG::mdat;  // mdat is where the main image lives and can be huge
  ------------------
  |  Branch (117:10): [True: 82, False: 44.0k]
  |  Branch (117:22): [True: 176, False: 43.8k]
  ------------------
  118|  44.1k|}
bmffimage.cpp:_ZZN5Exiv29BmffImage10boxHandlerERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEENS_20PrintStructureOptionEmmENK3$_0clEv:
  426|  5.80k|          auto offset = [&data, skip, step] {
  427|  5.80k|            if (step == 14 || step == 16)
  ------------------
  |  Branch (427:17): [True: 3.74k, False: 2.05k]
  |  Branch (427:31): [True: 866, False: 1.18k]
  ------------------
  428|  4.61k|              return data.read_uint32(skip + step - 8, endian_);
  429|  1.18k|            if (step == 18)
  ------------------
  |  Branch (429:17): [True: 795, False: 391]
  ------------------
  430|    795|              return data.read_uint32(skip + 4, endian_);
  431|    391|            return 0u;
  432|  1.18k|          }();
bmffimage.cpp:_ZZN5Exiv29BmffImage15parseCr3PreviewERKNS_7DataBufERNSt3__113basic_ostreamIcNS4_11char_traitsIcEEEEbhmmmmENK3$_0clEv:
  668|  8.87k|  nativePreview.mimeType_ = [version] {
  669|  8.87k|    if (version == 0)
  ------------------
  |  Branch (669:9): [True: 220, False: 8.65k]
  ------------------
  670|    220|      return "image/jpeg";
  671|  8.65k|    return "application/octet-stream";
  672|  8.87k|  }();

_ZN5Exiv28BmpImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   27|     57|    Image(ImageType::bmp, mdNone, std::move(io), params) {
   28|     57|}
_ZN5Exiv28BmpImage12readMetadataEv:
   47|     56|void BmpImage::readMetadata() {
   48|       |#ifdef EXIV2_DEBUG_MESSAGES
   49|       |  std::cerr << "Exiv2::BmpImage::readMetadata: Reading Windows bitmap file " << io_->path() << "\n";
   50|       |#endif
   51|     56|  if (io_->open() != 0) {
  ------------------
  |  Branch (51:7): [True: 0, False: 56]
  ------------------
   52|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   53|      0|  }
   54|     56|  IoCloser closer(*io_);
   55|       |
   56|       |  // Ensure that this is the correct image type
   57|     56|  if (!isBmpType(*io_, false)) {
  ------------------
  |  Branch (57:7): [True: 0, False: 56]
  ------------------
   58|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (58:9): [True: 0, False: 0]
  |  Branch (58:25): [True: 0, False: 0]
  ------------------
   59|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   60|      0|    throw Error(ErrorCode::kerNotAnImage, "BMP");
   61|      0|  }
   62|     56|  clearMetadata();
   63|       |
   64|       |  /*
   65|       |    The Windows bitmap header goes as follows -- all numbers are in little-endian byte order:
   66|       |
   67|       |    offset  length   name                   description
   68|       |    ======  =======  =====================  =======
   69|       |     0      2 bytes  signature              always 'BM'
   70|       |     2      4 bytes  bitmap size
   71|       |     6      4 bytes  reserved
   72|       |    10      4 bytes  bitmap offset
   73|       |    14      4 bytes  header size
   74|       |    18      4 bytes  bitmap width
   75|       |    22      4 bytes  bitmap height
   76|       |    26      2 bytes  plane count
   77|       |    28      2 bytes  depth
   78|       |    30      4 bytes  compression            0 = none; 1 = RLE, 8 bits/pixel; 2 = RLE, 4 bits/pixel; 3 = bitfield;
   79|       |    4 = JPEG; 5 = PNG 34      4 bytes  image size             size of the raw bitmap data, in bytes 38      4
   80|       |    bytes  horizontal resolution  (in pixels per meter) 42      4 bytes  vertical resolution    (in pixels per
   81|       |    meter) 46      4 bytes  color count 50      4 bytes  important colors       number of "important" colors
   82|       |
   83|       |    The layout above describes the BITMAPINFOHEADER (and later) variants, identified by a header size
   84|       |    of 40 bytes or more. The older OS/2 1.x / Windows 2.x format uses the shorter, 12-byte
   85|       |    BITMAPCOREHEADER instead, in which the width and height fields are only 2 bytes wide:
   86|       |
   87|       |    offset  length   name                   description
   88|       |    ======  =======  =====================  =======
   89|       |    14      4 bytes  header size            always 12 for BITMAPCOREHEADER
   90|       |    18      2 bytes  bitmap width
   91|       |    20      2 bytes  bitmap height
   92|       |    22      2 bytes  plane count
   93|       |    24      2 bytes  depth
   94|       |  */
   95|     56|  byte buf[26];
   96|     56|  if (io_->read(buf, sizeof(buf)) == sizeof(buf)) {
  ------------------
  |  Branch (96:7): [True: 56, False: 0]
  ------------------
   97|     56|    const uint32_t headerSize = getULong(buf + 14, littleEndian);
   98|     56|    if (headerSize == 12) {
  ------------------
  |  Branch (98:9): [True: 3, False: 53]
  ------------------
   99|       |      // OS/2 1.x / Windows 2.x BITMAPCOREHEADER: width and height are 16-bit fields.
  100|      3|      pixelWidth_ = getUShort(buf + 18, littleEndian);
  101|      3|      pixelHeight_ = getUShort(buf + 20, littleEndian);
  102|     53|    } else {
  103|     53|      pixelWidth_ = getULong(buf + 18, littleEndian);
  104|     53|      pixelHeight_ = getULong(buf + 22, littleEndian);
  105|     53|    }
  106|     56|  }
  107|     56|}
_ZN5Exiv28BmpImage13writeMetadataEv:
  109|      3|void BmpImage::writeMetadata() {
  110|       |  /// \todo implement me!
  111|      3|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "BMP"));
  112|      3|}
_ZN5Exiv214newBmpInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  116|     57|Image::UniquePtr newBmpInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  117|     57|  auto image = std::make_unique<BmpImage>(std::move(io), params);
  118|     57|  if (!image->good()) {
  ------------------
  |  Branch (118:7): [True: 1, False: 56]
  ------------------
  119|      1|    return nullptr;
  120|      1|  }
  121|     56|  return image;
  122|     57|}
_ZN5Exiv29isBmpTypeERNS_7BasicIoEb:
  124|  10.8k|bool isBmpType(BasicIo& iIo, bool advance) {
  125|  10.8k|  const int32_t len = 2;
  126|  10.8k|  const std::array<byte, len> BmpImageId{'B', 'M'};
  127|  10.8k|  std::array<byte, len> buf;
  128|  10.8k|  iIo.read(buf.data(), len);
  129|  10.8k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (129:7): [True: 0, False: 10.8k]
  |  Branch (129:22): [True: 245, False: 10.6k]
  ------------------
  130|    245|    return false;
  131|    245|  }
  132|  10.6k|  bool matched = buf == BmpImageId;
  133|  10.6k|  if (!advance || !matched) {
  ------------------
  |  Branch (133:7): [True: 10.6k, False: 0]
  |  Branch (133:19): [True: 0, False: 0]
  ------------------
  134|  10.6k|    iIo.seek(-len, BasicIo::cur);
  135|  10.6k|  }
  136|  10.6k|  return matched;
  137|  10.8k|}

_ZN5Exiv28Internal7canonEvEl:
 3063|    392|float canonEv(int64_t val) {
 3064|       |  // temporarily remove sign
 3065|    392|  int sign = 1;
 3066|    392|  if (val < 0) {
  ------------------
  |  Branch (3066:7): [True: 0, False: 392]
  ------------------
 3067|      0|    sign = -1;
 3068|      0|    val = -val;
 3069|      0|  }
 3070|       |  // remove fraction
 3071|    392|  const auto remainder = val & 0x1f;
 3072|    392|  val -= remainder;
 3073|    392|  auto frac = static_cast<float>(remainder);
 3074|       |  // convert 1/3 (0x0c) and 2/3 (0x14) codes
 3075|    392|  if (frac == 0x0c) {
  ------------------
  |  Branch (3075:7): [True: 15, False: 377]
  ------------------
 3076|     15|    frac = 32.0F / 3;
 3077|    377|  } else if (frac == 0x14) {
  ------------------
  |  Branch (3077:14): [True: 43, False: 334]
  ------------------
 3078|     43|    frac = 64.0F / 3;
 3079|    334|  } else if ((val == 160) && (frac == 0x08)) {  // for Sigma f/6.3 lenses that report f/6.2 to camera
  ------------------
  |  Branch (3079:14): [True: 11, False: 323]
  |  Branch (3079:30): [True: 0, False: 11]
  ------------------
 3080|      0|    frac = 30.0F / 3;
 3081|      0|  }
 3082|    392|  return sign * (val + frac) / 32.0F;
 3083|    392|}

_ZN5Exiv28Internal14CanonMakerNote7tagListEv:
   38|   143k|  static constexpr auto tagList() {
   39|   143k|    return tagInfo_;
   40|   143k|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListCsEv:
   42|  1.83k|  static constexpr auto tagListCs() {
   43|  1.83k|    return tagInfoCs_;
   44|  1.83k|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListSiEv:
   46|  3.38k|  static constexpr auto tagListSi() {
   47|  3.38k|    return tagInfoSi_;
   48|  3.38k|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListCfEv:
   54|    648|  static constexpr auto tagListCf() {
   55|    648|    return tagInfoCf_;
   56|    648|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListPiEv:
   58|    593|  static constexpr auto tagListPi() {
   59|    593|    return tagInfoPi_;
   60|    593|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListTiEv:
   62|    837|  static constexpr auto tagListTi() {
   63|    837|    return tagInfoTi_;
   64|    837|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListFiEv:
   66|    543|  static constexpr auto tagListFi() {
   67|    543|    return tagInfoFi_;
   68|    543|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListPaEv:
   50|  1.35k|  static constexpr auto tagListPa() {
   51|  1.35k|    return tagInfoPa_;
   52|  1.35k|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListPrEv:
   70|    958|  static constexpr auto tagListPr() {
   71|    958|    return tagInfoPr_;
   72|    958|  }
_ZN5Exiv28Internal14CanonMakerNote14tagListVigCor2Ev:
  134|    231|  static constexpr auto tagListVigCor2() {
  135|    231|    return tagInfoVigCor2_;
  136|    231|  }
_ZN5Exiv28Internal14CanonMakerNote11tagListLiOpEv:
  138|    874|  static constexpr auto tagListLiOp() {
  139|    874|    return tagInfoLiOp_;
  140|    874|  }
_ZN5Exiv28Internal14CanonMakerNote14tagListAfMiAdjEv:
  126|    426|  static constexpr auto tagListAfMiAdj() {
  127|    426|    return tagInfoAfMiAdj_;
  128|    426|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListLeEv:
  142|    239|  static constexpr auto tagListLe() {
  143|    239|    return tagInfoLe_;
  144|    239|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListAmEv:
  146|    233|  static constexpr auto tagListAm() {
  147|    233|    return tagInfoAm_;
  148|    233|  }
_ZN5Exiv28Internal14CanonMakerNote10tagListFilEv:
  154|    165|  static constexpr auto tagListFil() {
  155|    165|    return tagInfoFil_;
  156|    165|  }
_ZN5Exiv28Internal14CanonMakerNote9tagListMeEv:
  150|    169|  static constexpr auto tagListMe() {
  151|    169|    return tagInfoMe_;
  152|    169|  }
_ZN5Exiv28Internal14CanonMakerNote10tagListHdrEv:
  158|    389|  static constexpr auto tagListHdr() {
  159|    389|    return tagInfoHdr_;
  160|    389|  }
_ZN5Exiv28Internal14CanonMakerNote10tagListAfCEv:
  162|    464|  static constexpr auto tagListAfC() {
  163|    464|    return tagInfoAfC_;
  164|    464|  }
_ZN5Exiv28Internal14CanonMakerNote11tagListRawBEv:
  166|    100|  static constexpr auto tagListRawB() {
  167|    100|    return tagInfoRawB_;
  168|    100|  }

_ZN5Exiv28Internal14CasioMakerNote7tagListEv:
   34|    149|  static constexpr auto tagList() {
   35|    149|    return tagInfo_;
   36|    149|  }
_ZN5Exiv28Internal15Casio2MakerNote7tagListEv:
   52|  12.9k|  static constexpr auto tagList() {
   53|  12.9k|    return tagInfo_;
   54|  12.9k|  }

_ZN5Exiv29ConverterC2ERNS_8ExifDataERNS_7XmpDataE:
  495|  3.17k|    exifData_(&exifData), iptcData_(nullptr), xmpData_(&xmpData), iptcCharset_(nullptr) {
  496|  3.17k|}
_ZN5Exiv29ConverterC2ERNS_8IptcDataERNS_7XmpDataEPKc:
  499|  3.13k|    exifData_(nullptr), iptcData_(&iptcData), xmpData_(&xmpData), iptcCharset_(iptcCharset) {
  500|  3.13k|}
_ZN5Exiv29Converter8cnvToXmpEv:
  502|  3.01k|void Converter::cnvToXmp() {
  503|   375k|  for (auto&& c : conversion_) {
  ------------------
  |  Branch (503:17): [True: 375k, False: 3.01k]
  ------------------
  504|   375k|    if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
  ------------------
  |  Branch (504:10): [True: 310k, False: 65.2k]
  |  Branch (504:37): [True: 155k, False: 154k]
  |  Branch (504:52): [True: 65.2k, False: 154k]
  |  Branch (504:79): [True: 32.5k, False: 32.6k]
  ------------------
  505|   188k|      std::invoke(c.key1ToKey2_, *this, c.key1_, c.key2_);
  506|   188k|    }
  507|   375k|  }
  508|  3.01k|}
_ZN5Exiv29Converter10cnvFromXmpEv:
  510|  3.29k|void Converter::cnvFromXmp() {
  511|   415k|  for (auto&& c : conversion_) {
  ------------------
  |  Branch (511:17): [True: 415k, False: 3.29k]
  ------------------
  512|   415k|    if ((c.metadataId_ == mdExif && exifData_) || (c.metadataId_ == mdIptc && iptcData_)) {
  ------------------
  |  Branch (512:10): [True: 342k, False: 72.4k]
  |  Branch (512:37): [True: 171k, False: 171k]
  |  Branch (512:52): [True: 72.4k, False: 171k]
  |  Branch (512:79): [True: 36.2k, False: 36.2k]
  ------------------
  513|   207k|      std::invoke(c.key2ToKey1_, *this, c.key2_, c.key1_);
  514|   207k|    }
  515|   415k|  }
  516|  3.29k|}
_ZN5Exiv29Converter7cnvNoneEPKcS2_:
  518|  2.96k|void Converter::cnvNone(const char*, const char*) {
  519|  2.96k|}
_ZN5Exiv29Converter17prepareExifTargetEPKcb:
  521|  4.02k|bool Converter::prepareExifTarget(const char* to, bool force) {
  522|  4.02k|  auto pos = exifData_->findKey(ExifKey(to));
  523|  4.02k|  if (pos == exifData_->end())
  ------------------
  |  Branch (523:7): [True: 4.02k, False: 0]
  ------------------
  524|  4.02k|    return true;
  525|      0|  if (!overwrite_ && !force)
  ------------------
  |  Branch (525:7): [True: 0, False: 0]
  |  Branch (525:22): [True: 0, False: 0]
  ------------------
  526|      0|    return false;
  527|      0|  exifData_->erase(pos);
  528|      0|  return true;
  529|      0|}
_ZN5Exiv29Converter17prepareIptcTargetEPKcb:
  531|    827|bool Converter::prepareIptcTarget(const char* to, bool force) {
  532|    827|  auto pos = iptcData_->findKey(IptcKey(to));
  533|    827|  if (pos == iptcData_->end())
  ------------------
  |  Branch (533:7): [True: 827, False: 0]
  ------------------
  534|    827|    return true;
  535|      0|  if (!overwrite_ && !force)
  ------------------
  |  Branch (535:7): [True: 0, False: 0]
  |  Branch (535:22): [True: 0, False: 0]
  ------------------
  536|      0|    return false;
  537|      0|  while ((pos = iptcData_->findKey(IptcKey(to))) != iptcData_->end()) {
  ------------------
  |  Branch (537:10): [True: 0, False: 0]
  ------------------
  538|      0|    iptcData_->erase(pos);
  539|      0|  }
  540|      0|  return true;
  541|      0|}
_ZN5Exiv29Converter16prepareXmpTargetEPKcb:
  543|    779|bool Converter::prepareXmpTarget(const char* to, bool force) {
  544|    779|  auto pos = xmpData_->findKey(XmpKey(to));
  545|    779|  if (pos == xmpData_->end())
  ------------------
  |  Branch (545:7): [True: 0, False: 779]
  ------------------
  546|      0|    return true;
  547|    779|  if (!overwrite_ && !force)
  ------------------
  |  Branch (547:7): [True: 0, False: 779]
  |  Branch (547:22): [True: 0, False: 0]
  ------------------
  548|      0|    return false;
  549|    779|  xmpData_->erase(pos);
  550|    779|  return true;
  551|    779|}
_ZN5Exiv29Converter12cnvExifValueEPKcS2_:
  553|   134k|void Converter::cnvExifValue(const char* from, const char* to) {
  554|   134k|  auto pos = exifData_->findKey(ExifKey(from));
  555|   134k|  if (pos == exifData_->end())
  ------------------
  |  Branch (555:7): [True: 134k, False: 329]
  ------------------
  556|   134k|    return;
  557|    329|  std::string value = pos->toString();
  558|    329|  if (!pos->value().ok()) {
  ------------------
  |  Branch (558:7): [True: 0, False: 329]
  ------------------
  559|      0|#ifndef SUPPRESS_WARNINGS
  560|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  561|      0|#endif
  562|      0|    return;
  563|      0|  }
  564|    329|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (564:7): [True: 0, False: 329]
  ------------------
  565|      0|    return;
  566|    329|  (*xmpData_)[to] = value;
  567|    329|  if (erase_)
  ------------------
  |  Branch (567:7): [True: 0, False: 329]
  ------------------
  568|      0|    exifData_->erase(pos);
  569|    329|}
_ZN5Exiv29Converter14cnvExifCommentEPKcS2_:
  571|  1.48k|void Converter::cnvExifComment(const char* from, const char* to) {
  572|  1.48k|  auto pos = exifData_->findKey(ExifKey(from));
  573|  1.48k|  if (pos == exifData_->end())
  ------------------
  |  Branch (573:7): [True: 1.48k, False: 0]
  ------------------
  574|  1.48k|    return;
  575|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (575:7): [True: 0, False: 0]
  ------------------
  576|      0|    return;
  577|      0|  const auto cv = dynamic_cast<const CommentValue*>(&pos->value());
  578|      0|  if (!cv) {
  ------------------
  |  Branch (578:7): [True: 0, False: 0]
  ------------------
  579|      0|#ifndef SUPPRESS_WARNINGS
  580|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  581|      0|#endif
  582|      0|    return;
  583|      0|  }
  584|       |  // Todo: Convert to UTF-8 if necessary
  585|      0|  try {
  586|      0|    (*xmpData_)[to] = cv->comment();
  587|      0|  } catch (const Error&) {
  588|      0|#ifndef SUPPRESS_WARNINGS
  589|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  590|      0|#endif
  591|      0|  }
  592|      0|  if (erase_)
  ------------------
  |  Branch (592:7): [True: 0, False: 0]
  ------------------
  593|      0|    exifData_->erase(pos);
  594|      0|}
_ZN5Exiv29Converter12cnvExifArrayEPKcS2_:
  596|  1.48k|void Converter::cnvExifArray(const char* from, const char* to) {
  597|  1.48k|  auto pos = exifData_->findKey(ExifKey(from));
  598|  1.48k|  if (pos == exifData_->end())
  ------------------
  |  Branch (598:7): [True: 1.48k, False: 0]
  ------------------
  599|  1.48k|    return;
  600|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (600:7): [True: 0, False: 0]
  ------------------
  601|      0|    return;
  602|      0|  for (size_t i = 0; i < pos->count(); ++i) {
  ------------------
  |  Branch (602:22): [True: 0, False: 0]
  ------------------
  603|      0|    std::string value = pos->toString(i);
  604|      0|    if (!pos->value().ok()) {
  ------------------
  |  Branch (604:9): [True: 0, False: 0]
  ------------------
  605|      0|#ifndef SUPPRESS_WARNINGS
  606|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  607|      0|#endif
  608|      0|      return;
  609|      0|    }
  610|      0|    (*xmpData_)[to] = value;
  611|      0|  }
  612|      0|  if (erase_)
  ------------------
  |  Branch (612:7): [True: 0, False: 0]
  ------------------
  613|      0|    exifData_->erase(pos);
  614|      0|}
_ZN5Exiv29Converter11cnvExifDateEPKcS2_:
  616|  5.98k|void Converter::cnvExifDate(const char* from, const char* to) {
  617|  5.98k|  auto pos = exifData_->findKey(ExifKey(from));
  618|  5.98k|  if (pos == exifData_->end())
  ------------------
  |  Branch (618:7): [True: 5.88k, False: 103]
  ------------------
  619|  5.88k|    return;
  620|    103|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (620:7): [True: 0, False: 103]
  ------------------
  621|      0|    return;
  622|    103|  int year = 0;
  623|    103|  int month = 0;
  624|    103|  int day = 0;
  625|    103|  int hour = 0;
  626|    103|  int min = 0;
  627|    103|  int sec = 0;
  628|    103|  std::string subsec;
  629|       |
  630|    103|  if (std::string(from) != "Exif.GPSInfo.GPSTimeStamp") {
  ------------------
  |  Branch (630:7): [True: 103, False: 0]
  ------------------
  631|    103|    std::string value = pos->toString();
  632|    103|    if (!pos->value().ok()) {
  ------------------
  |  Branch (632:9): [True: 0, False: 103]
  ------------------
  633|      0|#ifndef SUPPRESS_WARNINGS
  634|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  635|      0|#endif
  636|      0|      return;
  637|      0|    }
  638|    103|    if (sscanf(value.c_str(), "%d:%d:%d %d:%d:%d", &year, &month, &day, &hour, &min, &sec) != 6) {
  ------------------
  |  Branch (638:9): [True: 0, False: 103]
  ------------------
  639|      0|#ifndef SUPPRESS_WARNINGS
  640|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << ", unable to parse '" << value << "'\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  641|      0|#endif
  642|      0|      return;
  643|      0|    }
  644|    103|  } else {  // "Exif.GPSInfo.GPSTimeStamp"
  645|      0|    bool ok = true;
  646|      0|    if (pos->count() != 3)
  ------------------
  |  Branch (646:9): [True: 0, False: 0]
  ------------------
  647|      0|      ok = false;
  648|      0|    if (ok) {
  ------------------
  |  Branch (648:9): [True: 0, False: 0]
  ------------------
  649|      0|      for (int i = 0; i < 3; ++i) {
  ------------------
  |  Branch (649:23): [True: 0, False: 0]
  ------------------
  650|      0|        if (pos->toRational(i).second == 0) {
  ------------------
  |  Branch (650:13): [True: 0, False: 0]
  ------------------
  651|      0|          ok = false;
  652|      0|          break;
  653|      0|        }
  654|      0|      }
  655|      0|    }
  656|      0|    if (!ok) {
  ------------------
  |  Branch (656:9): [True: 0, False: 0]
  ------------------
  657|      0|#ifndef SUPPRESS_WARNINGS
  658|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  659|      0|#endif
  660|      0|      return;
  661|      0|    }
  662|       |
  663|      0|    double dhour = pos->toFloat(0);
  664|      0|    double dmin = pos->toFloat(1);
  665|       |    // Hack: Need Value::toDouble
  666|      0|    auto [r, s] = pos->toRational(2);
  667|      0|    double dsec = static_cast<double>(r) / s;
  668|       |
  669|      0|    if (!pos->value().ok()) {
  ------------------
  |  Branch (669:9): [True: 0, False: 0]
  ------------------
  670|      0|#ifndef SUPPRESS_WARNINGS
  671|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  672|      0|#endif
  673|      0|      return;
  674|      0|    }
  675|       |
  676|      0|    dsec += dhour * 3600.0;
  677|      0|    dsec += dmin * 60.0;
  678|       |
  679|      0|    hour = static_cast<int>(dsec / 3600.0);
  680|      0|    dsec -= hour * 3600;
  681|      0|    min = static_cast<int>(dsec / 60.0);
  682|      0|    dsec -= min * 60;
  683|      0|    sec = static_cast<int>(dsec);
  684|      0|    dsec -= sec;
  685|       |
  686|      0|    subsec = stringFormat(".{:09.0f}", dsec * 1'000'000'000);
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  687|       |
  688|      0|    auto datePos = exifData_->findKey(ExifKey("Exif.GPSInfo.GPSDateStamp"));
  689|      0|    if (datePos == exifData_->end()) {
  ------------------
  |  Branch (689:9): [True: 0, False: 0]
  ------------------
  690|      0|      datePos = exifData_->findKey(ExifKey("Exif.Photo.DateTimeOriginal"));
  691|      0|    }
  692|      0|    if (datePos == exifData_->end()) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      0|      datePos = exifData_->findKey(ExifKey("Exif.Photo.DateTimeDigitized"));
  694|      0|    }
  695|      0|    if (datePos == exifData_->end()) {
  ------------------
  |  Branch (695:9): [True: 0, False: 0]
  ------------------
  696|      0|#ifndef SUPPRESS_WARNINGS
  697|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  698|      0|#endif
  699|      0|      return;
  700|      0|    }
  701|      0|    std::string value = datePos->toString();
  702|      0|    if (sscanf(value.c_str(), "%d:%d:%d", &year, &month, &day) != 3) {
  ------------------
  |  Branch (702:9): [True: 0, False: 0]
  ------------------
  703|      0|#ifndef SUPPRESS_WARNINGS
  704|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << ", unable to parse '" << value << "'\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  705|      0|#endif
  706|      0|      return;
  707|      0|    }
  708|      0|  }
  709|       |
  710|    103|  const char* subsecTag = nullptr;
  711|    103|  if (std::string(from) == "Exif.Image.DateTime") {
  ------------------
  |  Branch (711:7): [True: 6, False: 97]
  ------------------
  712|      6|    subsecTag = "Exif.Photo.SubSecTime";
  713|     97|  } else if (std::string(from) == "Exif.Photo.DateTimeOriginal") {
  ------------------
  |  Branch (713:14): [True: 14, False: 83]
  ------------------
  714|     14|    subsecTag = "Exif.Photo.SubSecTimeOriginal";
  715|     83|  } else if (std::string(from) == "Exif.Photo.DateTimeDigitized") {
  ------------------
  |  Branch (715:14): [True: 83, False: 0]
  ------------------
  716|     83|    subsecTag = "Exif.Photo.SubSecTimeDigitized";
  717|     83|  }
  718|       |
  719|    103|  if (subsecTag) {
  ------------------
  |  Branch (719:7): [True: 103, False: 0]
  ------------------
  720|    103|    auto subsec_pos = exifData_->findKey(ExifKey(subsecTag));
  721|    103|    if (subsec_pos != exifData_->end()) {
  ------------------
  |  Branch (721:9): [True: 7, False: 96]
  ------------------
  722|      7|      if (subsec_pos->typeId() == asciiString) {
  ------------------
  |  Branch (722:11): [True: 7, False: 0]
  ------------------
  723|      7|        std::string ss = subsec_pos->toString();
  724|      7|        if (!ss.empty()) {
  ------------------
  |  Branch (724:13): [True: 7, False: 0]
  ------------------
  725|      7|          bool ok = false;
  726|      7|          stringTo<long>(ss, ok);
  727|      7|          if (ok)
  ------------------
  |  Branch (727:15): [True: 7, False: 0]
  ------------------
  728|      7|            subsec = std::string(".") + ss;
  729|      7|        }
  730|      7|      }
  731|      7|      if (erase_)
  ------------------
  |  Branch (731:11): [True: 0, False: 7]
  ------------------
  732|      0|        exifData_->erase(subsec_pos);
  733|      7|    }
  734|    103|  }
  735|       |
  736|    103|  if (subsec.size() > 10)
  ------------------
  |  Branch (736:7): [True: 0, False: 103]
  ------------------
  737|      0|    subsec.resize(10);
  738|       |
  739|    103|  (*xmpData_)[to] = stringFormat("{:4}-{:02}-{:02}T{:02}:{:02}:{:02}{}", year, month, day, hour, min, sec, subsec);
  ------------------
  |  |   18|    103|#define stringFormat std::format
  ------------------
  740|    103|  if (erase_)
  ------------------
  |  Branch (740:7): [True: 0, False: 103]
  ------------------
  741|      0|    exifData_->erase(pos);
  742|    103|}
_ZN5Exiv29Converter14cnvExifVersionEPKcS2_:
  744|  2.97k|void Converter::cnvExifVersion(const char* from, const char* to) {
  745|  2.97k|  auto pos = exifData_->findKey(ExifKey(from));
  746|  2.97k|  if (pos == exifData_->end())
  ------------------
  |  Branch (746:7): [True: 2.97k, False: 0]
  ------------------
  747|  2.97k|    return;
  748|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (748:7): [True: 0, False: 0]
  ------------------
  749|      0|    return;
  750|      0|  auto count = pos->count();
  751|      0|  std::string value;
  752|      0|  value.reserve(count);
  753|      0|  for (size_t i = 0; i < count; ++i) {
  ------------------
  |  Branch (753:22): [True: 0, False: 0]
  ------------------
  754|      0|    value.push_back(pos->toUint32(i));
  755|      0|  }
  756|      0|  (*xmpData_)[to] = value;
  757|      0|  if (erase_)
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|    exifData_->erase(pos);
  759|      0|}
_ZN5Exiv29Converter17cnvExifGPSVersionEPKcS2_:
  761|  1.48k|void Converter::cnvExifGPSVersion(const char* from, const char* to) {
  762|  1.48k|  auto pos = exifData_->findKey(ExifKey(from));
  763|  1.48k|  if (pos == exifData_->end())
  ------------------
  |  Branch (763:7): [True: 1.48k, False: 0]
  ------------------
  764|  1.48k|    return;
  765|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (765:7): [True: 0, False: 0]
  ------------------
  766|      0|    return;
  767|      0|  std::string value;
  768|      0|  for (size_t i = 0; i < pos->count(); ++i) {
  ------------------
  |  Branch (768:22): [True: 0, False: 0]
  ------------------
  769|      0|    if (i > 0)
  ------------------
  |  Branch (769:9): [True: 0, False: 0]
  ------------------
  770|      0|      value += '.';
  771|      0|    value += std::to_string(pos->toInt64(i));
  772|      0|  }
  773|      0|  (*xmpData_)[to] = value;
  774|      0|  if (erase_)
  ------------------
  |  Branch (774:7): [True: 0, False: 0]
  ------------------
  775|      0|    exifData_->erase(pos);
  776|      0|}
_ZN5Exiv29Converter12cnvExifFlashEPKcS2_:
  778|  1.48k|void Converter::cnvExifFlash(const char* from, const char* to) {
  779|  1.48k|  auto pos = exifData_->findKey(ExifKey(from));
  780|  1.48k|  if (pos == exifData_->end() || pos->count() == 0)
  ------------------
  |  Branch (780:7): [True: 1.48k, False: 0]
  |  Branch (780:7): [True: 1.48k, False: 0]
  |  Branch (780:34): [True: 0, False: 0]
  ------------------
  781|  1.48k|    return;
  782|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (782:7): [True: 0, False: 0]
  ------------------
  783|      0|    return;
  784|      0|  auto value = pos->toUint32();
  785|      0|  if (!pos->value().ok()) {
  ------------------
  |  Branch (785:7): [True: 0, False: 0]
  ------------------
  786|      0|#ifndef SUPPRESS_WARNINGS
  787|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  788|      0|#endif
  789|      0|    return;
  790|      0|  }
  791|       |
  792|      0|  (*xmpData_)["Xmp.exif.Flash/exif:Fired"] = static_cast<bool>(value & 1);
  793|      0|  (*xmpData_)["Xmp.exif.Flash/exif:Return"] = (value >> 1) & 3;
  794|      0|  (*xmpData_)["Xmp.exif.Flash/exif:Mode"] = (value >> 3) & 3;
  795|      0|  (*xmpData_)["Xmp.exif.Flash/exif:Function"] = static_cast<bool>((value >> 5) & 1);
  796|      0|  (*xmpData_)["Xmp.exif.Flash/exif:RedEyeMode"] = static_cast<bool>((value >> 6) & 1);
  797|       |
  798|      0|  if (erase_)
  ------------------
  |  Branch (798:7): [True: 0, False: 0]
  ------------------
  799|      0|    exifData_->erase(pos);
  800|      0|}
_ZN5Exiv29Converter15cnvExifGPSCoordEPKcS2_:
  802|  5.94k|void Converter::cnvExifGPSCoord(const char* from, const char* to) {
  803|  5.94k|  auto pos = exifData_->findKey(ExifKey(from));
  804|  5.94k|  if (pos == exifData_->end())
  ------------------
  |  Branch (804:7): [True: 5.94k, False: 0]
  ------------------
  805|  5.94k|    return;
  806|      0|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (806:7): [True: 0, False: 0]
  ------------------
  807|      0|    return;
  808|      0|  if (pos->count() != 3) {
  ------------------
  |  Branch (808:7): [True: 0, False: 0]
  ------------------
  809|      0|#ifndef SUPPRESS_WARNINGS
  810|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  811|      0|#endif
  812|      0|    return;
  813|      0|  }
  814|      0|  auto refPos = exifData_->findKey(ExifKey(std::string(from) + "Ref"));
  815|      0|  if (refPos == exifData_->end()) {
  ------------------
  |  Branch (815:7): [True: 0, False: 0]
  ------------------
  816|      0|#ifndef SUPPRESS_WARNINGS
  817|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  818|      0|#endif
  819|      0|    return;
  820|      0|  }
  821|      0|  double deg[3];
  822|      0|  for (int i = 0; i < 3; ++i) {
  ------------------
  |  Branch (822:19): [True: 0, False: 0]
  ------------------
  823|      0|    const auto [z, d] = pos->toRational(i);
  824|      0|    if (d == 0) {
  ------------------
  |  Branch (824:9): [True: 0, False: 0]
  ------------------
  825|      0|#ifndef SUPPRESS_WARNINGS
  826|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  827|      0|#endif
  828|      0|      return;
  829|      0|    }
  830|       |    // Hack: Need Value::toDouble
  831|      0|    deg[i] = static_cast<double>(z) / d;
  832|      0|  }
  833|      0|  double min = (deg[0] * 60.0) + deg[1] + (deg[2] / 60.0);
  834|      0|  auto ideg = static_cast<int>(min / 60.0);
  835|      0|  min -= ideg * 60;
  836|      0|  (*xmpData_)[to] = stringFormat("{},{:.7f}{}", ideg, min, refPos->toString().front());
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  837|       |
  838|      0|  if (erase_)
  ------------------
  |  Branch (838:7): [True: 0, False: 0]
  ------------------
  839|      0|    exifData_->erase(pos);
  840|      0|  if (erase_)
  ------------------
  |  Branch (840:7): [True: 0, False: 0]
  ------------------
  841|      0|    exifData_->erase(refPos);
  842|      0|}
_ZN5Exiv29Converter11cnvXmpValueEPKcS2_:
  844|   148k|void Converter::cnvXmpValue(const char* from, const char* to) {
  845|   148k|  auto pos = xmpData_->findKey(XmpKey(from));
  846|   148k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (846:7): [True: 147k, False: 435]
  ------------------
  847|   147k|    return;
  848|    435|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (848:7): [True: 0, False: 435]
  ------------------
  849|      0|    return;
  850|    435|  std::string value;
  851|    435|  if (!getTextValue(value, pos)) {
  ------------------
  |  Branch (851:7): [True: 102, False: 333]
  ------------------
  852|    102|#ifndef SUPPRESS_WARNINGS
  853|    102|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|    102|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 102]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    102|  LogMsg(LogMsg::warn).os()
  ------------------
  854|    102|#endif
  855|    102|    return;
  856|    102|  }
  857|       |  // Todo: Escape non-ASCII characters in XMP text values
  858|    333|  ExifKey key(to);
  859|    333|  if (auto ed = Exifdatum(key); ed.setValue(value) == 0) {
  ------------------
  |  Branch (859:33): [True: 329, False: 4]
  ------------------
  860|    329|    exifData_->add(ed);
  861|    329|  }
  862|    333|  if (erase_)
  ------------------
  |  Branch (862:7): [True: 0, False: 333]
  ------------------
  863|      0|    xmpData_->erase(pos);
  864|    333|}
_ZN5Exiv29Converter13cnvXmpCommentEPKcS2_:
  866|  1.64k|void Converter::cnvXmpComment(const char* from, const char* to) {
  867|  1.64k|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (867:7): [True: 0, False: 1.64k]
  ------------------
  868|      0|    return;
  869|  1.64k|  auto pos = xmpData_->findKey(XmpKey(from));
  870|  1.64k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (870:7): [True: 1.64k, False: 0]
  ------------------
  871|  1.64k|    return;
  872|      0|  std::string value;
  873|      0|  if (!getTextValue(value, pos)) {
  ------------------
  |  Branch (873:7): [True: 0, False: 0]
  ------------------
  874|      0|#ifndef SUPPRESS_WARNINGS
  875|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  876|      0|#endif
  877|      0|    return;
  878|      0|  }
  879|       |  // Assumes the XMP value is encoded in UTF-8, as it should be
  880|      0|  (*exifData_)[to] = "charset=Unicode " + value;
  881|      0|  if (erase_)
  ------------------
  |  Branch (881:7): [True: 0, False: 0]
  ------------------
  882|      0|    xmpData_->erase(pos);
  883|      0|}
_ZN5Exiv29Converter11cnvXmpArrayEPKcS2_:
  885|  1.64k|void Converter::cnvXmpArray(const char* from, const char* to) {
  886|  1.64k|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (886:7): [True: 0, False: 1.64k]
  ------------------
  887|      0|    return;
  888|  1.64k|  auto pos = xmpData_->findKey(XmpKey(from));
  889|  1.64k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (889:7): [True: 1.64k, False: 0]
  ------------------
  890|  1.64k|    return;
  891|      0|  std::string array;
  892|      0|  for (size_t i = 0; i < pos->count(); ++i) {
  ------------------
  |  Branch (892:22): [True: 0, False: 0]
  ------------------
  893|      0|    std::string value = pos->toString(i);
  894|      0|    if (!pos->value().ok()) {
  ------------------
  |  Branch (894:9): [True: 0, False: 0]
  ------------------
  895|      0|#ifndef SUPPRESS_WARNINGS
  896|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  897|      0|#endif
  898|      0|      return;
  899|      0|    }
  900|      0|    array += value;
  901|      0|    if (i != pos->count() - 1)
  ------------------
  |  Branch (901:9): [True: 0, False: 0]
  ------------------
  902|      0|      array += " ";
  903|      0|  }
  904|      0|  (*exifData_)[to] = array;
  905|      0|  if (erase_)
  ------------------
  |  Branch (905:7): [True: 0, False: 0]
  ------------------
  906|      0|    xmpData_->erase(pos);
  907|      0|}
_ZN5Exiv29Converter10cnvXmpDateEPKcS2_:
  909|  6.58k|void Converter::cnvXmpDate(const char* from, const char* to) {
  910|  6.58k|  auto pos = xmpData_->findKey(XmpKey(from));
  911|  6.58k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (911:7): [True: 6.29k, False: 290]
  ------------------
  912|  6.29k|    return;
  913|    290|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (913:7): [True: 0, False: 290]
  ------------------
  914|      0|    return;
  915|    290|#ifdef EXV_HAVE_XMP_TOOLKIT
  916|    290|  std::string value = pos->toString();
  917|    290|  if (!pos->value().ok()) {
  ------------------
  |  Branch (917:7): [True: 0, False: 290]
  ------------------
  918|      0|#ifndef SUPPRESS_WARNINGS
  919|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  920|      0|#endif
  921|      0|    return;
  922|      0|  }
  923|    290|  XMP_DateTime datetime;
  924|    290|  try {
  925|    290|    SXMPUtils::ConvertToDate(value, &datetime);
  926|    290|    if (std::string(to) != "Exif.GPSInfo.GPSTimeStamp") {
  ------------------
  |  Branch (926:9): [True: 107, False: 183]
  ------------------
  927|    107|      SXMPUtils::ConvertToLocalTime(&datetime);
  928|       |
  929|    107|      (*exifData_)[to] = stringFormat("{:4}:{:02}:{:02} {:02}:{:02}:{:02}", datetime.year, datetime.month, datetime.day,
  ------------------
  |  |   18|    107|#define stringFormat std::format
  ------------------
  930|    107|                                      datetime.hour, datetime.minute, datetime.second);
  931|       |
  932|    107|      if (datetime.nanoSecond) {
  ------------------
  |  Branch (932:11): [True: 7, False: 100]
  ------------------
  933|      7|        const char* subsecTag = nullptr;
  934|      7|        if (std::string(to) == "Exif.Image.DateTime") {
  ------------------
  |  Branch (934:13): [True: 2, False: 5]
  ------------------
  935|      2|          subsecTag = "Exif.Photo.SubSecTime";
  936|      5|        } else if (std::string(to) == "Exif.Photo.DateTimeOriginal") {
  ------------------
  |  Branch (936:20): [True: 3, False: 2]
  ------------------
  937|      3|          subsecTag = "Exif.Photo.SubSecTimeOriginal";
  938|      3|        } else if (std::string(to) == "Exif.Photo.DateTimeDigitized") {
  ------------------
  |  Branch (938:20): [True: 2, False: 0]
  ------------------
  939|      2|          subsecTag = "Exif.Photo.SubSecTimeDigitized";
  940|      2|        }
  941|      7|        if (subsecTag) {
  ------------------
  |  Branch (941:13): [True: 7, False: 0]
  ------------------
  942|      7|          prepareExifTarget(subsecTag, true);
  943|      7|          (*exifData_)[subsecTag] = std::to_string(datetime.nanoSecond);
  944|      7|        }
  945|      7|      }
  946|    183|    } else {  // "Exif.GPSInfo.GPSTimeStamp"
  947|       |      // Ignore the time zone, assuming the time is in UTC as it should be
  948|       |
  949|    183|      URational rhour(datetime.hour, 1);
  950|    183|      URational rmin(datetime.minute, 1);
  951|    183|      URational rsec(datetime.second, 1);
  952|    183|      if (datetime.nanoSecond != 0) {
  ------------------
  |  Branch (952:11): [True: 0, False: 183]
  ------------------
  953|      0|        if (datetime.second != 0) {
  ------------------
  |  Branch (953:13): [True: 0, False: 0]
  ------------------
  954|       |          // Add the seconds to rmin so that the ns fit into rsec
  955|      0|          rmin.second = 60;
  956|      0|          rmin.first *= 60;
  957|      0|          rmin.first += datetime.second;
  958|      0|        }
  959|      0|        rsec.second = 1000000000;
  960|      0|        rsec.first = datetime.nanoSecond;
  961|      0|      }
  962|       |
  963|    183|      std::ostringstream array;
  964|    183|      array << rhour << " " << rmin << " " << rsec;
  965|    183|      (*exifData_)[to] = array.str();
  966|       |
  967|    183|      prepareExifTarget("Exif.GPSInfo.GPSDateStamp", true);
  968|    183|      (*exifData_)["Exif.GPSInfo.GPSDateStamp"] =
  969|    183|          stringFormat("{:4}:{:02}:{:02}", datetime.year, datetime.month, datetime.day);
  ------------------
  |  |   18|    183|#define stringFormat std::format
  ------------------
  970|    183|    }
  971|    290|  }
  972|    290|#ifndef SUPPRESS_WARNINGS
  973|    290|  catch (const XMP_Error& e) {
  974|    187|    EXV_WARNING << "Failed to convert " << from << " to " << to << " (" << e.GetErrMsg() << ")\n";
  ------------------
  |  |  138|    187|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 187]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    187|  LogMsg(LogMsg::warn).os()
  ------------------
  975|    187|    return;
  976|    187|  }
  977|       |#else
  978|       |  catch (const XMP_Error&) {
  979|       |    return;
  980|       |  }
  981|       |#endif  // SUPPRESS_WARNINGS
  982|       |
  983|    103|  if (erase_)
  ------------------
  |  Branch (983:7): [True: 0, False: 103]
  ------------------
  984|      0|    xmpData_->erase(pos);
  985|       |#else
  986|       |#ifndef SUPPRESS_WARNINGS
  987|       |  EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  988|       |#endif
  989|       |#endif  // !EXV_HAVE_XMP_TOOLKIT
  990|    103|}
_ZN5Exiv29Converter13cnvXmpVersionEPKcS2_:
  992|  3.29k|void Converter::cnvXmpVersion(const char* from, const char* to) {
  993|  3.29k|  auto pos = xmpData_->findKey(XmpKey(from));
  994|  3.29k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (994:7): [True: 3.29k, False: 0]
  ------------------
  995|  3.29k|    return;
  996|      0|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (996:7): [True: 0, False: 0]
  ------------------
  997|      0|    return;
  998|      0|  std::string value = pos->toString();
  999|      0|  if (!pos->value().ok() || value.length() < 4) {
  ------------------
  |  Branch (999:7): [True: 0, False: 0]
  |  Branch (999:29): [True: 0, False: 0]
  ------------------
 1000|      0|#ifndef SUPPRESS_WARNINGS
 1001|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1002|      0|#endif
 1003|      0|    return;
 1004|      0|  }
 1005|       |
 1006|      0|  (*exifData_)[to] = stringFormat("{} {} {} {}", static_cast<int>(value[0]), static_cast<int>(value[1]),
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
 1007|      0|                                  static_cast<int>(value[2]), static_cast<int>(value[3]));
 1008|      0|  if (erase_)
  ------------------
  |  Branch (1008:7): [True: 0, False: 0]
  ------------------
 1009|      0|    xmpData_->erase(pos);
 1010|      0|}
_ZN5Exiv29Converter16cnvXmpGPSVersionEPKcS2_:
 1012|  1.64k|void Converter::cnvXmpGPSVersion(const char* from, const char* to) {
 1013|  1.64k|  auto pos = xmpData_->findKey(XmpKey(from));
 1014|  1.64k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (1014:7): [True: 1.64k, False: 0]
  ------------------
 1015|  1.64k|    return;
 1016|      0|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (1016:7): [True: 0, False: 0]
  ------------------
 1017|      0|    return;
 1018|      0|  std::string value = pos->toString();
 1019|      0|  if (!pos->value().ok()) {
  ------------------
  |  Branch (1019:7): [True: 0, False: 0]
  ------------------
 1020|      0|#ifndef SUPPRESS_WARNINGS
 1021|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1022|      0|#endif
 1023|      0|    return;
 1024|      0|  }
 1025|       |
 1026|      0|  std::replace(value.begin(), value.end(), '.', ' ');
 1027|      0|  (*exifData_)[to] = value;
 1028|      0|  if (erase_)
  ------------------
  |  Branch (1028:7): [True: 0, False: 0]
  ------------------
 1029|      0|    xmpData_->erase(pos);
 1030|      0|}
_ZN5Exiv29Converter11cnvXmpFlashEPKcS2_:
 1032|  1.64k|void Converter::cnvXmpFlash(const char* from, const char* to) {
 1033|  1.64k|  auto pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Fired"));
 1034|  1.64k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (1034:7): [True: 1.64k, False: 0]
  ------------------
 1035|  1.64k|    return;
 1036|      0|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (1036:7): [True: 0, False: 0]
  ------------------
 1037|      0|    return;
 1038|      0|  unsigned short value = 0;
 1039|       |
 1040|      0|  if (pos != xmpData_->end() && pos->count() > 0) {
  ------------------
  |  Branch (1040:7): [True: 0, False: 0]
  |  Branch (1040:7): [True: 0, False: 0]
  |  Branch (1040:33): [True: 0, False: 0]
  ------------------
 1041|      0|    auto fired = pos->toUint32();
 1042|      0|    if (pos->value().ok())
  ------------------
  |  Branch (1042:9): [True: 0, False: 0]
  ------------------
 1043|      0|      value |= fired & 1;
 1044|      0|#ifndef SUPPRESS_WARNINGS
 1045|      0|    else
 1046|      0|      EXV_WARNING << "Failed to convert " << std::string(from) << "/exif:Fired"
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1047|      0|                  << " to " << to << "\n";
 1048|      0|#endif
 1049|      0|  }
 1050|      0|  pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Return"));
 1051|      0|  if (pos != xmpData_->end() && pos->count() > 0) {
  ------------------
  |  Branch (1051:7): [True: 0, False: 0]
  |  Branch (1051:7): [True: 0, False: 0]
  |  Branch (1051:33): [True: 0, False: 0]
  ------------------
 1052|      0|    auto ret = pos->toUint32();
 1053|      0|    if (pos->value().ok())
  ------------------
  |  Branch (1053:9): [True: 0, False: 0]
  ------------------
 1054|      0|      value |= (ret & 3) << 1;
 1055|      0|#ifndef SUPPRESS_WARNINGS
 1056|      0|    else
 1057|      0|      EXV_WARNING << "Failed to convert " << std::string(from) << "/exif:Return"
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1058|      0|                  << " to " << to << "\n";
 1059|      0|#endif
 1060|      0|  }
 1061|      0|  pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Mode"));
 1062|      0|  if (pos != xmpData_->end() && pos->count() > 0) {
  ------------------
  |  Branch (1062:7): [True: 0, False: 0]
  |  Branch (1062:7): [True: 0, False: 0]
  |  Branch (1062:33): [True: 0, False: 0]
  ------------------
 1063|      0|    auto mode = pos->toUint32();
 1064|      0|    if (pos->value().ok())
  ------------------
  |  Branch (1064:9): [True: 0, False: 0]
  ------------------
 1065|      0|      value |= (mode & 3) << 3;
 1066|      0|#ifndef SUPPRESS_WARNINGS
 1067|      0|    else
 1068|      0|      EXV_WARNING << "Failed to convert " << std::string(from) << "/exif:Mode"
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1069|      0|                  << " to " << to << "\n";
 1070|      0|#endif
 1071|      0|  }
 1072|      0|  pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:Function"));
 1073|      0|  if (pos != xmpData_->end() && pos->count() > 0) {
  ------------------
  |  Branch (1073:7): [True: 0, False: 0]
  |  Branch (1073:7): [True: 0, False: 0]
  |  Branch (1073:33): [True: 0, False: 0]
  ------------------
 1074|      0|    auto function = pos->toUint32();
 1075|      0|    if (pos->value().ok())
  ------------------
  |  Branch (1075:9): [True: 0, False: 0]
  ------------------
 1076|      0|      value |= (function & 1) << 5;
 1077|      0|#ifndef SUPPRESS_WARNINGS
 1078|      0|    else
 1079|      0|      EXV_WARNING << "Failed to convert " << std::string(from) << "/exif:Function"
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1080|      0|                  << " to " << to << "\n";
 1081|      0|#endif
 1082|      0|  }
 1083|      0|  pos = xmpData_->findKey(XmpKey(std::string(from) + "/exif:RedEyeMode"));
 1084|      0|  if (pos != xmpData_->end()) {
  ------------------
  |  Branch (1084:7): [True: 0, False: 0]
  ------------------
 1085|      0|    if (pos->count() > 0) {
  ------------------
  |  Branch (1085:9): [True: 0, False: 0]
  ------------------
 1086|      0|      auto red = pos->toUint32();
 1087|      0|      if (pos->value().ok())
  ------------------
  |  Branch (1087:11): [True: 0, False: 0]
  ------------------
 1088|      0|        value |= (red & 1) << 6;
 1089|      0|#ifndef SUPPRESS_WARNINGS
 1090|      0|      else
 1091|      0|        EXV_WARNING << "Failed to convert " << std::string(from) << "/exif:RedEyeMode"
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1092|      0|                    << " to " << to << "\n";
 1093|      0|#endif
 1094|      0|    }
 1095|      0|    if (erase_)
  ------------------
  |  Branch (1095:9): [True: 0, False: 0]
  ------------------
 1096|      0|      xmpData_->erase(pos);
 1097|      0|  }
 1098|       |
 1099|      0|  (*exifData_)[to] = value;
 1100|      0|}
_ZN5Exiv29Converter14cnvXmpGPSCoordEPKcS2_:
 1102|  6.58k|void Converter::cnvXmpGPSCoord(const char* from, const char* to) {
 1103|  6.58k|  auto pos = xmpData_->findKey(XmpKey(from));
 1104|  6.58k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (1104:7): [True: 6.58k, False: 0]
  ------------------
 1105|  6.58k|    return;
 1106|      0|  if (!prepareExifTarget(to))
  ------------------
  |  Branch (1106:7): [True: 0, False: 0]
  ------------------
 1107|      0|    return;
 1108|      0|  std::string value = pos->toString();
 1109|      0|  if (!pos->value().ok()) {
  ------------------
  |  Branch (1109:7): [True: 0, False: 0]
  ------------------
 1110|      0|#ifndef SUPPRESS_WARNINGS
 1111|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1112|      0|#endif
 1113|      0|    return;
 1114|      0|  }
 1115|      0|  if (value.empty()) {
  ------------------
  |  Branch (1115:7): [True: 0, False: 0]
  ------------------
 1116|      0|#ifndef SUPPRESS_WARNINGS
 1117|      0|    EXV_WARNING << from << " is empty\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1118|      0|#endif
 1119|      0|    return;
 1120|      0|  }
 1121|       |
 1122|      0|  double deg = 0.0;
 1123|      0|  double min = 0.0;
 1124|      0|  double sec = 0.0;
 1125|      0|  char ref = value.back();
 1126|      0|  char sep1 = '\0';
 1127|      0|  char sep2 = '\0';
 1128|       |
 1129|      0|  value.pop_back();
 1130|       |
 1131|      0|  std::istringstream in(value);
 1132|       |
 1133|      0|  in >> deg >> sep1 >> min >> sep2;
 1134|       |
 1135|      0|  if (sep2 == ',') {
  ------------------
  |  Branch (1135:7): [True: 0, False: 0]
  ------------------
 1136|      0|    in >> sec;
 1137|      0|  } else {
 1138|      0|    sec = (min - static_cast<int>(min)) * 60.0;
 1139|      0|    min = static_cast<double>(static_cast<int>(min));
 1140|      0|  }
 1141|       |
 1142|      0|  if (in.bad() || (ref != 'N' && ref != 'S' && ref != 'E' && ref != 'W') || sep1 != ',' || !in.eof()) {
  ------------------
  |  Branch (1142:7): [True: 0, False: 0]
  |  Branch (1142:20): [True: 0, False: 0]
  |  Branch (1142:34): [True: 0, False: 0]
  |  Branch (1142:48): [True: 0, False: 0]
  |  Branch (1142:62): [True: 0, False: 0]
  |  Branch (1142:77): [True: 0, False: 0]
  |  Branch (1142:92): [True: 0, False: 0]
  ------------------
 1143|      0|#ifndef SUPPRESS_WARNINGS
 1144|      0|    EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1145|      0|#endif
 1146|      0|    return;
 1147|      0|  }
 1148|       |
 1149|      0|  Rational rdeg = floatToRationalCast(static_cast<float>(deg));
 1150|      0|  Rational rmin = floatToRationalCast(static_cast<float>(min));
 1151|      0|  Rational rsec = floatToRationalCast(static_cast<float>(sec));
 1152|       |
 1153|      0|  std::ostringstream array;
 1154|      0|  array << rdeg << " " << rmin << " " << rsec;
 1155|      0|  (*exifData_)[to] = array.str();
 1156|       |
 1157|      0|  prepareExifTarget((std::string(to) + "Ref").c_str(), true);
 1158|      0|  char ref_str[2] = {ref, 0};
 1159|      0|  (*exifData_)[std::string(to) + "Ref"] = ref_str;
 1160|       |
 1161|      0|  if (erase_)
  ------------------
  |  Branch (1161:7): [True: 0, False: 0]
  ------------------
 1162|      0|    xmpData_->erase(pos);
 1163|      0|}
_ZN5Exiv29Converter12cnvIptcValueEPKcS2_:
 1165|  29.6k|void Converter::cnvIptcValue(const char* from, const char* to) {
 1166|  29.6k|  auto pos = iptcData_->findKey(IptcKey(from));
 1167|  29.6k|  if (pos == iptcData_->end())
  ------------------
  |  Branch (1167:7): [True: 29.2k, False: 347]
  ------------------
 1168|  29.2k|    return;
 1169|    347|  if (!prepareXmpTarget(to))
  ------------------
  |  Branch (1169:7): [True: 0, False: 347]
  ------------------
 1170|      0|    return;
 1171|  42.0k|  while (pos != iptcData_->end()) {
  ------------------
  |  Branch (1171:10): [True: 41.6k, False: 347]
  ------------------
 1172|  41.6k|    if (pos->key() == from) {
  ------------------
  |  Branch (1172:9): [True: 21.4k, False: 20.2k]
  ------------------
 1173|  21.4k|      std::string value = pos->toString();
 1174|  21.4k|      if (!pos->value().ok()) {
  ------------------
  |  Branch (1174:11): [True: 0, False: 21.4k]
  ------------------
 1175|      0|#ifndef SUPPRESS_WARNINGS
 1176|      0|        EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1177|      0|#endif
 1178|      0|        ++pos;
 1179|      0|        continue;
 1180|      0|      }
 1181|  21.4k|      if (iptcCharset_)
  ------------------
  |  Branch (1181:11): [True: 21.4k, False: 0]
  ------------------
 1182|  21.4k|        convertStringCharset(value, iptcCharset_, "UTF-8");
 1183|  21.4k|      (*xmpData_)[to] = value;
 1184|  21.4k|      if (erase_) {
  ------------------
  |  Branch (1184:11): [True: 0, False: 21.4k]
  ------------------
 1185|      0|        pos = iptcData_->erase(pos);
 1186|      0|        continue;
 1187|      0|      }
 1188|  21.4k|    }
 1189|  41.6k|    ++pos;
 1190|  41.6k|  }
 1191|    347|}
_ZN5Exiv29Converter17cnvXmpValueToIptcEPKcS2_:
 1193|  36.2k|void Converter::cnvXmpValueToIptc(const char* from, const char* to) {
 1194|  36.2k|  auto pos = xmpData_->findKey(XmpKey(from));
 1195|  36.2k|  if (pos == xmpData_->end())
  ------------------
  |  Branch (1195:7): [True: 35.4k, False: 827]
  ------------------
 1196|  35.4k|    return;
 1197|    827|  if (!prepareIptcTarget(to))
  ------------------
  |  Branch (1197:7): [True: 0, False: 827]
  ------------------
 1198|      0|    return;
 1199|       |
 1200|    827|  if (pos->typeId() == langAlt || pos->typeId() == xmpText) {
  ------------------
  |  Branch (1200:7): [True: 217, False: 610]
  |  Branch (1200:35): [True: 400, False: 210]
  ------------------
 1201|    617|    std::string value;
 1202|    617|    if (!getTextValue(value, pos)) {
  ------------------
  |  Branch (1202:9): [True: 118, False: 499]
  ------------------
 1203|    118|#ifndef SUPPRESS_WARNINGS
 1204|    118|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|    118|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 118]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    118|  LogMsg(LogMsg::warn).os()
  ------------------
 1205|    118|#endif
 1206|    118|      return;
 1207|    118|    }
 1208|    499|    (*iptcData_)[to] = value;
 1209|    499|    (*iptcData_)["Iptc.Envelope.CharacterSet"] = "\033%G";  // indicate UTF-8 encoding
 1210|    499|    if (erase_)
  ------------------
  |  Branch (1210:9): [True: 0, False: 499]
  ------------------
 1211|      0|      xmpData_->erase(pos);
 1212|    499|    return;
 1213|    617|  }
 1214|       |
 1215|    210|  size_t count = pos->count();
 1216|    210|  bool added = false;
 1217|  23.3k|  for (size_t i = 0; i < count; ++i) {
  ------------------
  |  Branch (1217:22): [True: 23.1k, False: 210]
  ------------------
 1218|  23.1k|    std::string value = pos->toString(i);
 1219|  23.1k|    if (!pos->value().ok()) {
  ------------------
  |  Branch (1219:9): [True: 0, False: 23.1k]
  ------------------
 1220|      0|#ifndef SUPPRESS_WARNINGS
 1221|      0|      EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1222|      0|#endif
 1223|      0|      continue;
 1224|      0|    }
 1225|  23.1k|    IptcKey key(to);
 1226|  23.1k|    Iptcdatum id(key);
 1227|  23.1k|    id.setValue(value);
 1228|  23.1k|    iptcData_->add(id);
 1229|  23.1k|    added = true;
 1230|  23.1k|  }
 1231|    210|  if (added)
  ------------------
  |  Branch (1231:7): [True: 205, False: 5]
  ------------------
 1232|    205|    (*iptcData_)["Iptc.Envelope.CharacterSet"] = "\033%G";  // indicate UTF-8 encoding
 1233|    210|  if (erase_)
  ------------------
  |  Branch (1233:7): [True: 0, False: 210]
  ------------------
 1234|      0|    xmpData_->erase(pos);
 1235|    210|}
_ZN5Exiv213copyExifToXmpERKNS_8ExifDataERNS_7XmpDataE:
 1316|  1.52k|void copyExifToXmp(const ExifData& exifData, XmpData& xmpData) {
 1317|       |  /// \todo the const_cast is "lying". We are modifying the input data. Check if this might have any bad side
 1318|       |  /// effect
 1319|  1.52k|  Converter converter(const_cast<ExifData&>(exifData), xmpData);
 1320|  1.52k|  converter.cnvToXmp();
 1321|  1.52k|}
_ZN5Exiv213copyXmpToExifERKNS_7XmpDataERNS_8ExifDataE:
 1330|  1.64k|void copyXmpToExif(const XmpData& xmpData, ExifData& exifData) {
 1331|  1.64k|  Converter converter(exifData, const_cast<XmpData&>(xmpData));
 1332|  1.64k|  converter.cnvFromXmp();
 1333|  1.64k|}
_ZN5Exiv213copyIptcToXmpERKNS_8IptcDataERNS_7XmpDataEPKc:
 1347|  1.48k|void copyIptcToXmp(const IptcData& iptcData, XmpData& xmpData, const char* iptcCharset) {
 1348|  1.48k|  if (!iptcCharset)
  ------------------
  |  Branch (1348:7): [True: 1.48k, False: 0]
  ------------------
 1349|  1.48k|    iptcCharset = iptcData.detectCharset();
 1350|  1.48k|  if (!iptcCharset)
  ------------------
  |  Branch (1350:7): [True: 0, False: 1.48k]
  ------------------
 1351|      0|    iptcCharset = "ISO-8859-1";
 1352|       |
 1353|  1.48k|  Converter converter(const_cast<IptcData&>(iptcData), xmpData, iptcCharset);
 1354|  1.48k|  converter.cnvToXmp();
 1355|  1.48k|}
_ZN5Exiv213copyXmpToIptcERKNS_7XmpDataERNS_8IptcDataE:
 1368|  1.64k|void copyXmpToIptc(const XmpData& xmpData, IptcData& iptcData) {
 1369|  1.64k|  Converter converter(iptcData, const_cast<XmpData&>(xmpData));
 1370|  1.64k|  converter.cnvFromXmp();
 1371|  1.64k|}
_ZN5Exiv220convertStringCharsetERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPKcS9_:
 1380|  32.2k|bool convertStringCharset([[maybe_unused]] std::string& str, const char* from, const char* to) {
 1381|  32.2k|  if (0 == strcmp(from, to))
  ------------------
  |  Branch (1381:7): [True: 21.4k, False: 10.8k]
  ------------------
 1382|  21.4k|    return true;  // nothing to do
 1383|  10.8k|#ifdef EXV_HAVE_ICONV
 1384|  10.8k|  return convertStringCharsetIconv(str, from, to);
 1385|       |#elif defined _WIN32
 1386|       |  return convertStringCharsetWindows(str, from, to);
 1387|       |#else
 1388|       |#ifndef SUPPRESS_WARNINGS
 1389|       |  EXV_WARNING << "Charset conversion required but no character mapping functionality available.\n";
 1390|       |#endif
 1391|       |  return false;
 1392|       |#endif
 1393|  32.2k|}
convert.cpp:_ZN12_GLOBAL__N_125convertStringCharsetIconvERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_17basic_string_viewIcS3_EES9_:
 1402|  10.8k|bool convertStringCharsetIconv(std::string& str, std::string_view from, std::string_view to) {
 1403|  10.8k|  if (from == to)
  ------------------
  |  Branch (1403:7): [True: 0, False: 10.8k]
  ------------------
 1404|      0|    return true;  // nothing to do
 1405|       |
 1406|  10.8k|  bool ret = true;
 1407|  10.8k|  auto cd = iconv_open(to.data(), from.data());
 1408|  10.8k|  if (cd == iconv_t(-1)) {
  ------------------
  |  Branch (1408:7): [True: 0, False: 10.8k]
  ------------------
 1409|      0|#ifndef SUPPRESS_WARNINGS
 1410|      0|    EXV_WARNING << "iconv_open: " << strError() << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1411|      0|#endif
 1412|      0|    return false;
 1413|      0|  }
 1414|  10.8k|  std::string outstr;
 1415|       |#ifdef WINICONV_CONST
 1416|       |  auto inptr = (WINICONV_CONST char*)(str.c_str());
 1417|       |#else
 1418|  10.8k|  auto inptr = (EXV_ICONV_CONST char*)(str.c_str());
 1419|  10.8k|#endif
 1420|  10.8k|  size_t inbytesleft = str.length();
 1421|  17.4k|  while (inbytesleft) {
  ------------------
  |  Branch (1421:10): [True: 14.7k, False: 2.68k]
  ------------------
 1422|  14.7k|    char outbuf[256];
 1423|  14.7k|    char* outptr = outbuf;
 1424|  14.7k|    size_t outbytesleft = sizeof(outbuf);
 1425|  14.7k|    size_t rc = iconv(cd, &inptr, &inbytesleft, &outptr, &outbytesleft);
 1426|  14.7k|    const size_t outbytesProduced = sizeof(outbuf) - outbytesleft;
 1427|  14.7k|    if (rc == std::numeric_limits<size_t>::max() && errno != E2BIG) {
  ------------------
  |  Branch (1427:9): [True: 12.5k, False: 2.18k]
  |  Branch (1427:53): [True: 8.14k, False: 4.45k]
  ------------------
 1428|  8.14k|#ifndef SUPPRESS_WARNINGS
 1429|  8.14k|      EXV_WARNING << "iconv: " << strError() << " inbytesleft = " << inbytesleft << "\n";
  ------------------
  |  |  138|  8.14k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 8.14k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  8.14k|  LogMsg(LogMsg::warn).os()
  ------------------
 1430|  8.14k|#endif
 1431|  8.14k|      ret = false;
 1432|  8.14k|      break;
 1433|  8.14k|    }
 1434|  6.64k|    outstr.append(std::string(outbuf, outbytesProduced));
 1435|  6.64k|  }
 1436|       |
 1437|  10.8k|  if (cd)
  ------------------
  |  Branch (1437:7): [True: 10.8k, False: 0]
  ------------------
 1438|  10.8k|    iconv_close(cd);
 1439|       |
 1440|  10.8k|  if (ret)
  ------------------
  |  Branch (1440:7): [True: 2.68k, False: 8.14k]
  ------------------
 1441|  2.68k|    str = std::move(outstr);
 1442|  10.8k|  return ret;
 1443|  10.8k|}
convert.cpp:_ZN12_GLOBAL__N_112getTextValueERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_11__wrap_iterIPN5Exiv28XmpdatumEEE:
 1592|  1.05k|bool getTextValue(std::string& value, XmpData::iterator pos) {
 1593|  1.05k|  if (pos->typeId() == langAlt) {
  ------------------
  |  Branch (1593:7): [True: 384, False: 668]
  ------------------
 1594|       |    // get the default language entry without x-default qualifier
 1595|    384|    value = pos->toString(0);
 1596|    384|    if (!pos->value().ok() && pos->count() == 1) {
  ------------------
  |  Branch (1596:9): [True: 373, False: 11]
  |  Branch (1596:31): [True: 153, False: 220]
  ------------------
 1597|       |      // If there is no default but exactly one entry, take that
 1598|       |      // without the qualifier
 1599|    153|      value = pos->toString();
 1600|    153|      if (pos->value().ok() && value.starts_with("lang=")) {
  ------------------
  |  Branch (1600:11): [True: 153, False: 0]
  |  Branch (1600:32): [True: 153, False: 0]
  ------------------
 1601|    153|        const std::string::size_type first_space_pos = value.find_first_of(' ');
 1602|    153|        if (first_space_pos != std::string::npos) {
  ------------------
  |  Branch (1602:13): [True: 153, False: 0]
  ------------------
 1603|    153|          value = value.substr(first_space_pos + 1);
 1604|    153|        } else {
 1605|      0|          value.clear();
 1606|      0|        }
 1607|    153|      }
 1608|    153|    }
 1609|    668|  } else {
 1610|    668|    value = pos->toString();
 1611|    668|  }
 1612|  1.05k|  return pos->value().ok();
 1613|  1.05k|}

_ZN5Exiv28Internal9Cr2HeaderC2ENS_9ByteOrderE:
   14|  33.3k|Cr2Header::Cr2Header(ByteOrder byteOrder) : TiffHeaderBase(42, 16, byteOrder, 0x00000010) {
   15|  33.3k|}
_ZN5Exiv28Internal9Cr2Header4readEPKhm:
   17|  33.3k|bool Cr2Header::read(const byte* pData, size_t size) {
   18|  33.3k|  if (!pData || size < 16) {
  ------------------
  |  Branch (18:7): [True: 0, False: 33.3k]
  |  Branch (18:17): [True: 0, False: 33.3k]
  ------------------
   19|      0|    return false;
   20|      0|  }
   21|       |
   22|  33.3k|  if (pData[0] == 'I' && pData[0] == pData[1]) {
  ------------------
  |  Branch (22:7): [True: 2.68k, False: 30.6k]
  |  Branch (22:26): [True: 2.61k, False: 66]
  ------------------
   23|  2.61k|    setByteOrder(littleEndian);
   24|  30.7k|  } else if (pData[0] == 'M' && pData[0] == pData[1]) {
  ------------------
  |  Branch (24:14): [True: 12.1k, False: 18.6k]
  |  Branch (24:33): [True: 12.0k, False: 46]
  ------------------
   25|  12.0k|    setByteOrder(bigEndian);
   26|  18.6k|  } else {
   27|  18.6k|    return false;
   28|  18.6k|  }
   29|  14.6k|  if (tag() != getUShort(pData + 2, byteOrder()))
  ------------------
  |  Branch (29:7): [True: 7.22k, False: 7.47k]
  ------------------
   30|  7.22k|    return false;
   31|  7.47k|  setOffset(getULong(pData + 4, byteOrder()));
   32|  7.47k|  if (!std::equal(cr2sig_, cr2sig_ + 4, pData + 8))
  ------------------
  |  Branch (32:7): [True: 5.36k, False: 2.10k]
  ------------------
   33|  5.36k|    return false;
   34|  2.10k|  offset2_ = getULong(pData + 12, byteOrder());
   35|       |
   36|  2.10k|  return true;
   37|  7.47k|}
_ZNK5Exiv28Internal9Cr2Header5writeEv:
   39|    122|DataBuf Cr2Header::write() const {
   40|    122|  DataBuf buf(16);
   41|    122|  switch (byteOrder()) {
   42|     82|    case littleEndian:
  ------------------
  |  Branch (42:5): [True: 82, False: 40]
  ------------------
   43|     82|      buf.write_uint8(0, 'I');
   44|     82|      break;
   45|     40|    case bigEndian:
  ------------------
  |  Branch (45:5): [True: 40, False: 82]
  ------------------
   46|     40|      buf.write_uint8(0, 'M');
   47|     40|      break;
   48|      0|    default:
  ------------------
  |  Branch (48:5): [True: 0, False: 122]
  ------------------
   49|      0|      break;
   50|    122|  }
   51|    122|  buf.write_uint8(1, buf.read_uint8(0));
   52|       |
   53|    122|  buf.write_uint16(2, tag(), byteOrder());
   54|    122|  buf.write_uint32(4, 0x00000010, byteOrder());
   55|    122|  std::copy(cr2sig_, cr2sig_ + 4, buf.begin() + 8);
   56|       |  // Write a dummy value for the RAW IFD offset. The offset-writer is used to set this offset in a second pass.
   57|    122|  buf.write_uint32(12, 0x00000000, byteOrder());
   58|    122|  return buf;
   59|    122|}  // Cr2Header::write
_ZNK5Exiv28Internal9Cr2Header10isImageTagEtNS_5IfdIdERKNSt3__16vectorIS2_NS3_9allocatorIS2_EEEE:
   61|  33.8k|bool Cr2Header::isImageTag(uint16_t tag, IfdId group, const PrimaryGroups& /*pPrimaryGroups*/) const {
   62|       |  // CR2 image tags are all IFD2 and IFD3 tags
   63|  33.8k|  if (group == IfdId::ifd2Id || group == IfdId::ifd3Id)
  ------------------
  |  Branch (63:7): [True: 264, False: 33.5k]
  |  Branch (63:33): [True: 435, False: 33.1k]
  ------------------
   64|    699|    return true;
   65|       |  // ...and any (IFD0) tag that is in the TIFF image tags list
   66|  33.1k|  return isTiffImageTag(tag, group);
   67|  33.8k|}

_ZN5Exiv28Internal9Cr2Header11offset2addrEv:
   52|    144|  static uint32_t offset2addr() {
   53|    144|    return 12;
   54|    144|  }

_ZN5Exiv28Cr2ImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   24|    418|    Image(ImageType::cr2, mdExif | mdIptc | mdXmp, std::move(io), params) {
   25|    418|}  // Cr2Image::Cr2Image
_ZNK5Exiv28Cr2Image10pixelWidthEv:
   31|    229|uint32_t Cr2Image::pixelWidth() const {
   32|    229|  auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
   33|    229|  if (imageWidth != exifData_.end() && imageWidth->count() > 0) {
  ------------------
  |  Branch (33:7): [True: 10, False: 219]
  |  Branch (33:7): [True: 5, False: 224]
  |  Branch (33:40): [True: 5, False: 5]
  ------------------
   34|      5|    return imageWidth->toUint32();
   35|      5|  }
   36|    224|  return 0;
   37|    229|}
_ZNK5Exiv28Cr2Image11pixelHeightEv:
   39|    229|uint32_t Cr2Image::pixelHeight() const {
   40|    229|  auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
   41|    229|  if (imageHeight != exifData_.end() && imageHeight->count() > 0) {
  ------------------
  |  Branch (41:7): [True: 10, False: 219]
  |  Branch (41:7): [True: 4, False: 225]
  |  Branch (41:41): [True: 4, False: 6]
  ------------------
   42|      4|    return imageHeight->toUint32();
   43|      4|  }
   44|    225|  return 0;
   45|    229|}
_ZN5Exiv28Cr2Image12readMetadataEv:
   59|    418|void Cr2Image::readMetadata() {
   60|       |#ifdef EXIV2_DEBUG_MESSAGES
   61|       |  std::cerr << "Reading CR2 file " << io_->path() << "\n";
   62|       |#endif
   63|    418|  if (io_->open() != 0) {
  ------------------
  |  Branch (63:7): [True: 0, False: 418]
  ------------------
   64|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   65|      0|  }
   66|    418|  IoCloser closer(*io_);
   67|       |  // Ensure that this is the correct image type
   68|    418|  if (!isCr2Type(*io_, false)) {
  ------------------
  |  Branch (68:7): [True: 0, False: 418]
  ------------------
   69|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (69:9): [True: 0, False: 0]
  |  Branch (69:25): [True: 0, False: 0]
  ------------------
   70|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   71|      0|    throw Error(ErrorCode::kerNotAnImage, "CR2");
   72|      0|  }
   73|    418|  clearMetadata();
   74|    418|  const DecodeParams dp(max_recursion_depth_);
   75|    418|  ByteOrder bo = Cr2Parser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), io_->size(), dp);
   76|    418|  setByteOrder(bo);
   77|    418|}  // Cr2Image::readMetadata
_ZN5Exiv28Cr2Image13writeMetadataEv:
   79|    144|void Cr2Image::writeMetadata() {
   80|       |#ifdef EXIV2_DEBUG_MESSAGES
   81|       |  std::cerr << "Writing CR2 file " << io_->path() << "\n";
   82|       |#endif
   83|    144|  ByteOrder bo = byteOrder();
   84|    144|  const byte* pData = nullptr;
   85|    144|  size_t size = 0;
   86|    144|  IoCloser closer(*io_);
   87|       |  // Ensure that this is the correct image type
   88|    144|  if (io_->open() == 0 && isCr2Type(*io_, false)) {
  ------------------
  |  Branch (88:7): [True: 144, False: 0]
  |  Branch (88:27): [True: 144, False: 0]
  ------------------
   89|    144|    pData = io_->mmap(true);
   90|    144|    size = io_->size();
   91|    144|    Internal::Cr2Header cr2Header;
   92|    144|    if (0 == cr2Header.read(pData, 16)) {
  ------------------
  |  Branch (92:9): [True: 0, False: 144]
  ------------------
   93|      0|      bo = cr2Header.byteOrder();
   94|      0|    }
   95|    144|  }
   96|    144|  if (bo == invalidByteOrder) {
  ------------------
  |  Branch (96:7): [True: 0, False: 144]
  ------------------
   97|      0|    bo = littleEndian;
   98|      0|  }
   99|    144|  setByteOrder(bo);
  100|    144|  Cr2Parser::encode(*io_, pData, size, bo, exifData_, iptcData_, xmpData_);  // may throw
  101|    144|}  // Cr2Image::writeMetadata
_ZN5Exiv29Cr2Parser6decodeERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPKhmRKNS_12DecodeParamsE:
  104|    418|                            const DecodeParams& dp) {
  105|    418|  Internal::Cr2Header cr2Header;
  106|    418|  return Internal::TiffParserWorker::decode(exifData, iptcData, xmpData, pData, size, Internal::Tag::root,
  107|    418|                                            Internal::TiffMapping::findDecoder, dp, &cr2Header);
  108|    418|}
_ZN5Exiv29Cr2Parser6encodeERNS_7BasicIoEPKhmNS_9ByteOrderERNS_8ExifDataERKNS_8IptcDataERKNS_7XmpDataE:
  111|    144|                              const IptcData& iptcData, const XmpData& xmpData) {
  112|       |  // Delete IFDs which do not occur in TIFF images
  113|    144|  static constexpr auto filteredIfds = std::array{
  114|    144|      IfdId::panaRawId,
  115|    144|  };
  116|    144|  for (auto&& filteredIfd : filteredIfds) {
  ------------------
  |  Branch (116:27): [True: 144, False: 144]
  ------------------
  117|       |#ifdef EXIV2_DEBUG_MESSAGES
  118|       |    std::cerr << "Warning: Exif IFD " << filteredIfd << " not encoded\n";
  119|       |#endif
  120|    144|    exifData.erase(std::remove_if(exifData.begin(), exifData.end(), Internal::FindExifdatum(filteredIfd)),
  121|    144|                   exifData.end());
  122|    144|  }
  123|       |
  124|    144|  auto header = Internal::Cr2Header(byteOrder);
  125|    144|  Internal::OffsetWriter offsetWriter;
  126|    144|  offsetWriter.setOrigin(Internal::OffsetWriter::cr2RawIfdOffset, Internal::Cr2Header::offset2addr(), byteOrder);
  127|    144|  return Internal::TiffParserWorker::encode(io, pData, size, exifData, iptcData, xmpData, Internal::Tag::root,
  128|    144|                                            Internal::TiffMapping::findEncoder, &header, &offsetWriter);
  129|    144|}
_ZN5Exiv214newCr2InstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  133|    418|Image::UniquePtr newCr2Instance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  134|    418|  auto image = std::make_unique<Cr2Image>(std::move(io), params);
  135|    418|  if (!image->good()) {
  ------------------
  |  Branch (135:7): [True: 0, False: 418]
  ------------------
  136|      0|    return nullptr;
  137|      0|  }
  138|    418|  return image;
  139|    418|}
_ZN5Exiv29isCr2TypeERNS_7BasicIoEb:
  141|  32.7k|bool isCr2Type(BasicIo& iIo, bool advance) {
  142|  32.7k|  const int32_t len = 16;
  143|  32.7k|  byte buf[len];
  144|  32.7k|  iIo.read(buf, len);
  145|  32.7k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (145:7): [True: 0, False: 32.7k]
  |  Branch (145:22): [True: 163, False: 32.6k]
  ------------------
  146|    163|    return false;
  147|    163|  }
  148|  32.6k|  Internal::Cr2Header header;
  149|  32.6k|  bool rc = header.read(buf, len);
  150|  32.6k|  if (!advance || !rc) {
  ------------------
  |  Branch (150:7): [True: 32.6k, False: 0]
  |  Branch (150:19): [True: 0, False: 0]
  ------------------
  151|  32.6k|    iIo.seek(-len, BasicIo::cur);
  152|  32.6k|  }
  153|  32.6k|  return rc;
  154|  32.7k|}

_ZN5Exiv28CrwImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   27|    608|    Image(ImageType::crw, mdExif | mdComment, std::move(io), params) {
   28|    608|}  // CrwImage::CrwImage
_ZNK5Exiv28CrwImage10pixelWidthEv:
   34|     70|uint32_t CrwImage::pixelWidth() const {
   35|     70|  auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelXDimension"));
   36|     70|  if (widthIter != exifData_.end() && widthIter->count() > 0) {
  ------------------
  |  Branch (36:7): [True: 0, False: 70]
  |  Branch (36:7): [True: 0, False: 70]
  |  Branch (36:39): [True: 0, False: 0]
  ------------------
   37|      0|    return widthIter->toUint32();
   38|      0|  }
   39|     70|  return 0;
   40|     70|}
_ZNK5Exiv28CrwImage11pixelHeightEv:
   42|     70|uint32_t CrwImage::pixelHeight() const {
   43|     70|  auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Photo.PixelYDimension"));
   44|     70|  if (heightIter != exifData_.end() && heightIter->count() > 0) {
  ------------------
  |  Branch (44:7): [True: 0, False: 70]
  |  Branch (44:7): [True: 0, False: 70]
  |  Branch (44:40): [True: 0, False: 0]
  ------------------
   45|      0|    return heightIter->toUint32();
   46|      0|  }
   47|     70|  return 0;
   48|     70|}
_ZN5Exiv28CrwImage12readMetadataEv:
   55|    608|void CrwImage::readMetadata() {
   56|       |#ifdef EXIV2_DEBUG_MESSAGES
   57|       |  std::cerr << "Reading CRW file " << io_->path() << "\n";
   58|       |#endif
   59|    608|  if (io_->open()) {
  ------------------
  |  Branch (59:7): [True: 0, False: 608]
  ------------------
   60|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   61|      0|  }
   62|    608|  IoCloser closer(*io_);
   63|       |  // Ensure that this is the correct image type
   64|    608|  if (!isCrwType(*io_, false)) {
  ------------------
  |  Branch (64:7): [True: 0, False: 608]
  ------------------
   65|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (65:9): [True: 0, False: 0]
  |  Branch (65:25): [True: 0, False: 0]
  ------------------
   66|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   67|      0|    throw Error(ErrorCode::kerNotACrwImage);
   68|      0|  }
   69|    608|  clearMetadata();
   70|    608|  DataBuf file(io().size());
   71|    608|  io_->read(file.data(), file.size());
   72|       |
   73|    608|  CrwParser::decode(this, io_->mmap(), io_->size());
   74|       |
   75|    608|}  // CrwImage::readMetadata
_ZN5Exiv28CrwImage13writeMetadataEv:
   77|    182|void CrwImage::writeMetadata() {
   78|       |#ifdef EXIV2_DEBUG_MESSAGES
   79|       |  std::cerr << "Writing CRW file " << io_->path() << "\n";
   80|       |#endif
   81|       |  // Read existing image
   82|    182|  DataBuf buf;
   83|    182|  if (io_->open() == 0) {
  ------------------
  |  Branch (83:7): [True: 182, False: 0]
  ------------------
   84|    182|    IoCloser closer(*io_);
   85|       |    // Ensure that this is the correct image type
   86|    182|    if (isCrwType(*io_, false)) {
  ------------------
  |  Branch (86:9): [True: 182, False: 0]
  ------------------
   87|       |      // Read the image into a memory buffer
   88|    182|      buf.alloc(io_->size());
   89|    182|      io_->read(buf.data(), buf.size());
   90|    182|      if (io_->error() || io_->eof()) {
  ------------------
  |  Branch (90:11): [True: 0, False: 182]
  |  Branch (90:27): [True: 0, False: 182]
  ------------------
   91|      0|        buf.reset();
   92|      0|      }
   93|    182|    }
   94|    182|  }
   95|       |
   96|    182|  Blob blob;
   97|    182|  CrwParser::encode(blob, buf.c_data(), buf.size(), this);
   98|       |
   99|       |  // Write new buffer to file
  100|    182|  MemIo tempIo;
  101|    182|  tempIo.write((!blob.empty() ? blob.data() : nullptr), blob.size());
  ------------------
  |  Branch (101:17): [True: 175, False: 7]
  ------------------
  102|    182|  io_->close();
  103|    182|  io_->transfer(tempIo);  // may throw
  104|       |
  105|    182|}  // CrwImage::writeMetadata
_ZN5Exiv29CrwParser6decodeEPNS_8CrwImageEPKhm:
  107|    608|void CrwParser::decode(CrwImage* pCrwImage, const byte* pData, size_t size) {
  108|       |  // Parse the image, starting with a CIFF header component
  109|    608|  Internal::CiffHeader header;
  110|    608|  header.read(pData, size);
  111|    608|  header.decode(*pCrwImage);
  112|       |
  113|       |  // a hack to get absolute offset of preview image inside CRW structure
  114|    608|  if (auto preview = header.findComponent(0x2007, 0x0000)) {
  ------------------
  |  Branch (114:12): [True: 19, False: 589]
  ------------------
  115|     19|    (pCrwImage->exifData())["Exif.Image2.JPEGInterchangeFormat"] = static_cast<uint32_t>(preview->pData() - pData);
  116|     19|    (pCrwImage->exifData())["Exif.Image2.JPEGInterchangeFormatLength"] = static_cast<uint32_t>(preview->size());
  117|     19|  }
  118|    608|}  // CrwParser::decode
_ZN5Exiv29CrwParser6encodeERNSt3__16vectorIhNS1_9allocatorIhEEEEPKhmPKNS_8CrwImageE:
  120|    182|void CrwParser::encode(Blob& blob, const byte* pData, size_t size, const CrwImage* pCrwImage) {
  121|       |  // Parse image, starting with a CIFF header component
  122|    182|  Internal::CiffHeader header;
  123|    182|  if (size != 0) {
  ------------------
  |  Branch (123:7): [True: 182, False: 0]
  ------------------
  124|    182|    header.read(pData, size);
  125|    182|  }
  126|       |
  127|       |  // Encode Exif tags from image into the CRW parse tree and write the
  128|       |  // structure to the binary image blob
  129|    182|  Internal::CrwMap::encode(header, *pCrwImage);
  130|    182|  header.write(blob);
  131|    182|}
_ZN5Exiv214newCrwInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  135|    608|Image::UniquePtr newCrwInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  136|    608|  auto image = std::make_unique<CrwImage>(std::move(io), params);
  137|    608|  if (!image->good()) {
  ------------------
  |  Branch (137:7): [True: 0, False: 608]
  ------------------
  138|      0|    return nullptr;
  139|      0|  }
  140|    608|  return image;
  141|    608|}
_ZN5Exiv29isCrwTypeERNS_7BasicIoEb:
  143|  32.7k|bool isCrwType(BasicIo& iIo, bool advance) {
  144|  32.7k|  bool result = true;
  145|  32.7k|  byte tmpBuf[14];
  146|  32.7k|  iIo.read(tmpBuf, 14);
  147|  32.7k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (147:7): [True: 0, False: 32.7k]
  |  Branch (147:22): [True: 163, False: 32.6k]
  ------------------
  148|    163|    return false;
  149|    163|  }
  150|  32.6k|  if (('I' != tmpBuf[0] || 'I' != tmpBuf[1]) && ('M' != tmpBuf[0] || 'M' != tmpBuf[1])) {
  ------------------
  |  Branch (150:8): [True: 30.7k, False: 1.90k]
  |  Branch (150:28): [True: 66, False: 1.84k]
  |  Branch (150:50): [True: 18.6k, False: 12.1k]
  |  Branch (150:70): [True: 46, False: 12.1k]
  ------------------
  151|  18.6k|    result = false;
  152|  18.6k|  }
  153|  32.6k|  if (result && std::memcmp(tmpBuf + 6, Internal::CiffHeader::signature(), 8) != 0) {
  ------------------
  |  Branch (153:7): [True: 13.9k, False: 18.6k]
  |  Branch (153:17): [True: 11.9k, False: 2.00k]
  ------------------
  154|  11.9k|    result = false;
  155|  11.9k|  }
  156|  32.6k|  if (!advance || !result)
  ------------------
  |  Branch (156:7): [True: 32.6k, False: 0]
  |  Branch (156:19): [True: 0, False: 0]
  ------------------
  157|  32.6k|    iIo.seek(-14, BasicIo::cur);
  158|  32.6k|  return result;
  159|  32.7k|}

_ZN5Exiv28Internal13CiffComponentC2Ett:
  124|    331|CiffComponent::CiffComponent(uint16_t tag, uint16_t dir) : dir_(dir), tag_(tag) {
  125|    331|}
_ZN5Exiv28Internal13CiffComponent3addENSt3__110unique_ptrIS1_NS2_14default_deleteIS1_EEEE:
  127|  28.5k|const CiffComponent::UniquePtr& CiffComponent::add(UniquePtr component) {
  128|  28.5k|  return doAdd(std::move(component));
  129|  28.5k|}
_ZN5Exiv28Internal13CiffDirectory5doAddENSt3__110unique_ptrINS0_13CiffComponentENS2_14default_deleteIS4_EEEE:
  135|  28.5k|const CiffComponent::UniquePtr& CiffDirectory::doAdd(UniquePtr component) {
  136|  28.5k|  return components_.emplace_back(std::move(component));
  137|  28.5k|}  // CiffDirectory::doAdd
_ZN5Exiv28Internal10CiffHeader4readEPKhm:
  141|    790|void CiffHeader::read(const byte* pData, size_t size) {
  142|    790|  if (size < 14)
  ------------------
  |  Branch (142:7): [True: 0, False: 790]
  ------------------
  143|      0|    throw Error(ErrorCode::kerNotACrwImage);
  144|       |
  145|    790|  if (pData[0] == 'I' && pData[0] == pData[1]) {
  ------------------
  |  Branch (145:7): [True: 452, False: 338]
  |  Branch (145:26): [True: 452, False: 0]
  ------------------
  146|    452|    byteOrder_ = littleEndian;
  147|    452|  } else if (pData[0] == 'M' && pData[0] == pData[1]) {
  ------------------
  |  Branch (147:14): [True: 338, False: 0]
  |  Branch (147:33): [True: 338, False: 0]
  ------------------
  148|    338|    byteOrder_ = bigEndian;
  149|    338|  } else {
  150|      0|    throw Error(ErrorCode::kerNotACrwImage);
  151|      0|  }
  152|    790|  offset_ = getULong(pData + 2, byteOrder_);
  153|    790|  if (offset_ < 14 || offset_ > size)
  ------------------
  |  Branch (153:7): [True: 14, False: 776]
  |  Branch (153:23): [True: 56, False: 720]
  ------------------
  154|     70|    throw Error(ErrorCode::kerNotACrwImage);
  155|    720|  if (std::memcmp(pData + 6, signature(), 8) != 0) {
  ------------------
  |  Branch (155:7): [True: 0, False: 720]
  ------------------
  156|      0|    throw Error(ErrorCode::kerNotACrwImage);
  157|      0|  }
  158|       |
  159|    720|  pPadding_.clear();
  160|    720|  if (offset_ > 14) {
  ------------------
  |  Branch (160:7): [True: 476, False: 244]
  ------------------
  161|    476|    pPadding_.resize(offset_ - 14);
  162|    476|    padded_ = offset_ - 14;
  163|    476|    std::copy_n(pData + 14, padded_, pPadding_.begin());
  164|    476|  }
  165|       |
  166|    720|  pRootDir_ = std::make_unique<CiffDirectory>();
  167|    720|  pRootDir_->readDirectory(pData + offset_, size - offset_, byteOrder_);
  168|    720|}  // CiffHeader::read
_ZN5Exiv28Internal13CiffComponent4readEPKhmjNS_9ByteOrderE:
  170|  28.4k|void CiffComponent::read(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder) {
  171|  28.4k|  doRead(pData, size, start, byteOrder);
  172|  28.4k|}
_ZN5Exiv28Internal13CiffComponent6doReadEPKhmjNS_9ByteOrderE:
  174|  28.4k|void CiffComponent::doRead(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder) {
  175|       |  // We're going read 10 bytes. Make sure they won't be out-of-bounds.
  176|  28.4k|  enforce(size >= 10 && start <= size - 10, ErrorCode::kerNotACrwImage);
  ------------------
  |  Branch (176:11): [True: 28.4k, False: 0]
  |  Branch (176:25): [True: 28.4k, False: 0]
  ------------------
  177|  28.4k|  tag_ = getUShort(pData + start, byteOrder);
  178|       |
  179|  28.4k|  DataLocId dl = dataLocation();
  180|       |
  181|  28.4k|  if (dl == DataLocId::valueData) {
  ------------------
  |  Branch (181:7): [True: 19.4k, False: 9.05k]
  ------------------
  182|  19.4k|    size_ = getULong(pData + start + 2, byteOrder);
  183|  19.4k|    offset_ = getULong(pData + start + 6, byteOrder);
  184|       |
  185|       |    // Make sure that the sub-region does not overlap with the 10 bytes
  186|       |    // that we just read. (Otherwise a malicious file could cause an
  187|       |    // infinite recursion.) There are two cases two consider because
  188|       |    // the sub-region is allowed to be either before or after the 10
  189|       |    // bytes in memory.
  190|  19.4k|    if (offset_ < start) {
  ------------------
  |  Branch (190:9): [True: 18.8k, False: 548]
  ------------------
  191|       |      // Sub-region is before in memory.
  192|  18.8k|      enforce(size_ <= start - offset_, ErrorCode::kerOffsetOutOfRange);
  193|  18.8k|    } else {
  194|       |      // Sub-region is after in memory.
  195|    548|      enforce(offset_ >= start + 10, ErrorCode::kerOffsetOutOfRange);
  196|    548|      enforce(offset_ <= size, ErrorCode::kerOffsetOutOfRange);
  197|    548|      enforce(size_ <= size - offset_, ErrorCode::kerOffsetOutOfRange);
  198|    548|    }
  199|  19.4k|  }
  200|  28.4k|  if (dl == DataLocId::directoryData) {
  ------------------
  |  Branch (200:7): [True: 9.01k, False: 19.4k]
  ------------------
  201|  9.01k|    size_ = 8;
  202|  9.01k|    offset_ = start + 2;
  203|  9.01k|  }
  204|  28.4k|  pData_ = pData + offset_;
  205|       |#ifdef EXIV2_DEBUG_MESSAGES
  206|       |  std::cout << "  Entry for tag 0x" << std::hex << tagId() << " (0x" << tag() << "), " << std::dec << size_
  207|       |            << " Bytes, Offset is " << offset_ << "\n";
  208|       |#endif
  209|       |
  210|  28.4k|}  // CiffComponent::doRead
_ZN5Exiv28Internal13CiffDirectory6doReadEPKhmjNS_9ByteOrderE:
  212|  1.61k|void CiffDirectory::doRead(const byte* pData, size_t size, uint32_t start, ByteOrder byteOrder) {
  213|  1.61k|  CiffComponent::doRead(pData, size, start, byteOrder);
  214|       |#ifdef EXIV2_DEBUG_MESSAGES
  215|       |  std::cout << "Reading directory 0x" << std::hex << tag() << "\n";
  216|       |#endif
  217|  1.61k|  if (this->offset() + this->size() > size)
  ------------------
  |  Branch (217:7): [True: 0, False: 1.61k]
  ------------------
  218|      0|    throw Error(ErrorCode::kerOffsetOutOfRange);
  219|       |
  220|  1.61k|  readDirectory(pData + offset(), this->size(), byteOrder);
  221|       |#ifdef EXIV2_DEBUG_MESSAGES
  222|       |  std::cout << "<---- 0x" << std::hex << tag() << "\n";
  223|       |#endif
  224|  1.61k|}  // CiffDirectory::doRead
_ZN5Exiv28Internal13CiffDirectory13readDirectoryEPKhmNS_9ByteOrderE:
  226|  2.33k|void CiffDirectory::readDirectory(const byte* pData, size_t size, ByteOrder byteOrder) {
  227|  2.33k|  if (size < 4)
  ------------------
  |  Branch (227:7): [True: 16, False: 2.31k]
  ------------------
  228|     16|    throw Error(ErrorCode::kerCorruptedMetadata);
  229|  2.31k|  uint32_t o = getULong(pData + size - 4, byteOrder);
  230|  2.31k|  if (o > size - 2)
  ------------------
  |  Branch (230:7): [True: 42, False: 2.27k]
  ------------------
  231|     42|    throw Error(ErrorCode::kerCorruptedMetadata);
  232|  2.27k|  uint16_t count = getUShort(pData + o, byteOrder);
  233|       |#ifdef EXIV2_DEBUG_MESSAGES
  234|       |  std::cout << "Directory at offset " << std::dec << o << ", " << count << " entries \n";
  235|       |#endif
  236|  2.27k|  o += 2;
  237|  2.27k|  if (count * 10u > size - o)
  ------------------
  |  Branch (237:7): [True: 22, False: 2.25k]
  ------------------
  238|     22|    throw Error(ErrorCode::kerCorruptedMetadata);
  239|       |
  240|  30.7k|  for (uint16_t i = 0; i < count; ++i) {
  ------------------
  |  Branch (240:24): [True: 28.4k, False: 2.25k]
  ------------------
  241|  28.4k|    uint16_t tag = getUShort(pData + o, byteOrder);
  242|  28.4k|    auto m = [this, tag]() -> UniquePtr {
  243|  28.4k|      if (this->typeId(tag) == TypeId::directory)
  244|  28.4k|        return std::make_unique<CiffDirectory>();
  245|  28.4k|      return std::make_unique<CiffEntry>();
  246|  28.4k|    }();
  247|  28.4k|    m->setDir(this->tag());
  248|  28.4k|    m->read(pData, size, o, byteOrder);
  249|  28.4k|    add(std::move(m));
  250|  28.4k|    o += 10;
  251|  28.4k|  }
  252|  2.25k|}  // CiffDirectory::readDirectory
_ZNK5Exiv28Internal10CiffHeader6decodeERNS_5ImageE:
  254|    266|void CiffHeader::decode(Image& image) const {
  255|       |  // Nothing to decode from the header itself, just add correct byte order
  256|    266|  if (pRootDir_)
  ------------------
  |  Branch (256:7): [True: 266, False: 0]
  ------------------
  257|    266|    pRootDir_->decode(image, byteOrder_);
  258|    266|}
_ZNK5Exiv28Internal13CiffComponent6decodeERNS_5ImageENS_9ByteOrderE:
  260|  5.67k|void CiffComponent::decode(Image& image, ByteOrder byteOrder) const {
  261|  5.67k|  doDecode(image, byteOrder);
  262|  5.67k|}
_ZNK5Exiv28Internal9CiffEntry8doDecodeERNS_5ImageENS_9ByteOrderE:
  264|  4.60k|void CiffEntry::doDecode(Image& image, ByteOrder byteOrder) const {
  265|  4.60k|  CrwMap::decode(*this, image, byteOrder);
  266|  4.60k|}  // CiffEntry::doDecode
_ZNK5Exiv28Internal13CiffDirectory8doDecodeERNS_5ImageENS_9ByteOrderE:
  268|  1.07k|void CiffDirectory::doDecode(Image& image, ByteOrder byteOrder) const {
  269|  5.41k|  for (auto&& component : components_) {
  ------------------
  |  Branch (269:25): [True: 5.41k, False: 1.07k]
  ------------------
  270|  5.41k|    component->decode(image, byteOrder);
  271|  5.41k|  }
  272|  1.07k|}  // CiffDirectory::doDecode
_ZNK5Exiv28Internal10CiffHeader5writeERNSt3__16vectorIhNS2_9allocatorIhEEEE:
  274|    175|void CiffHeader::write(Blob& blob) const {
  275|    175|  if (byteOrder_ == littleEndian) {
  ------------------
  |  Branch (275:7): [True: 161, False: 14]
  ------------------
  276|    161|    blob.push_back('I');
  277|    161|    blob.push_back('I');
  278|    161|  } else {
  279|     14|    blob.push_back('M');
  280|     14|    blob.push_back('M');
  281|     14|  }
  282|    175|  uint32_t o = 2;
  283|    175|  byte buf[4];
  284|    175|  ul2Data(buf, offset_, byteOrder_);
  285|    175|  append(blob, buf, 4);
  286|    175|  o += 4;
  287|    175|  append(blob, signature_, 8);
  288|    175|  o += 8;
  289|       |  // Pad as needed
  290|    175|  if (!pPadding_.empty()) {
  ------------------
  |  Branch (290:7): [True: 161, False: 14]
  ------------------
  291|    161|    append(blob, pPadding_.data(), padded_);
  292|    161|  } else {
  293|     14|    for (uint32_t i = o; i < offset_; ++i) {
  ------------------
  |  Branch (293:26): [True: 0, False: 14]
  ------------------
  294|      0|      blob.push_back(0);
  295|      0|      ++o;
  296|      0|    }
  297|     14|  }
  298|    175|  if (pRootDir_) {
  ------------------
  |  Branch (298:7): [True: 175, False: 0]
  ------------------
  299|    175|    pRootDir_->write(blob, byteOrder_, offset_);
  300|    175|  }
  301|    175|}
_ZN5Exiv28Internal13CiffComponent5writeERNSt3__16vectorIhNS2_9allocatorIhEEEENS_9ByteOrderEm:
  303|  5.54k|size_t CiffComponent::write(Blob& blob, ByteOrder byteOrder, size_t offset) {
  304|  5.54k|  return doWrite(blob, byteOrder, offset);
  305|  5.54k|}
_ZN5Exiv28Internal9CiffEntry7doWriteERNSt3__16vectorIhNS2_9allocatorIhEEEENS_9ByteOrderEm:
  307|  4.46k|size_t CiffEntry::doWrite(Blob& blob, ByteOrder /*byteOrder*/, size_t offset) {
  308|  4.46k|  return writeValueData(blob, offset);
  309|  4.46k|}
_ZN5Exiv28Internal13CiffComponent14writeValueDataERNSt3__16vectorIhNS2_9allocatorIhEEEEm:
  311|  4.46k|size_t CiffComponent::writeValueData(Blob& blob, size_t offset) {
  312|  4.46k|  if (dataLocation() == DataLocId::valueData) {
  ------------------
  |  Branch (312:7): [True: 1.02k, False: 3.44k]
  ------------------
  313|       |#ifdef EXIV2_DEBUG_MESSAGES
  314|       |    std::cout << "  Data for tag 0x" << std::hex << tagId() << ", " << std::dec << size_ << " Bytes\n";
  315|       |#endif
  316|  1.02k|    offset_ = offset;
  317|  1.02k|    append(blob, pData_, size_);
  318|  1.02k|    offset += size_;
  319|       |    // Pad the value to an even number of bytes
  320|  1.02k|    if (size_ % 2 == 1) {
  ------------------
  |  Branch (320:9): [True: 114, False: 908]
  ------------------
  321|    114|      blob.push_back(0);
  322|    114|      ++offset;
  323|    114|    }
  324|  1.02k|  }
  325|  4.46k|  return offset;
  326|  4.46k|}
_ZN5Exiv28Internal13CiffDirectory7doWriteERNSt3__16vectorIhNS2_9allocatorIhEEEENS_9ByteOrderEm:
  328|  1.08k|size_t CiffDirectory::doWrite(Blob& blob, ByteOrder byteOrder, size_t offset) {
  329|       |#ifdef EXIV2_DEBUG_MESSAGES
  330|       |  std::cout << "Writing directory 0x" << std::hex << tag() << "---->\n";
  331|       |#endif
  332|       |  // Ciff offsets are relative to the start of the directory
  333|  1.08k|  size_t dirOffset = 0;
  334|       |
  335|       |  // Value data
  336|  5.37k|  for (auto&& component : components_) {
  ------------------
  |  Branch (336:25): [True: 5.37k, False: 1.08k]
  ------------------
  337|  5.37k|    dirOffset = component->write(blob, byteOrder, dirOffset);
  338|  5.37k|  }
  339|  1.08k|  const auto dirStart = static_cast<uint32_t>(dirOffset);
  340|       |
  341|       |  // Number of directory entries
  342|  1.08k|  byte buf[4];
  343|  1.08k|  us2Data(buf, static_cast<uint16_t>(components_.size()), byteOrder);
  344|  1.08k|  append(blob, buf, 2);
  345|  1.08k|  dirOffset += 2;
  346|       |
  347|       |  // Directory entries
  348|  5.37k|  for (auto&& component : components_) {
  ------------------
  |  Branch (348:25): [True: 5.37k, False: 1.08k]
  ------------------
  349|  5.37k|    component->writeDirEntry(blob, byteOrder);
  350|  5.37k|    dirOffset += 10;
  351|  5.37k|  }
  352|       |
  353|       |  // Offset of directory
  354|  1.08k|  ul2Data(buf, dirStart, byteOrder);
  355|  1.08k|  append(blob, buf, 4);
  356|  1.08k|  dirOffset += 4;
  357|       |
  358|       |  // Update directory entry
  359|  1.08k|  setOffset(offset);
  360|  1.08k|  setSize(dirOffset);
  361|       |
  362|       |#ifdef EXIV2_DEBUG_MESSAGES
  363|       |  std::cout << "Directory is at offset " << std::dec << dirStart << ", " << components_.size() << " entries\n"
  364|       |            << "<---- 0x" << std::hex << tag() << "\n";
  365|       |#endif
  366|  1.08k|  return offset + dirOffset;
  367|  1.08k|}  // CiffDirectory::doWrite
_ZNK5Exiv28Internal13CiffComponent13writeDirEntryERNSt3__16vectorIhNS2_9allocatorIhEEEENS_9ByteOrderE:
  369|  5.37k|void CiffComponent::writeDirEntry(Blob& blob, ByteOrder byteOrder) const {
  370|       |#ifdef EXIV2_DEBUG_MESSAGES
  371|       |  std::cout << "  Directory entry for tag 0x" << std::hex << tagId() << " (0x" << tag() << "), " << std::dec << size_
  372|       |            << " Bytes, Offset is " << offset_ << "\n";
  373|       |#endif
  374|  5.37k|  byte buf[4];
  375|       |
  376|  5.37k|  DataLocId dl = dataLocation();
  377|       |
  378|  5.37k|  if (dl == DataLocId::valueData) {
  ------------------
  |  Branch (378:7): [True: 1.69k, False: 3.67k]
  ------------------
  379|  1.69k|    us2Data(buf, tag_, byteOrder);
  380|  1.69k|    append(blob, buf, 2);
  381|       |
  382|  1.69k|    ul2Data(buf, static_cast<uint32_t>(size_), byteOrder);
  383|  1.69k|    append(blob, buf, 4);
  384|       |
  385|  1.69k|    ul2Data(buf, static_cast<uint32_t>(offset_), byteOrder);
  386|  1.69k|    append(blob, buf, 4);
  387|  1.69k|  }
  388|       |
  389|  5.37k|  if (dl == DataLocId::directoryData) {
  ------------------
  |  Branch (389:7): [True: 3.67k, False: 1.69k]
  ------------------
  390|       |    // Only 8 bytes fit in the directory entry
  391|       |
  392|  3.67k|    us2Data(buf, tag_, byteOrder);
  393|  3.67k|    append(blob, buf, 2);
  394|       |    // Copy value instead of size and offset
  395|  3.67k|    append(blob, pData_, size_);
  396|       |    // Pad with 0s
  397|  4.16k|    for (size_t i = size_; i < 8; ++i) {
  ------------------
  |  Branch (397:28): [True: 486, False: 3.67k]
  ------------------
  398|    486|      blob.push_back(0);
  399|    486|    }
  400|  3.67k|  }
  401|  5.37k|}  // CiffComponent::writeDirEntry
_ZN5Exiv28Internal13CiffComponent8setValueEONS_7DataBufE:
  427|    178|void CiffComponent::setValue(DataBuf&& buf) {
  428|    178|  storage_ = std::move(buf);
  429|    178|  pData_ = storage_.c_data();
  430|    178|  size_ = storage_.size();
  431|    178|  if (size_ > 8 && dataLocation() == DataLocId::directoryData) {
  ------------------
  |  Branch (431:7): [True: 50, False: 128]
  |  Branch (431:20): [True: 3, False: 47]
  ------------------
  432|      3|    tag_ &= 0x3fff;
  433|      3|  }
  434|    178|}
_ZN5Exiv28Internal13CiffComponent6typeIdEt:
  436|  29.9k|TypeId CiffComponent::typeId(uint16_t tag) {
  437|  29.9k|  switch (tag & 0x3800) {
  ------------------
  |  Branch (437:11): [True: 29.3k, False: 651]
  ------------------
  438|  17.5k|    case 0x0000:
  ------------------
  |  Branch (438:5): [True: 17.5k, False: 12.3k]
  ------------------
  439|  17.5k|      return unsignedByte;
  440|  2.46k|    case 0x0800:
  ------------------
  |  Branch (440:5): [True: 2.46k, False: 27.5k]
  ------------------
  441|  2.46k|      return asciiString;
  442|  2.80k|    case 0x1000:
  ------------------
  |  Branch (442:5): [True: 2.80k, False: 27.1k]
  ------------------
  443|  2.80k|      return unsignedShort;
  444|  2.46k|    case 0x1800:
  ------------------
  |  Branch (444:5): [True: 2.46k, False: 27.5k]
  ------------------
  445|  2.46k|      return unsignedLong;
  446|  2.39k|    case 0x2000:
  ------------------
  |  Branch (446:5): [True: 2.39k, False: 27.5k]
  ------------------
  447|  2.39k|      return undefined;
  448|    567|    case 0x2800:
  ------------------
  |  Branch (448:5): [True: 567, False: 29.4k]
  ------------------
  449|  1.61k|    case 0x3000:
  ------------------
  |  Branch (449:5): [True: 1.05k, False: 28.9k]
  ------------------
  450|  1.61k|      return directory;
  451|  29.9k|  }
  452|    651|  return invalidTypeId;
  453|  29.9k|}  // CiffComponent::typeId
_ZN5Exiv28Internal13CiffComponent12dataLocationEt:
  455|  38.3k|DataLocId CiffComponent::dataLocation(uint16_t tag) {
  456|  38.3k|  switch (tag & 0xc000) {
  457|  22.1k|    case 0x0000:
  ------------------
  |  Branch (457:5): [True: 22.1k, False: 16.1k]
  ------------------
  458|  22.1k|      return DataLocId::valueData;
  459|  16.1k|    case 0x4000:
  ------------------
  |  Branch (459:5): [True: 16.1k, False: 22.2k]
  ------------------
  460|  16.1k|      return DataLocId::directoryData;
  461|     35|    default:
  ------------------
  |  Branch (461:5): [True: 35, False: 38.3k]
  ------------------
  462|     35|      throw Error(ErrorCode::kerCorruptedMetadata);
  463|  38.3k|  }
  464|  38.3k|}  // CiffComponent::dataLocation
_ZNK5Exiv28Internal10CiffHeader13findComponentEtt:
  471|    622|CiffComponent* CiffHeader::findComponent(uint16_t crwTagId, uint16_t crwDir) const {
  472|    622|  if (!pRootDir_)
  ------------------
  |  Branch (472:7): [True: 0, False: 622]
  ------------------
  473|      0|    return nullptr;
  474|    622|  return pRootDir_->findComponent(crwTagId, crwDir);
  475|    622|}  // CiffHeader::findComponent
_ZN5Exiv28Internal13CiffComponent13findComponentEtt:
  477|  16.3k|CiffComponent* CiffComponent::findComponent(uint16_t crwTagId, uint16_t crwDir) {
  478|  16.3k|  return doFindComponent(crwTagId, crwDir);
  479|  16.3k|}  // CiffComponent::findComponent
_ZN5Exiv28Internal13CiffComponent15doFindComponentEtt:
  481|  13.2k|CiffComponent* CiffComponent::doFindComponent(uint16_t crwTagId, uint16_t crwDir) {
  482|  13.2k|  if (tagId() == crwTagId && dir() == crwDir) {
  ------------------
  |  Branch (482:7): [True: 93, False: 13.1k]
  |  Branch (482:30): [True: 36, False: 57]
  ------------------
  483|     36|    return this;
  484|     36|  }
  485|  13.2k|  return nullptr;
  486|  13.2k|}  // CiffComponent::doFindComponent
_ZN5Exiv28Internal13CiffDirectory15doFindComponentEtt:
  488|  3.09k|CiffComponent* CiffDirectory::doFindComponent(uint16_t crwTagId, uint16_t crwDir) {
  489|  15.7k|  for (auto&& component : components_) {
  ------------------
  |  Branch (489:25): [True: 15.7k, False: 3.04k]
  ------------------
  490|  15.7k|    if (auto cc = component->findComponent(crwTagId, crwDir))
  ------------------
  |  Branch (490:14): [True: 53, False: 15.6k]
  ------------------
  491|     53|      return cc;
  492|  15.7k|  }
  493|  3.04k|  return nullptr;
  494|  3.09k|}  // CiffDirectory::doFindComponent
_ZN5Exiv28Internal10CiffHeader3addEttONS_7DataBufE:
  496|    178|void CiffHeader::add(uint16_t crwTagId, uint16_t crwDir, DataBuf&& buf) {
  497|    178|  CrwDirs crwDirs;
  498|    178|  CrwMap::loadStack(crwDirs, crwDir);
  499|    178|  crwDirs.pop();
  500|    178|  if (!pRootDir_) {
  ------------------
  |  Branch (500:7): [True: 0, False: 178]
  ------------------
  501|      0|    pRootDir_ = std::make_unique<CiffDirectory>();
  502|      0|  }
  503|    178|  if (const auto& child = pRootDir_->add(crwDirs, crwTagId)) {
  ------------------
  |  Branch (503:19): [True: 178, False: 0]
  ------------------
  504|    178|    child->setValue(std::move(buf));
  505|    178|  }
  506|    178|}  // CiffHeader::add
_ZN5Exiv28Internal13CiffComponent3addERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEt:
  508|    514|const CiffComponent::UniquePtr& CiffComponent::add(CrwDirs& crwDirs, uint16_t crwTagId) {
  509|    514|  return doAdd(crwDirs, crwTagId);
  510|    514|}  // CiffComponent::add
_ZN5Exiv28Internal13CiffDirectory5doAddERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEt:
  516|    514|const CiffComponent::UniquePtr& CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
  517|       |  /*
  518|       |    add()
  519|       |      if stack not empty
  520|       |        pop from stack
  521|       |        find dir among components
  522|       |        if not found, create it
  523|       |        add()
  524|       |      else
  525|       |        find tag among components
  526|       |        if not found, create it
  527|       |        set value
  528|       |  */
  529|    514|  if (!crwDirs.empty()) {
  ------------------
  |  Branch (529:7): [True: 336, False: 178]
  ------------------
  530|    336|    auto dir = crwDirs.top();
  531|    336|    crwDirs.pop();
  532|       |    // Find the directory
  533|    336|    for (const auto& c : components_)
  ------------------
  |  Branch (533:24): [True: 1.39k, False: 176]
  ------------------
  534|  1.39k|      if (c->tag() == dir.dir) {
  ------------------
  |  Branch (534:11): [True: 160, False: 1.23k]
  ------------------
  535|       |        // Recursive call to next lower level directory
  536|    160|        return c->add(crwDirs, crwTagId);
  537|    160|      }
  538|       |
  539|       |    // Directory doesn't exist yet, add it
  540|    176|    auto m = std::make_unique<CiffDirectory>(dir.dir, dir.parent);
  541|    176|    return add(std::move(m))->add(crwDirs, crwTagId);
  542|    336|  }
  543|       |
  544|       |  // Find the tag
  545|    178|  for (const auto& c : components_)
  ------------------
  |  Branch (545:22): [True: 189, False: 155]
  ------------------
  546|    189|    if (c->tagId() == crwTagId) {
  ------------------
  |  Branch (546:9): [True: 23, False: 166]
  ------------------
  547|     23|      return c;
  548|     23|    }
  549|       |
  550|       |  // Tag doesn't exist yet, add it
  551|    155|  auto m = std::make_unique<CiffEntry>(crwTagId, tag());
  552|    155|  return add(std::move(m));
  553|    178|}  // CiffDirectory::doAdd
_ZNK5Exiv28Internal10CiffHeader6removeEtt:
  555|  4.25k|void CiffHeader::remove(uint16_t crwTagId, uint16_t crwDir) const {
  556|  4.25k|  if (pRootDir_) {
  ------------------
  |  Branch (556:7): [True: 4.25k, False: 0]
  ------------------
  557|  4.25k|    CrwDirs crwDirs;
  558|  4.25k|    CrwMap::loadStack(crwDirs, crwDir);
  559|  4.25k|    crwDirs.pop();
  560|  4.25k|    pRootDir_->remove(crwDirs, crwTagId);
  561|  4.25k|  }
  562|  4.25k|}  // CiffHeader::remove
_ZN5Exiv28Internal13CiffComponent6removeERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEt:
  564|  6.72k|void CiffComponent::remove(CrwDirs& crwDirs, uint16_t crwTagId) {
  565|  6.72k|  doRemove(crwDirs, crwTagId);
  566|  6.72k|}  // CiffComponent::remove
_ZN5Exiv28Internal13CiffDirectory8doRemoveERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEt:
  572|  6.72k|void CiffDirectory::doRemove(CrwDirs& crwDirs, uint16_t crwTagId) {
  573|  6.72k|  if (!crwDirs.empty()) {
  ------------------
  |  Branch (573:7): [True: 5.78k, False: 937]
  ------------------
  574|  5.78k|    auto dir = crwDirs.top();
  575|  5.78k|    crwDirs.pop();
  576|       |    // Find the directory
  577|  5.78k|    auto it = std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == dir.dir; });
  578|  5.78k|    if (it != components_.end()) {
  ------------------
  |  Branch (578:9): [True: 2.46k, False: 3.32k]
  ------------------
  579|       |      // Recursive call to next lower level directory
  580|  2.46k|      (*it)->remove(crwDirs, crwTagId);
  581|  2.46k|      if ((*it)->empty())
  ------------------
  |  Branch (581:11): [True: 17, False: 2.44k]
  ------------------
  582|     17|        components_.erase(it);
  583|  2.46k|    }
  584|  5.78k|  } else {
  585|       |    // Find the tag
  586|    937|    auto it = std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == crwTagId; });
  587|    937|    if (it != components_.end()) {
  ------------------
  |  Branch (587:9): [True: 12, False: 925]
  ------------------
  588|     12|      components_.erase(it);
  589|     12|    }
  590|    937|  }
  591|  6.72k|}  // CiffDirectory::doRemove
_ZNK5Exiv28Internal13CiffComponent5emptyEv:
  593|  2.46k|bool CiffComponent::empty() const {
  594|  2.46k|  return doEmpty();
  595|  2.46k|}
_ZNK5Exiv28Internal13CiffDirectory7doEmptyEv:
  601|  2.46k|bool CiffDirectory::doEmpty() const {
  602|  2.46k|  return components_.empty();
  603|  2.46k|}
_ZN5Exiv28Internal6CrwMap6decodeERKNS0_13CiffComponentERNS_5ImageENS_9ByteOrderE:
  605|  4.60k|void CrwMap::decode(const CiffComponent& ciffComponent, Image& image, ByteOrder byteOrder) {
  606|  4.60k|  const CrwMapping* cmi = crwMapping(ciffComponent.dir(), ciffComponent.tagId());
  607|  4.60k|  if (cmi && cmi->toExif_) {
  ------------------
  |  Branch (607:7): [True: 866, False: 3.74k]
  |  Branch (607:14): [True: 866, False: 0]
  ------------------
  608|    866|    cmi->toExif_(ciffComponent, cmi, image, byteOrder);
  609|    866|  }
  610|  4.60k|}  // CrwMap::decode
_ZN5Exiv28Internal6CrwMap10crwMappingEtt:
  612|  4.60k|const CrwMapping* CrwMap::crwMapping(uint16_t crwDir, uint16_t crwTagId) {
  613|  89.6k|  for (auto&& crw : crwMapping_) {
  ------------------
  |  Branch (613:19): [True: 89.6k, False: 3.74k]
  ------------------
  614|  89.6k|    if (crw.crwDir_ == crwDir && crw.crwTagId_ == crwTagId) {
  ------------------
  |  Branch (614:9): [True: 14.1k, False: 75.5k]
  |  Branch (614:34): [True: 866, False: 13.2k]
  ------------------
  615|    866|      return &crw;
  616|    866|    }
  617|  89.6k|  }
  618|  3.74k|  return nullptr;
  619|  4.60k|}  // CrwMap::crwMapping
_ZN5Exiv28Internal6CrwMap12decode0x0805ERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  622|     20|                          ByteOrder /*byteOrder*/) {
  623|     20|  auto s = std::string(reinterpret_cast<const char*>(ciffComponent.pData()), ciffComponent.size());
  624|     20|  image.setComment(s);
  625|     20|}  // CrwMap::decode0x0805
_ZN5Exiv28Internal6CrwMap12decode0x080aERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  628|    132|                          ByteOrder byteOrder) {
  629|    132|  if (ciffComponent.typeId() != asciiString)
  ------------------
  |  Branch (629:7): [True: 0, False: 132]
  ------------------
  630|      0|    return;
  631|       |
  632|       |  // Make
  633|    132|  ExifKey key1("Exif.Image.Make");
  634|    132|  auto value1 = Value::create(ciffComponent.typeId());
  635|    132|  uint32_t i = 0;
  636|    626|  while (i < ciffComponent.size()) {
  ------------------
  |  Branch (636:10): [True: 580, False: 46]
  ------------------
  637|    580|    ++i;
  638|    580|    if (ciffComponent.pData()[i - 1] == '\0') {
  ------------------
  |  Branch (638:9): [True: 86, False: 494]
  ------------------
  639|     86|      break;
  640|     86|    }
  641|    580|  }
  642|    132|  value1->read(ciffComponent.pData(), i, byteOrder);
  643|    132|  image.exifData().add(key1, value1.get());
  644|       |
  645|       |  // Model
  646|    132|  ExifKey key2("Exif.Image.Model");
  647|    132|  auto value2 = Value::create(ciffComponent.typeId());
  648|    132|  uint32_t j = i;
  649|    392|  while (i < ciffComponent.size()) {
  ------------------
  |  Branch (649:10): [True: 325, False: 67]
  ------------------
  650|    325|    ++i;
  651|    325|    if (ciffComponent.pData()[i - 1] == '\0') {
  ------------------
  |  Branch (651:9): [True: 65, False: 260]
  ------------------
  652|     65|      break;
  653|     65|    }
  654|    325|  }
  655|    132|  value2->read(ciffComponent.pData() + j, i - j, byteOrder);
  656|    132|  image.exifData().add(key2, value2.get());
  657|    132|}  // CrwMap::decode0x080a
_ZN5Exiv28Internal6CrwMap11decodeArrayERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  660|    404|                         ByteOrder byteOrder) {
  661|    404|  if (ciffComponent.typeId() != unsignedShort) {
  ------------------
  |  Branch (661:7): [True: 0, False: 404]
  ------------------
  662|      0|    decodeBasic(ciffComponent, pCrwMapping, image, byteOrder);
  663|      0|    return;
  664|      0|  }
  665|       |
  666|    404|  int64_t aperture = 0;
  667|    404|  int64_t shutterSpeed = 0;
  668|       |
  669|    404|  auto ifdId = [pCrwMapping] {
  670|    404|    if (pCrwMapping->tag_ == 0x0001)
  671|    404|      return IfdId::canonCsId;
  672|    404|    if (pCrwMapping->tag_ == 0x0004)
  673|    404|      return IfdId::canonSiId;
  674|    404|    if (pCrwMapping->tag_ == 0x000f)
  675|    404|      return IfdId::canonCfId;
  676|    404|    if (pCrwMapping->tag_ == 0x0012)
  677|    404|      return IfdId::canonPiId;
  678|    404|    return IfdId::ifdIdNotSet;
  679|    404|  }();
  680|       |
  681|    404|  std::string groupName(Internal::groupName(ifdId));
  682|    404|  const size_t component_size = ciffComponent.size();
  683|    404|  enforce(component_size % 2 == 0, ErrorCode::kerCorruptedMetadata);
  684|    404|  enforce(component_size / 2 <= static_cast<size_t>(std::numeric_limits<uint16_t>::max()),
  685|    404|          ErrorCode::kerCorruptedMetadata);
  686|    404|  const auto num_components = static_cast<uint16_t>(component_size / 2);
  687|    404|  uint16_t c = 1;
  688|  4.83k|  while (c < num_components) {
  ------------------
  |  Branch (688:10): [True: 4.42k, False: 404]
  ------------------
  689|  4.42k|    uint16_t n = 1;
  690|  4.42k|    ExifKey key(c, groupName);
  691|  4.42k|    UShortValue value;
  692|  4.42k|    if (ifdId == IfdId::canonCsId && c == 23 && component_size >= 52)
  ------------------
  |  Branch (692:9): [True: 761, False: 3.66k]
  |  Branch (692:38): [True: 19, False: 742]
  |  Branch (692:49): [True: 11, False: 8]
  ------------------
  693|     11|      n = 3;
  694|  4.42k|    value.read(ciffComponent.pData() + (c * 2), n * 2, byteOrder);
  695|  4.42k|    image.exifData().add(key, &value);
  696|  4.42k|    if (ifdId == IfdId::canonSiId && c == 21)
  ------------------
  |  Branch (696:9): [True: 2.97k, False: 1.45k]
  |  Branch (696:38): [True: 105, False: 2.87k]
  ------------------
  697|    105|      aperture = value.toInt64();
  698|  4.42k|    if (ifdId == IfdId::canonSiId && c == 22)
  ------------------
  |  Branch (698:9): [True: 2.97k, False: 1.45k]
  |  Branch (698:38): [True: 105, False: 2.87k]
  ------------------
  699|    105|      shutterSpeed = value.toInt64();
  700|  4.42k|    c += n;
  701|  4.42k|  }
  702|       |
  703|    404|  if (ifdId == IfdId::canonSiId) {
  ------------------
  |  Branch (703:7): [True: 196, False: 208]
  ------------------
  704|       |    // Exif.Photo.FNumber
  705|    196|    float f = fnumber(canonEv(aperture));
  706|    196|    auto [r, s] = floatToRationalCast(f);
  707|    196|    auto ur = URational(r, s);
  708|    196|    URationalValue fn;
  709|    196|    fn.value_.push_back(ur);
  710|    196|    image.exifData().add(ExifKey("Exif.Photo.FNumber"), &fn);
  711|       |
  712|       |    // Exif.Photo.ExposureTime
  713|    196|    ur = exposureTime(canonEv(shutterSpeed));
  714|    196|    URationalValue et;
  715|    196|    et.value_.push_back(ur);
  716|    196|    image.exifData().add(ExifKey("Exif.Photo.ExposureTime"), &et);
  717|    196|  }
  718|    404|}  // CrwMap::decodeArray
_ZN5Exiv28Internal6CrwMap12decode0x180eERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  721|     15|                          ByteOrder byteOrder) {
  722|     15|  if (ciffComponent.size() < 8 || ciffComponent.typeId() != unsignedLong) {
  ------------------
  |  Branch (722:7): [True: 9, False: 6]
  |  Branch (722:35): [True: 0, False: 6]
  ------------------
  723|      9|    decodeBasic(ciffComponent, pCrwMapping, image, byteOrder);
  724|      9|    return;
  725|      9|  }
  726|      6|  ULongValue v;
  727|      6|  v.read(ciffComponent.pData(), 8, byteOrder);
  728|      6|  time_t t = v.value_.at(0);
  729|      6|  std::tm r;
  730|       |#ifdef _WIN32
  731|       |  auto tm = localtime_s(&r, &t) ? nullptr : &r;
  732|       |#else
  733|      6|  auto tm = localtime_r(&t, &r);
  734|      6|#endif
  735|      6|  if (!tm)
  ------------------
  |  Branch (735:7): [True: 0, False: 6]
  ------------------
  736|      0|    return;
  737|      6|  const size_t m = 20;
  738|      6|  char s[m];
  739|      6|  std::strftime(s, m, "%Y:%m:%d %T", tm);
  740|       |
  741|      6|  ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_));
  742|      6|  AsciiValue value;
  743|      6|  value.read(s);
  744|      6|  image.exifData().add(key, &value);
  745|      6|}  // CrwMap::decode0x180e
_ZN5Exiv28Internal6CrwMap12decode0x1810ERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  748|     13|                          ByteOrder byteOrder) {
  749|     13|  if (ciffComponent.typeId() != unsignedLong || ciffComponent.size() < 28) {
  ------------------
  |  Branch (749:7): [True: 0, False: 13]
  |  Branch (749:49): [True: 13, False: 0]
  ------------------
  750|     13|    decodeBasic(ciffComponent, pCrwMapping, image, byteOrder);
  751|     13|    return;
  752|     13|  }
  753|       |
  754|      0|  ExifKey key1("Exif.Photo.PixelXDimension");
  755|      0|  ULongValue value1;
  756|      0|  value1.read(ciffComponent.pData(), 4, byteOrder);
  757|      0|  image.exifData().add(key1, &value1);
  758|       |
  759|      0|  ExifKey key2("Exif.Photo.PixelYDimension");
  760|      0|  ULongValue value2;
  761|      0|  value2.read(ciffComponent.pData() + 4, 4, byteOrder);
  762|      0|  image.exifData().add(key2, &value2);
  763|       |
  764|      0|  int32_t r = getLong(ciffComponent.pData() + 12, byteOrder);
  765|      0|  uint16_t o = RotationMap::orientation(r);
  766|      0|  image.exifData()["Exif.Image.Orientation"] = o;
  767|       |
  768|      0|}  // CrwMap::decode0x1810
_ZN5Exiv28Internal6CrwMap12decode0x2008ERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  771|     67|                          ByteOrder /*byteOrder*/) {
  772|     67|  ExifThumb exifThumb(image.exifData());
  773|     67|  exifThumb.setJpegThumbnail(ciffComponent.pData(), ciffComponent.size());
  774|     67|}  // CrwMap::decode0x2008
_ZN5Exiv28Internal6CrwMap11decodeBasicERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderE:
  777|    237|                         ByteOrder byteOrder) {
  778|       |  // create a key and value pair
  779|    237|  ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_));
  780|    237|  Value::UniquePtr value;
  781|    237|  if (ciffComponent.typeId() != directory) {
  ------------------
  |  Branch (781:7): [True: 237, False: 0]
  ------------------
  782|    237|    value = Value::create(ciffComponent.typeId());
  783|    237|    size_t size = 0;
  784|    237|    if (pCrwMapping->size_ != 0) {
  ------------------
  |  Branch (784:9): [True: 8, False: 229]
  ------------------
  785|      8|      size = pCrwMapping->size_;  // size in the mapping table overrides all
  786|    229|    } else if (ciffComponent.typeId() == asciiString) {
  ------------------
  |  Branch (786:16): [True: 112, False: 117]
  ------------------
  787|       |      // determine size from the data, by looking for the first 0
  788|    112|      uint32_t i = 0;
  789|    837|      while (i < ciffComponent.size()) {
  ------------------
  |  Branch (789:14): [True: 784, False: 53]
  ------------------
  790|    784|        ++i;
  791|    784|        if (ciffComponent.pData()[i - 1] == '\0') {
  ------------------
  |  Branch (791:13): [True: 59, False: 725]
  ------------------
  792|     59|          break;
  793|     59|        }
  794|    784|      }
  795|    112|      size = i;
  796|    117|    } else {
  797|       |      // by default, use the size from the directory entry
  798|    117|      size = ciffComponent.size();
  799|    117|    }
  800|    237|    enforce(size <= ciffComponent.size(), ErrorCode::kerCorruptedMetadata);
  801|    237|    value->read(ciffComponent.pData(), size, byteOrder);
  802|    237|  }
  803|       |  // Add metadatum to exif data
  804|    237|  image.exifData().add(key, value.get());
  805|    237|}  // CrwMap::decodeBasic
_ZN5Exiv28Internal6CrwMap9loadStackERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEt:
  807|  4.43k|void CrwMap::loadStack(CrwDirs& crwDirs, uint16_t crwDir) {
  808|  35.4k|  for (auto&& crw : crwSubDir_) {
  ------------------
  |  Branch (808:19): [True: 35.4k, False: 4.43k]
  ------------------
  809|  35.4k|    auto&& [dir, parent] = crw;
  810|  35.4k|    if (dir == crwDir) {
  ------------------
  |  Branch (810:9): [True: 12.7k, False: 22.7k]
  ------------------
  811|  12.7k|      crwDirs.push(crw);
  812|  12.7k|      crwDir = parent;
  813|  12.7k|    }
  814|  35.4k|  }
  815|  4.43k|}  // CrwMap::loadStack
_ZN5Exiv28Internal6CrwMap6encodeERNS0_10CiffHeaderERKNS_5ImageE:
  817|    182|void CrwMap::encode(CiffHeader& pHead, const Image& image) {
  818|  3.98k|  for (auto&& crw : crwMapping_) {
  ------------------
  |  Branch (818:19): [True: 3.98k, False: 182]
  ------------------
  819|  3.98k|    if (crw.fromExif_) {
  ------------------
  |  Branch (819:9): [True: 3.98k, False: 0]
  ------------------
  820|  3.98k|      crw.fromExif_(image, crw, pHead);
  821|  3.98k|    }
  822|  3.98k|  }
  823|    182|}  // CrwMap::encode
_ZN5Exiv28Internal6CrwMap11encodeBasicERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  825|  2.98k|void CrwMap::encodeBasic(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  826|       |  // Determine the source Exif metadatum
  827|  2.98k|  ExifKey ek(pCrwMapping.tag_, Internal::groupName(pCrwMapping.ifdId_));
  828|  2.98k|  auto ed = image.exifData().findKey(ek);
  829|       |
  830|       |  // Set the new value or remove the entry
  831|  2.98k|  if (ed != image.exifData().end() && ed->size() > 0) {
  ------------------
  |  Branch (831:7): [True: 56, False: 2.92k]
  |  Branch (831:7): [True: 44, False: 2.93k]
  |  Branch (831:39): [True: 44, False: 12]
  ------------------
  832|     44|    DataBuf buf(ed->size());
  833|     44|    ed->copy(buf.data(), pHead.byteOrder());
  834|     44|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  835|  2.93k|  } else {
  836|  2.93k|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  837|  2.93k|  }
  838|  2.98k|}  // CrwMap::encodeBasic
_ZN5Exiv28Internal6CrwMap12encode0x0805ERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  840|    182|void CrwMap::encode0x0805(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  841|    182|  std::string comment = image.comment();
  842|       |
  843|    182|  auto cc = pHead.findComponent(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  844|    182|  if (!comment.empty()) {
  ------------------
  |  Branch (844:7): [True: 10, False: 172]
  ------------------
  845|     10|    auto size = comment.size();
  846|     10|    if (cc && cc->size() > size)
  ------------------
  |  Branch (846:9): [True: 10, False: 0]
  |  Branch (846:15): [True: 0, False: 10]
  ------------------
  847|      0|      size = cc->size();
  848|     10|    DataBuf buf(size);
  849|     10|    std::move(comment.begin(), comment.end(), buf.begin());
  850|     10|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  851|    172|  } else {
  852|    172|    if (cc) {
  ------------------
  |  Branch (852:9): [True: 0, False: 172]
  ------------------
  853|       |      // Just delete the value, do not remove the tag
  854|      0|      DataBuf buf(cc->size());
  855|      0|      cc->setValue(std::move(buf));
  856|      0|    }
  857|    172|  }
  858|    182|}  // CrwMap::encode0x0805
_ZN5Exiv28Internal6CrwMap12encode0x080aERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  860|    182|void CrwMap::encode0x080a(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  861|    182|  const ExifKey k1("Exif.Image.Make");
  862|    182|  const ExifKey k2("Exif.Image.Model");
  863|    182|  const auto ed1 = image.exifData().findKey(k1);
  864|    182|  const auto ed2 = image.exifData().findKey(k2);
  865|    182|  const auto edEnd = image.exifData().end();
  866|       |
  867|    182|  size_t size{0};
  868|    182|  if (ed1 != edEnd)
  ------------------
  |  Branch (868:7): [True: 16, False: 166]
  ------------------
  869|     16|    size += ed1->size();
  870|    182|  if (ed2 != edEnd)
  ------------------
  |  Branch (870:7): [True: 16, False: 166]
  ------------------
  871|     16|    size += ed2->size();
  872|    182|  if (size != 0) {
  ------------------
  |  Branch (872:7): [True: 16, False: 166]
  ------------------
  873|     16|    DataBuf buf(size);
  874|     16|    size_t pos{0};
  875|     16|    if (ed1 != edEnd) {
  ------------------
  |  Branch (875:9): [True: 16, False: 0]
  ------------------
  876|     16|      ed1->copy(buf.data(), pHead.byteOrder());
  877|     16|      pos += ed1->size();
  878|     16|    }
  879|     16|    if (ed2 != edEnd) {
  ------------------
  |  Branch (879:9): [True: 16, False: 0]
  ------------------
  880|     16|      ed2->copy(buf.data(pos), pHead.byteOrder());
  881|     16|      pos += ed2->size();
  882|     16|    }
  883|     16|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  884|    166|  } else {
  885|    166|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  886|    166|  }
  887|    182|}
_ZN5Exiv28Internal6CrwMap11encodeArrayERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  889|    728|void CrwMap::encodeArray(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  890|    728|  auto ifdId = [=] {
  891|    728|    switch (pCrwMapping.tag_) {
  892|    728|      case 0x0001:
  893|    728|        return IfdId::canonCsId;
  894|    728|      case 0x0004:
  895|    728|        return IfdId::canonSiId;
  896|    728|      case 0x000f:
  897|    728|        return IfdId::canonCfId;
  898|    728|      case 0x0012:
  899|    728|        return IfdId::canonPiId;
  900|    728|    }
  901|    728|    return IfdId::ifdIdNotSet;
  902|    728|  }();
  903|    728|  DataBuf buf = packIfdId(image.exifData(), ifdId, pHead.byteOrder());
  904|    728|  if (buf.empty()) {
  ------------------
  |  Branch (904:7): [True: 631, False: 97]
  ------------------
  905|       |    // Try the undecoded tag
  906|    631|    encodeBasic(image, pCrwMapping, pHead);
  907|    631|  }
  908|    728|  if (!buf.empty()) {
  ------------------
  |  Branch (908:7): [True: 97, False: 631]
  ------------------
  909|       |    // Write the number of shorts to the beginning of buf
  910|     97|    buf.write_uint16(0, static_cast<uint16_t>(buf.size()), pHead.byteOrder());
  911|     97|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  912|    631|  } else {
  913|    631|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  914|    631|  }
  915|    728|}  // CrwMap::encodeArray
_ZN5Exiv28Internal6CrwMap12encode0x180eERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  917|    182|void CrwMap::encode0x180e(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  918|    182|  time_t t = 0;
  919|    182|  const ExifKey key(pCrwMapping.tag_, Internal::groupName(pCrwMapping.ifdId_));
  920|    182|  if (auto ed = image.exifData().findKey(key); ed != image.exifData().end()) {
  ------------------
  |  Branch (920:48): [True: 6, False: 176]
  ------------------
  921|      6|    std::tm tm = {};
  922|      6|    if (exifTime(ed->toString().c_str(), &tm) == 0) {
  ------------------
  |  Branch (922:9): [True: 3, False: 3]
  ------------------
  923|      3|      t = ::mktime(&tm);
  924|      3|    }
  925|      6|  }
  926|    182|  if (t != 0) {
  ------------------
  |  Branch (926:7): [True: 3, False: 179]
  ------------------
  927|      3|    DataBuf buf(12);
  928|      3|    buf.write_uint32(0, static_cast<uint32_t>(t), pHead.byteOrder());
  929|      3|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  930|    179|  } else {
  931|    179|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  932|    179|  }
  933|    182|}  // CrwMap::encode0x180e
_ZN5Exiv28Internal6CrwMap12encode0x1810ERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  935|    182|void CrwMap::encode0x1810(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  936|    182|  const ExifKey kX("Exif.Photo.PixelXDimension");
  937|    182|  const ExifKey kY("Exif.Photo.PixelYDimension");
  938|    182|  const ExifKey kO("Exif.Image.Orientation");
  939|    182|  const ExifData& exivData = image.exifData();
  940|    182|  const auto edX = exivData.findKey(kX);
  941|    182|  const auto edY = exivData.findKey(kY);
  942|    182|  const auto edO = exivData.findKey(kO);
  943|    182|  const auto edEnd = exivData.end();
  944|       |
  945|    182|  auto cc = pHead.findComponent(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  946|    182|  if (edX != edEnd || edY != edEnd || edO != edEnd) {
  ------------------
  |  Branch (946:7): [True: 7, False: 175]
  |  Branch (946:23): [True: 0, False: 175]
  |  Branch (946:39): [True: 0, False: 175]
  ------------------
  947|      7|    size_t size = 28;
  948|      7|    if (cc) {
  ------------------
  |  Branch (948:9): [True: 7, False: 0]
  ------------------
  949|      7|      if (cc->size() < size)
  ------------------
  |  Branch (949:11): [True: 7, False: 0]
  ------------------
  950|      7|        throw Error(ErrorCode::kerCorruptedMetadata);
  951|      0|      size = cc->size();
  952|      0|    }
  953|      0|    DataBuf buf(size);
  954|      0|    if (cc)
  ------------------
  |  Branch (954:9): [True: 0, False: 0]
  ------------------
  955|      0|      std::copy_n(cc->pData() + 8, cc->size() - 8, buf.begin() + 8);
  956|      0|    if (edX != edEnd && edX->size() == 4) {
  ------------------
  |  Branch (956:9): [True: 0, False: 0]
  |  Branch (956:25): [True: 0, False: 0]
  ------------------
  957|      0|      edX->copy(buf.data(), pHead.byteOrder());
  958|      0|    }
  959|      0|    if (edY != edEnd && edY->size() == 4) {
  ------------------
  |  Branch (959:9): [True: 0, False: 0]
  |  Branch (959:25): [True: 0, False: 0]
  ------------------
  960|      0|      edY->copy(buf.data(4), pHead.byteOrder());
  961|      0|    }
  962|      0|    int32_t d = 0;
  963|      0|    if (edO != edEnd && edO->count() > 0 && edO->typeId() == unsignedShort) {
  ------------------
  |  Branch (963:9): [True: 0, False: 0]
  |  Branch (963:25): [True: 0, False: 0]
  |  Branch (963:45): [True: 0, False: 0]
  ------------------
  964|      0|      d = RotationMap::degrees(static_cast<uint16_t>(edO->toInt64()));
  965|      0|    }
  966|      0|    buf.write_uint32(12, d, pHead.byteOrder());
  967|      0|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  968|    175|  } else {
  969|    175|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  970|    175|  }
  971|    182|}  // CrwMap::encode0x1810
_ZN5Exiv28Internal6CrwMap12encode0x2008ERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderE:
  973|    175|void CrwMap::encode0x2008(const Image& image, const CrwMapping& pCrwMapping, CiffHeader& pHead) {
  974|    175|  ExifThumbC exifThumb(image.exifData());
  975|    175|  DataBuf buf = exifThumb.copy();
  976|    175|  if (!buf.empty()) {
  ------------------
  |  Branch (976:7): [True: 8, False: 167]
  ------------------
  977|      8|    pHead.add(pCrwMapping.crwTagId_, pCrwMapping.crwDir_, std::move(buf));
  978|    167|  } else {
  979|    167|    pHead.remove(pCrwMapping.crwTagId_, pCrwMapping.crwDir_);
  980|    167|  }
  981|    175|}  // CrwMap::encode0x2008
_ZN5Exiv28Internal9packIfdIdERKNS_8ExifDataENS_5IfdIdENS_9ByteOrderE:
  985|    728|DataBuf packIfdId(const ExifData& exifData, IfdId ifdId, ByteOrder byteOrder) {
  986|    728|  const uint16_t size = 1024;
  987|    728|  DataBuf buf(size);
  988|       |
  989|    728|  uint16_t len = 0;
  990|       |
  991|  20.9k|  for (auto&& exif : exifData) {
  ------------------
  |  Branch (991:20): [True: 20.9k, False: 728]
  ------------------
  992|  20.9k|    if (exif.ifdId() != ifdId)
  ------------------
  |  Branch (992:9): [True: 16.6k, False: 4.29k]
  ------------------
  993|  16.6k|      continue;
  994|  4.29k|    const size_t s = Safe::add<size_t>(exif.tag() * 2, exif.size());
  995|  4.29k|    enforce(s <= static_cast<size_t>(std::numeric_limits<uint16_t>::max()), ErrorCode::kerCorruptedMetadata);
  996|  4.29k|    if (s <= size) {
  ------------------
  |  Branch (996:9): [True: 4.29k, False: 0]
  ------------------
  997|  4.29k|      len = std::max(len, static_cast<uint16_t>(s));
  998|  4.29k|      exif.copy(buf.data(exif.tag() * 2), byteOrder);
  999|  4.29k|    } else {
 1000|      0|      EXV_ERROR << "packIfdId out-of-bounds error: s = " << std::dec << s << "\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
 1001|      0|    }
 1002|  4.29k|  }
 1003|       |  // Round the size to make it even.
 1004|    728|  buf.resize(len + (len % 2));
 1005|    728|  return buf;
 1006|    728|}
crwimage_int.cpp:_ZZN5Exiv28Internal13CiffDirectory13readDirectoryEPKhmNS_9ByteOrderEENK3$_0clEv:
  242|  28.4k|    auto m = [this, tag]() -> UniquePtr {
  243|  28.4k|      if (this->typeId(tag) == TypeId::directory)
  ------------------
  |  Branch (243:11): [True: 1.61k, False: 26.8k]
  ------------------
  244|  1.61k|        return std::make_unique<CiffDirectory>();
  245|  26.8k|      return std::make_unique<CiffEntry>();
  246|  28.4k|    }();
crwimage_int.cpp:_ZZN5Exiv28Internal13CiffDirectory8doRemoveERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEtENK3$_0clINS2_10unique_ptrINS0_13CiffComponentENS2_14default_deleteISE_EEEEEEDaRKT_:
  577|  34.5k|    auto it = std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == dir.dir; });
crwimage_int.cpp:_ZZN5Exiv28Internal13CiffDirectory8doRemoveERNSt3__15stackINS0_9CrwSubDirENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEtENK3$_1clINS2_10unique_ptrINS0_13CiffComponentENS2_14default_deleteISE_EEEEEEDaRKT_:
  586|  2.75k|    auto it = std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == crwTagId; });
crwimage_int.cpp:_ZZN5Exiv28Internal6CrwMap11decodeArrayERKNS0_13CiffComponentEPKNS0_10CrwMappingERNS_5ImageENS_9ByteOrderEENK3$_0clEv:
  669|    404|  auto ifdId = [pCrwMapping] {
  670|    404|    if (pCrwMapping->tag_ == 0x0001)
  ------------------
  |  Branch (670:9): [True: 136, False: 268]
  ------------------
  671|    136|      return IfdId::canonCsId;
  672|    268|    if (pCrwMapping->tag_ == 0x0004)
  ------------------
  |  Branch (672:9): [True: 202, False: 66]
  ------------------
  673|    202|      return IfdId::canonSiId;
  674|     66|    if (pCrwMapping->tag_ == 0x000f)
  ------------------
  |  Branch (674:9): [True: 34, False: 32]
  ------------------
  675|     34|      return IfdId::canonCfId;
  676|     32|    if (pCrwMapping->tag_ == 0x0012)
  ------------------
  |  Branch (676:9): [True: 32, False: 0]
  ------------------
  677|     32|      return IfdId::canonPiId;
  678|      0|    return IfdId::ifdIdNotSet;
  679|     32|  }();
crwimage_int.cpp:_ZZN5Exiv28Internal6CrwMap11encodeArrayERKNS_5ImageERKNS0_10CrwMappingERNS0_10CiffHeaderEENK3$_0clEv:
  890|    728|  auto ifdId = [=] {
  891|    728|    switch (pCrwMapping.tag_) {
  ------------------
  |  Branch (891:13): [True: 728, False: 0]
  ------------------
  892|    182|      case 0x0001:
  ------------------
  |  Branch (892:7): [True: 182, False: 546]
  ------------------
  893|    182|        return IfdId::canonCsId;
  894|    182|      case 0x0004:
  ------------------
  |  Branch (894:7): [True: 182, False: 546]
  ------------------
  895|    182|        return IfdId::canonSiId;
  896|    182|      case 0x000f:
  ------------------
  |  Branch (896:7): [True: 182, False: 546]
  ------------------
  897|    182|        return IfdId::canonCfId;
  898|    182|      case 0x0012:
  ------------------
  |  Branch (898:7): [True: 182, False: 546]
  ------------------
  899|    182|        return IfdId::canonPiId;
  900|    728|    }
  901|      0|    return IfdId::ifdIdNotSet;
  902|    728|  }();

_ZNK5Exiv28Internal13CiffComponent5pDataEv:
  213|  6.72k|  [[nodiscard]] const byte* pData() const {
  214|  6.72k|    return pData_;
  215|  6.72k|  }
_ZNK5Exiv28Internal13CiffComponent4sizeEv:
  203|  5.98k|  [[nodiscard]] size_t size() const {
  204|  5.98k|    return size_;
  205|  5.98k|  }
_ZN5Exiv28Internal10CiffHeader9signatureEv:
  418|  14.7k|  static auto signature() {
  419|  14.7k|    return signature_;
  420|  14.7k|  }
_ZN5Exiv28Internal13CiffComponent6setDirEt:
  146|  28.4k|  void setDir(uint16_t dir) {
  147|  28.4k|    dir_ = dir;
  148|  28.4k|  }
_ZNK5Exiv28Internal13CiffComponent3dirEv:
  183|  4.69k|  [[nodiscard]] uint16_t dir() const {
  184|  4.69k|    return dir_;
  185|  4.69k|  }
_ZNK5Exiv28Internal13CiffComponent3tagEv:
  188|  67.3k|  [[nodiscard]] uint16_t tag() const {
  189|  67.3k|    return tag_;
  190|  67.3k|  }
_ZNK5Exiv28Internal13CiffComponent6offsetEv:
  208|  3.22k|  [[nodiscard]] size_t offset() const {
  209|  3.22k|    return offset_;
  210|  3.22k|  }
_ZNK5Exiv28Internal13CiffComponent5tagIdEv:
  218|  18.0k|  [[nodiscard]] uint16_t tagId() const {
  219|  18.0k|    return tag_ & 0x3fff;
  220|  18.0k|  }
_ZNK5Exiv28Internal13CiffComponent6typeIdEv:
  223|  1.52k|  [[nodiscard]] TypeId typeId() const {
  224|  1.52k|    return typeId(tag_);
  225|  1.52k|  }
_ZNK5Exiv28Internal13CiffComponent12dataLocationEv:
  228|  38.3k|  [[nodiscard]] DataLocId dataLocation() const {
  229|  38.3k|    return dataLocation(tag_);
  230|  38.3k|  }
_ZN5Exiv28Internal13CiffComponent7setSizeEm:
  253|  1.08k|  void setSize(size_t size) {
  254|  1.08k|    size_ = size;
  255|  1.08k|  }
_ZN5Exiv28Internal13CiffComponent9setOffsetEm:
  257|  1.08k|  void setOffset(size_t offset) {
  258|  1.08k|    offset_ = offset;
  259|  1.08k|  }
_ZNK5Exiv28Internal10CiffHeader9byteOrderEv:
  444|    904|  [[nodiscard]] ByteOrder byteOrder() const {
  445|    904|    return byteOrder_;
  446|    904|  }
_ZN5Exiv28Internal13CiffComponentC2Ev:
   71|  29.1k|  CiffComponent() = default;
_ZN5Exiv28Internal13CiffComponentD2Ev:
   75|  29.5k|  virtual ~CiffComponent() = default;

_ZN5Exiv212IptcDataSets10dataSetIdxEtt:
  377|   188k|int IptcDataSets::dataSetIdx(uint16_t number, uint16_t recordId) {
  378|   188k|  if (recordId != envelope && recordId != application2)
  ------------------
  |  Branch (378:7): [True: 152k, False: 36.1k]
  |  Branch (378:31): [True: 28.6k, False: 124k]
  ------------------
  379|  28.6k|    return -1;
  380|   160k|  const DataSet* dataSet = records_[recordId];
  381|   160k|  int idx;
  382|  3.91M|  for (idx = 0; dataSet[idx].number_ != number; ++idx) {
  ------------------
  |  Branch (382:17): [True: 3.76M, False: 152k]
  ------------------
  383|  3.76M|    if (dataSet[idx].number_ == 0xffff)
  ------------------
  |  Branch (383:9): [True: 7.95k, False: 3.75M]
  ------------------
  384|  7.95k|      return -1;
  385|  3.76M|  }
  386|   152k|  return idx;
  387|   160k|}
_ZN5Exiv212IptcDataSets10dataSetIdxERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEt:
  389|  56.2k|int IptcDataSets::dataSetIdx(const std::string& dataSetName, uint16_t recordId) {
  390|  56.2k|  if (recordId != envelope && recordId != application2)
  ------------------
  |  Branch (390:7): [True: 54.0k, False: 2.19k]
  |  Branch (390:31): [True: 0, False: 54.0k]
  ------------------
  391|      0|    return -1;
  392|  56.2k|  const DataSet* dataSet = records_[recordId];
  393|  56.2k|  int idx;
  394|  1.66M|  for (idx = 0; dataSet[idx].name_ != dataSetName; ++idx) {
  ------------------
  |  Branch (394:17): [True: 1.61M, False: 56.2k]
  ------------------
  395|  1.61M|    if (dataSet[idx].number_ == 0xffff)
  ------------------
  |  Branch (395:9): [True: 0, False: 1.61M]
  ------------------
  396|      0|      return -1;
  397|  1.61M|  }
  398|  56.2k|  return idx;
  399|  56.2k|}
_ZN5Exiv212IptcDataSets11dataSetTypeEtt:
  401|  52.5k|TypeId IptcDataSets::dataSetType(uint16_t number, uint16_t recordId) {
  402|  52.5k|  int idx = dataSetIdx(number, recordId);
  403|  52.5k|  if (idx == -1)
  ------------------
  |  Branch (403:7): [True: 12.1k, False: 40.3k]
  ------------------
  404|  12.1k|    return unknownDataSet.type_;
  405|  40.3k|  return records_[recordId][idx].type_;
  406|  52.5k|}
_ZN5Exiv212IptcDataSets11dataSetNameEtt:
  408|  84.6k|std::string IptcDataSets::dataSetName(uint16_t number, uint16_t recordId) {
  409|  84.6k|  if (int idx = dataSetIdx(number, recordId); idx != -1)
  ------------------
  |  Branch (409:47): [True: 72.5k, False: 12.1k]
  ------------------
  410|  72.5k|    return records_[recordId][idx].name_;
  411|       |
  412|  12.1k|  return stringFormat("0x{:04x}", number);
  ------------------
  |  |   18|  12.1k|#define stringFormat std::format
  ------------------
  413|  84.6k|}
_ZN5Exiv212IptcDataSets17dataSetRepeatableEtt:
  436|  51.5k|bool IptcDataSets::dataSetRepeatable(uint16_t number, uint16_t recordId) {
  437|  51.5k|  int idx = dataSetIdx(number, recordId);
  438|  51.5k|  if (idx == -1)
  ------------------
  |  Branch (438:7): [True: 12.1k, False: 39.3k]
  ------------------
  439|  12.1k|    return unknownDataSet.repeatable_;
  440|  39.3k|  return records_[recordId][idx].repeatable_;
  441|  51.5k|}
_ZN5Exiv212IptcDataSets7dataSetERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEt:
  443|  56.2k|uint16_t IptcDataSets::dataSet(const std::string& dataSetName, uint16_t recordId) {
  444|  56.2k|  if (int idx = dataSetIdx(dataSetName, recordId); idx != -1) {
  ------------------
  |  Branch (444:52): [True: 56.2k, False: 0]
  ------------------
  445|       |    // dataSetIdx checks the range of recordId
  446|  56.2k|    return records_[recordId][idx].number_;
  447|  56.2k|  }
  448|      0|  if (!isHex(dataSetName, 4, "0x"))
  ------------------
  |  Branch (448:7): [True: 0, False: 0]
  ------------------
  449|      0|    throw Error(ErrorCode::kerInvalidDataset, dataSetName);
  450|      0|  return static_cast<uint16_t>(std::stoi(dataSetName, nullptr, 16));
  451|      0|}
_ZN5Exiv212IptcDataSets10recordNameEt:
  453|  84.6k|std::string IptcDataSets::recordName(uint16_t recordId) {
  454|  84.6k|  if (recordId == envelope || recordId == application2) {
  ------------------
  |  Branch (454:7): [True: 13.3k, False: 71.3k]
  |  Branch (454:31): [True: 61.8k, False: 9.54k]
  ------------------
  455|  75.1k|    return recordInfo_[recordId].name_;
  456|  75.1k|  }
  457|       |
  458|  9.54k|  return stringFormat("0x{:04x}", recordId);
  ------------------
  |  |   18|  9.54k|#define stringFormat std::format
  ------------------
  459|  84.6k|}
_ZN5Exiv212IptcDataSets8recordIdERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  468|  56.2k|uint16_t IptcDataSets::recordId(const std::string& recordName) {
  469|  56.2k|  uint16_t i;
  470|  58.4k|  for (i = IptcDataSets::application2; i > 0; --i) {
  ------------------
  |  Branch (470:40): [True: 58.4k, False: 0]
  ------------------
  471|  58.4k|    if (recordInfo_[i].name_ == recordName)
  ------------------
  |  Branch (471:9): [True: 56.2k, False: 2.19k]
  ------------------
  472|  56.2k|      break;
  473|  58.4k|  }
  474|  56.2k|  if (i == 0) {
  ------------------
  |  Branch (474:7): [True: 0, False: 56.2k]
  ------------------
  475|      0|    if (!isHex(recordName, 4, "0x"))
  ------------------
  |  Branch (475:9): [True: 0, False: 0]
  ------------------
  476|      0|      throw Error(ErrorCode::kerInvalidRecord, recordName);
  477|      0|    i = static_cast<uint16_t>(std::stoi(recordName, nullptr, 16));
  478|      0|  }
  479|  56.2k|  return i;
  480|  56.2k|}
_ZN5Exiv27IptcKeyC2ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  490|  56.2k|IptcKey::IptcKey(std::string key) : tag_(0), record_(0), key_(std::move(key)) {
  491|  56.2k|  decomposeKey();
  492|  56.2k|}
_ZN5Exiv27IptcKeyC2Ett:
  494|  28.4k|IptcKey::IptcKey(uint16_t tag, uint16_t record) : tag_(tag), record_(record) {
  495|  28.4k|  makeKey();
  496|  28.4k|}
_ZNK5Exiv27IptcKey3keyEv:
  498|  41.6k|std::string IptcKey::key() const {
  499|  41.6k|  return key_;
  500|  41.6k|}
_ZNK5Exiv27IptcKey3tagEv:
  522|   725k|uint16_t IptcKey::tag() const {
  523|   725k|  return tag_;
  524|   725k|}
_ZNK5Exiv27IptcKey6recordEv:
  530|   409k|uint16_t IptcKey::record() const {
  531|   409k|  return record_;
  532|   409k|}
_ZNK5Exiv27IptcKey5cloneEv:
  534|   317k|IptcKey::UniquePtr IptcKey::clone() const {
  535|   317k|  return UniquePtr(clone_());
  536|   317k|}
_ZNK5Exiv27IptcKey6clone_Ev:
  538|   317k|IptcKey* IptcKey::clone_() const {
  539|   317k|  return new IptcKey(*this);
  540|   317k|}
_ZN5Exiv27IptcKey12decomposeKeyEv:
  542|  56.2k|void IptcKey::decomposeKey() {
  543|       |  // Check that the key has the expected format with RE
  544|  56.2k|  auto posDot1 = key_.find('.');
  545|  56.2k|  auto posDot2 = key_.find('.', posDot1 + 1);
  546|       |
  547|  56.2k|  if (posDot1 == std::string::npos || posDot2 == std::string::npos) {
  ------------------
  |  Branch (547:7): [True: 0, False: 56.2k]
  |  Branch (547:39): [True: 0, False: 56.2k]
  ------------------
  548|      0|    throw Error(ErrorCode::kerInvalidKey, key_);
  549|      0|  }
  550|       |
  551|       |  // Get the family name, record name and dataSet name parts of the key
  552|  56.2k|  const std::string familyName = key_.substr(0, posDot1);
  553|  56.2k|  if (familyName != familyName_)
  ------------------
  |  Branch (553:7): [True: 0, False: 56.2k]
  ------------------
  554|      0|    throw Error(ErrorCode::kerInvalidKey, key_);
  555|       |
  556|  56.2k|  std::string recordName = key_.substr(posDot1 + 1, posDot2 - posDot1 - 1);
  557|  56.2k|  std::string dataSetName = key_.substr(posDot2 + 1);
  558|       |
  559|       |  // Use the parts of the key to find dataSet and recordId
  560|  56.2k|  uint16_t recId = IptcDataSets::recordId(recordName);
  561|  56.2k|  uint16_t dataSet = IptcDataSets::dataSet(dataSetName, recId);
  562|       |
  563|       |  // Possibly translate hex name parts (0xabcd) to real names
  564|  56.2k|  recordName = IptcDataSets::recordName(recId);
  565|  56.2k|  dataSetName = IptcDataSets::dataSetName(dataSet, recId);
  566|       |
  567|  56.2k|  tag_ = dataSet;
  568|  56.2k|  record_ = recId;
  569|  56.2k|  key_ = familyName + "." + recordName + "." + dataSetName;
  570|  56.2k|}
_ZN5Exiv27IptcKey7makeKeyEv:
  572|  28.4k|void IptcKey::makeKey() {
  573|  28.4k|  key_ = std::string(familyName_) + "." + IptcDataSets::recordName(record_) + "." +
  574|  28.4k|         IptcDataSets::dataSetName(tag_, record_);
  575|  28.4k|}

_ZN5Exiv28Internal7enforceIJEEEvbNS_9ErrorCodeEDpOT_:
   46|  10.4M|constexpr void enforce(bool condition, Exiv2::ErrorCode err_code, T&&... args) {
   47|  10.4M|  enforce<Exiv2::Error>(condition, err_code, std::forward<T>(args)...);
   48|  10.4M|}
_ZN5Exiv28Internal7enforceINS_5ErrorEJRNS_9ErrorCodeEEEEvbDpOT0_:
   35|  10.4M|constexpr void enforce(bool condition, T&&... args) {
   36|  10.4M|  if (!condition) {
  ------------------
  |  Branch (36:7): [True: 7.61k, False: 10.4M]
  ------------------
   37|  7.61k|    throw exception_t(std::forward<T>(args)...);
   38|  7.61k|  }
   39|  10.4M|}

_ZN5Exiv28EpsImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
 1027|  2.89k|    Image(ImageType::eps, mdXmp, std::move(io), params) {
 1028|       |  // LogMsg::setLevel(LogMsg::debug);
 1029|  2.89k|  if (params.create() && io_->open() == 0) {
  ------------------
  |  Branch (1029:7): [True: 0, False: 2.89k]
  |  Branch (1029:26): [True: 0, False: 0]
  ------------------
 1030|       |#ifdef DEBUG
 1031|       |    EXV_DEBUG << "Exiv2::EpsImage:: Creating blank EPS image\n";
 1032|       |#endif
 1033|      0|    IoCloser closer(*io_);
 1034|      0|    if (io_->write(reinterpret_cast<const byte*>(epsBlank.data()), epsBlank.size()) != epsBlank.size()) {
  ------------------
  |  Branch (1034:9): [True: 0, False: 0]
  ------------------
 1035|      0|#ifndef SUPPRESS_WARNINGS
 1036|      0|      EXV_WARNING << "Failed to write blank EPS image.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1037|      0|#endif
 1038|      0|      throw Error(ErrorCode::kerImageWriteFailed);
 1039|      0|    }
 1040|      0|  }
 1041|  2.89k|}
_ZN5Exiv28EpsImage12readMetadataEv:
 1051|  2.89k|void EpsImage::readMetadata() {
 1052|       |#ifdef DEBUG
 1053|       |  EXV_DEBUG << "Exiv2::EpsImage::readMetadata: Reading EPS file " << io_->path() << "\n";
 1054|       |#endif
 1055|       |
 1056|       |  // read metadata
 1057|  2.89k|  readWriteEpsMetadata(*io_, xmpPacket_, nativePreviews_, /* write = */ false);
 1058|       |
 1059|       |  // decode XMP metadata
 1060|  2.89k|  const DecodeParams dp(max_recursion_depth_);
 1061|  2.89k|  if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp) > 1) {
  ------------------
  |  Branch (1061:7): [True: 187, False: 2.71k]
  |  Branch (1061:30): [True: 66, False: 121]
  ------------------
 1062|     66|#ifndef SUPPRESS_WARNINGS
 1063|     66|    EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|     66|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 66]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     66|  LogMsg(LogMsg::warn).os()
  ------------------
 1064|     66|#endif
 1065|     66|    throw Error(ErrorCode::kerFailedToReadImageData);
 1066|     66|  }
 1067|       |
 1068|       |#ifdef DEBUG
 1069|       |  EXV_DEBUG << "Exiv2::EpsImage::readMetadata: Finished reading EPS file " << io_->path() << "\n";
 1070|       |#endif
 1071|  2.89k|}
_ZN5Exiv28EpsImage13writeMetadataEv:
 1073|    958|void EpsImage::writeMetadata() {
 1074|       |#ifdef DEBUG
 1075|       |  EXV_DEBUG << "Exiv2::EpsImage::writeMetadata: Writing EPS file " << io_->path() << "\n";
 1076|       |#endif
 1077|       |
 1078|       |  // encode XMP metadata if necessary
 1079|    958|  if (!writeXmpFromPacket() && XmpParser::encode(xmpPacket_, xmpData_) > 1) {
  ------------------
  |  Branch (1079:7): [True: 958, False: 0]
  |  Branch (1079:32): [True: 28, False: 930]
  ------------------
 1080|     28|#ifndef SUPPRESS_WARNINGS
 1081|     28|    EXV_WARNING << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  138|     28|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 28]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     28|  LogMsg(LogMsg::warn).os()
  ------------------
 1082|     28|#endif
 1083|     28|    throw Error(ErrorCode::kerImageWriteFailed);
 1084|     28|  }
 1085|       |
 1086|       |  // write metadata
 1087|    930|  readWriteEpsMetadata(*io_, xmpPacket_, nativePreviews_, /* write = */ true);
 1088|       |
 1089|       |#ifdef DEBUG
 1090|       |  EXV_DEBUG << "Exiv2::EpsImage::writeMetadata: Finished writing EPS file " << io_->path() << "\n";
 1091|       |#endif
 1092|    930|}
_ZN5Exiv214newEpsInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
 1096|  2.89k|Image::UniquePtr newEpsInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
 1097|  2.89k|  auto image = std::make_unique<EpsImage>(std::move(io), params);
 1098|  2.89k|  if (!image->good()) {
  ------------------
  |  Branch (1098:7): [True: 0, False: 2.89k]
  ------------------
 1099|      0|    return nullptr;
 1100|      0|  }
 1101|  2.89k|  return image;
 1102|  2.89k|}
_ZN5Exiv29isEpsTypeERNS_7BasicIoEb:
 1104|  19.0k|bool isEpsType(BasicIo& iIo, bool advance) {
 1105|       |  // read as many bytes as needed for the longest (DOS) EPS signature
 1106|  19.0k|  constexpr auto bufSize = [] {
 1107|  19.0k|    auto f = [](const auto& a, const auto& b) { return a.size() < b.size(); };
 1108|  19.0k|    return std::max_element(epsFirstLine.begin(), epsFirstLine.end(), f)->size();
 1109|  19.0k|  }();
 1110|  19.0k|  const size_t restore = iIo.tell();  // save
 1111|  19.0k|  DataBuf buf = iIo.read(bufSize);
 1112|  19.0k|  if (iIo.error() || buf.size() != bufSize) {
  ------------------
  |  Branch (1112:7): [True: 0, False: 19.0k]
  |  Branch (1112:22): [True: 0, False: 19.0k]
  ------------------
 1113|      0|    iIo.seek(restore, BasicIo::beg);
 1114|      0|    return false;
 1115|      0|  }
 1116|       |  // check for all possible (DOS) EPS signatures
 1117|  19.0k|  bool matched = (buf.cmpBytes(0, dosEpsSignature.data(), dosEpsSignature.size()) == 0);
 1118|  19.0k|  if (!matched) {
  ------------------
  |  Branch (1118:7): [True: 18.0k, False: 910]
  ------------------
 1119|  50.1k|    for (auto&& eps : epsFirstLine) {
  ------------------
  |  Branch (1119:21): [True: 50.1k, False: 13.2k]
  ------------------
 1120|  50.1k|      if (buf.cmpBytes(0, eps.data(), eps.size()) == 0) {
  ------------------
  |  Branch (1120:11): [True: 4.88k, False: 45.2k]
  ------------------
 1121|  4.88k|        matched = true;
 1122|  4.88k|        break;
 1123|  4.88k|      }
 1124|  50.1k|    }
 1125|  18.0k|  }
 1126|       |  // seek back if possible and requested
 1127|  19.0k|  if (!advance || !matched) {
  ------------------
  |  Branch (1127:7): [True: 19.0k, False: 0]
  |  Branch (1127:19): [True: 0, False: 0]
  ------------------
 1128|  19.0k|    iIo.seek(restore, BasicIo::beg);
 1129|  19.0k|  }
 1130|  19.0k|  return matched;
 1131|  19.0k|}
epsimage.cpp:_ZN12_GLOBAL__N_120readWriteEpsMetadataERN5Exiv27BasicIoERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERNS3_6vectorINS0_13NativePreviewENS7_ISC_EEEEb:
  224|  3.82k|void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList& nativePreviews, bool write) {
  225|       |  // open input file
  226|  3.82k|  if (io.open() != 0) {
  ------------------
  |  Branch (226:7): [True: 0, False: 3.82k]
  ------------------
  227|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io.path(), strError());
  228|      0|  }
  229|  3.82k|  IoCloser closer(io);
  230|       |
  231|       |  // read from input file via memory map
  232|  3.82k|  const byte* data = io.mmap();
  233|       |
  234|       |  // default positions and sizes
  235|  3.82k|  const size_t size = io.size();
  236|  3.82k|  size_t posEps = 0;
  237|  3.82k|  size_t posEndEps = size;
  238|  3.82k|  uint32_t posWmf = 0;
  239|  3.82k|  uint32_t sizeWmf = 0;
  240|  3.82k|  uint32_t posTiff = 0;
  241|  3.82k|  uint32_t sizeTiff = 0;
  242|       |
  243|  3.82k|  ErrorCode errcode = write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData;
  ------------------
  |  Branch (243:23): [True: 930, False: 2.89k]
  ------------------
  244|       |
  245|       |  // check for DOS EPS
  246|  3.82k|  const bool dosEps =
  247|  3.82k|      (size >= dosEpsSignature.size() && memcmp(data, dosEpsSignature.data(), dosEpsSignature.size()) == 0);
  ------------------
  |  Branch (247:8): [True: 3.82k, False: 0]
  |  Branch (247:42): [True: 459, False: 3.36k]
  ------------------
  248|  3.82k|  if (dosEps) {
  ------------------
  |  Branch (248:7): [True: 459, False: 3.36k]
  ------------------
  249|       |#ifdef DEBUG
  250|       |    EXV_DEBUG << "readWriteEpsMetadata: Found DOS EPS signature\n";
  251|       |#endif
  252|       |
  253|    459|    enforce(size >= 30, errcode);
  254|    459|    posEps = getULong(data + 4, littleEndian);
  255|    459|    posEndEps = getULong(data + 8, littleEndian) + posEps;
  256|    459|    posWmf = getULong(data + 12, littleEndian);
  257|    459|    sizeWmf = getULong(data + 16, littleEndian);
  258|    459|    posTiff = getULong(data + 20, littleEndian);
  259|    459|    sizeTiff = getULong(data + 24, littleEndian);
  260|       |#ifdef DEBUG
  261|       |    EXV_DEBUG << "readWriteEpsMetadata: EPS section at position " << posEps << ", size " << (posEndEps - posEps)
  262|       |              << "\n";
  263|       |    EXV_DEBUG << "readWriteEpsMetadata: WMF section at position " << posWmf << ", size " << sizeWmf << "\n";
  264|       |    EXV_DEBUG << "readWriteEpsMetadata: TIFF section at position " << posTiff << ", size " << sizeTiff << "\n";
  265|       |#endif
  266|    459|    if (uint16_t checksum = getUShort(data + 28, littleEndian); checksum != 0xFFFF) {
  ------------------
  |  Branch (266:65): [True: 429, False: 30]
  ------------------
  267|       |#ifdef DEBUG
  268|       |      EXV_DEBUG << "readWriteEpsMetadata: DOS EPS checksum is not FFFF\n";
  269|       |#endif
  270|    429|    }
  271|    459|    if ((posWmf != 0 || sizeWmf != 0) && (posTiff != 0 || sizeTiff != 0)) {
  ------------------
  |  Branch (271:10): [True: 301, False: 158]
  |  Branch (271:25): [True: 41, False: 117]
  |  Branch (271:43): [True: 245, False: 89]
  |  Branch (271:59): [True: 62, False: 27]
  ------------------
  272|    307|#ifndef SUPPRESS_WARNINGS
  273|    307|      EXV_WARNING << "DOS EPS file has both WMF and TIFF section. Only one of those is allowed.\n";
  ------------------
  |  |  138|    307|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 307]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    307|  LogMsg(LogMsg::warn).os()
  ------------------
  274|    307|#endif
  275|    307|      if (write)
  ------------------
  |  Branch (275:11): [True: 1, False: 306]
  ------------------
  276|      1|        throw Error(ErrorCode::kerImageWriteFailed);
  277|    307|    }
  278|    458|    if (sizeWmf == 0 && sizeTiff == 0) {
  ------------------
  |  Branch (278:9): [True: 224, False: 234]
  |  Branch (278:25): [True: 84, False: 140]
  ------------------
  279|     84|#ifndef SUPPRESS_WARNINGS
  280|     84|      EXV_WARNING << "DOS EPS file has neither WMF nor TIFF section. Exactly one of those is required.\n";
  ------------------
  |  |  138|     84|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 84]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     84|  LogMsg(LogMsg::warn).os()
  ------------------
  281|     84|#endif
  282|     84|      if (write)
  ------------------
  |  Branch (282:11): [True: 1, False: 83]
  ------------------
  283|      1|        throw Error(ErrorCode::kerImageWriteFailed);
  284|     84|    }
  285|    457|    enforce(30 <= posEps, errcode);
  286|    457|    enforce(sizeWmf == 0 || 30 <= posWmf, errcode);
  ------------------
  |  Branch (286:13): [True: 251, False: 206]
  |  Branch (286:29): [True: 165, False: 41]
  ------------------
  287|    457|    enforce(sizeTiff == 0 || 30 <= posTiff, errcode);
  ------------------
  |  Branch (287:13): [True: 181, False: 276]
  |  Branch (287:30): [True: 213, False: 63]
  ------------------
  288|       |
  289|    457|    enforce(posEps <= posEndEps && posEndEps <= size, errcode);
  ------------------
  |  Branch (289:13): [True: 310, False: 147]
  |  Branch (289:36): [True: 181, False: 129]
  ------------------
  290|    457|    enforce(posWmf <= size && sizeWmf <= size - posWmf, errcode);
  ------------------
  |  Branch (290:13): [True: 153, False: 304]
  |  Branch (290:31): [True: 120, False: 33]
  ------------------
  291|    457|    enforce(posTiff <= size && sizeTiff <= size - posTiff, errcode);
  ------------------
  |  Branch (291:13): [True: 92, False: 365]
  |  Branch (291:32): [True: 62, False: 30]
  ------------------
  292|    457|  }
  293|       |
  294|       |  // check first line
  295|  3.82k|  std::string firstLine;
  296|  3.82k|  const size_t posSecondLine = readLine(firstLine, data, posEps, posEndEps);
  297|       |#ifdef DEBUG
  298|       |  EXV_DEBUG << "readWriteEpsMetadata: First line: " << firstLine << "\n";
  299|       |#endif
  300|  3.82k|  auto it = std::find(epsFirstLine.begin(), epsFirstLine.end(), firstLine);
  301|  3.82k|  if (it == epsFirstLine.end()) {
  ------------------
  |  Branch (301:7): [True: 139, False: 3.68k]
  ------------------
  302|    139|    throw Error(ErrorCode::kerNotAnImage, "EPS");
  303|    139|  }
  304|       |
  305|       |  // determine line ending style of the first line
  306|  3.68k|  if (posSecondLine >= posEndEps) {
  ------------------
  |  Branch (306:7): [True: 9, False: 3.67k]
  ------------------
  307|      9|#ifndef SUPPRESS_WARNINGS
  308|      9|    EXV_WARNING << "Premature end of file after first line.\n";
  ------------------
  |  |  138|      9|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 9]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      9|  LogMsg(LogMsg::warn).os()
  ------------------
  309|      9|#endif
  310|      9|    throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (310:17): [True: 0, False: 9]
  ------------------
  311|      9|  }
  312|  3.67k|  const std::string lineEnding(reinterpret_cast<const char*>(data + posEps + firstLine.size()),
  313|  3.67k|                               posSecondLine - (posEps + firstLine.size()));
  314|       |#ifdef DEBUG
  315|       |  if (lineEnding == "\n") {
  316|       |    EXV_DEBUG << "readWriteEpsMetadata: Line ending style: Unix (LF)\n";
  317|       |  } else if (lineEnding == "\r") {
  318|       |    EXV_DEBUG << "readWriteEpsMetadata: Line ending style: Mac (CR)\n";
  319|       |  } else if (lineEnding == "\r\n") {
  320|       |    EXV_DEBUG << "readWriteEpsMetadata: Line ending style: DOS (CR LF)\n";
  321|       |  } else {
  322|       |    EXV_DEBUG << "readWriteEpsMetadata: Line ending style: (unknown)\n";
  323|       |  }
  324|       |#endif
  325|       |
  326|       |  // scan comments
  327|  3.67k|  size_t posLanguageLevel = posEndEps;
  328|  3.67k|  size_t posContainsXmp = posEndEps;
  329|  3.67k|  size_t posPages = posEndEps;
  330|  3.67k|  size_t posExiv2Version = posEndEps;
  331|  3.67k|  size_t posExiv2Website = posEndEps;
  332|  3.67k|  size_t posEndComments = posEndEps;
  333|  3.67k|  size_t posAi7Thumbnail = posEndEps;
  334|  3.67k|  size_t posAi7ThumbnailEndData = posEndEps;
  335|  3.67k|  size_t posBeginPhotoshop = posEndEps;
  336|  3.67k|  size_t posEndPhotoshop = posEndEps;
  337|  3.67k|  size_t posPage = posEndEps;
  338|  3.67k|  size_t posBeginPageSetup = posEndEps;
  339|  3.67k|  size_t posEndPageSetup = posEndEps;
  340|  3.67k|  size_t posPageTrailer = posEndEps;
  341|  3.67k|  size_t posEof = posEndEps;
  342|  3.67k|  std::vector<std::pair<size_t, size_t>> removableEmbeddings;
  343|  3.67k|  size_t depth = 0;
  344|  3.67k|  const size_t maxDepth = std::numeric_limits<size_t>::max();
  345|  3.67k|  bool illustrator8 = false;
  346|  3.67k|  bool corelDraw = false;
  347|  3.67k|  bool implicitPage = false;
  348|  3.67k|  bool implicitPageSetup = false;
  349|  3.67k|  bool implicitPageTrailer = false;
  350|  3.67k|  bool inDefaultsPreviewPrologSetup = false;
  351|  3.67k|  bool inRemovableEmbedding = false;
  352|  3.67k|  std::string removableEmbeddingEndLine;
  353|  3.67k|  size_t removableEmbeddingsWithUnmarkedTrailer = 0;
  354|   426k|  for (size_t pos = posEps; pos < posEof;) {
  ------------------
  |  Branch (354:29): [True: 423k, False: 3.48k]
  ------------------
  355|   423k|    const size_t startPos = pos;
  356|   423k|    std::string line;
  357|   423k|    pos = readLine(line, data, startPos, posEndEps);
  358|       |#ifdef DEBUG
  359|       |    bool significantLine = true;
  360|       |#endif
  361|       |    // nested documents
  362|   423k|    if (posPage == posEndEps && (line.starts_with("%%IncludeDocument:") || line.starts_with("%%BeginDocument:"))) {
  ------------------
  |  Branch (362:9): [True: 58.3k, False: 365k]
  |  Branch (362:34): [True: 42, False: 58.3k]
  |  Branch (362:76): [True: 22, False: 58.3k]
  ------------------
  363|     64|#ifndef SUPPRESS_WARNINGS
  364|     64|      EXV_WARNING << "Nested document at invalid position: " << startPos << "\n";
  ------------------
  |  |  138|     64|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 64]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     64|  LogMsg(LogMsg::warn).os()
  ------------------
  365|     64|#endif
  366|     64|      throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (366:19): [True: 0, False: 64]
  ------------------
  367|     64|    }
  368|   423k|    if (line.starts_with("%%BeginDocument:")) {
  ------------------
  |  Branch (368:9): [True: 18.5k, False: 404k]
  ------------------
  369|  18.5k|      if (depth == maxDepth) {
  ------------------
  |  Branch (369:11): [True: 0, False: 18.5k]
  ------------------
  370|      0|#ifndef SUPPRESS_WARNINGS
  371|      0|        EXV_WARNING << "Document too deeply nested at position: " << startPos << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  372|      0|#endif
  373|      0|        throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (373:21): [True: 0, False: 0]
  ------------------
  374|      0|      }
  375|  18.5k|      depth++;
  376|   404k|    } else if (line.starts_with("%%EndDocument")) {
  ------------------
  |  Branch (376:16): [True: 114, False: 404k]
  ------------------
  377|    114|      if (depth == 0) {
  ------------------
  |  Branch (377:11): [True: 30, False: 84]
  ------------------
  378|     30|#ifndef SUPPRESS_WARNINGS
  379|     30|        EXV_WARNING << "Unmatched EndDocument at position: " << startPos << "\n";
  ------------------
  |  |  138|     30|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 30]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     30|  LogMsg(LogMsg::warn).os()
  ------------------
  380|     30|#endif
  381|     30|        throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (381:21): [True: 0, False: 30]
  ------------------
  382|     30|      }
  383|     84|      depth--;
  384|   404k|    } else {
  385|       |#ifdef DEBUG
  386|       |      significantLine = false;
  387|       |#endif
  388|   404k|    }
  389|       |#ifdef DEBUG
  390|       |    if (significantLine) {
  391|       |      EXV_DEBUG << "readWriteEpsMetadata: Found significant line \"" << line << "\" at position: " << startPos << "\n";
  392|       |    }
  393|       |    significantLine = true;
  394|       |#endif
  395|   423k|    if (depth != 0)
  ------------------
  |  Branch (395:9): [True: 53.2k, False: 370k]
  ------------------
  396|  53.2k|      continue;
  397|       |    // explicit "Begin" comments
  398|   370k|    if (line.starts_with("%%BeginPreview:")) {
  ------------------
  |  Branch (398:9): [True: 533, False: 369k]
  ------------------
  399|    533|      inDefaultsPreviewPrologSetup = true;
  400|   369k|    } else if (line == "%%BeginDefaults") {
  ------------------
  |  Branch (400:16): [True: 629, False: 368k]
  ------------------
  401|    629|      inDefaultsPreviewPrologSetup = true;
  402|   368k|    } else if (line == "%%BeginProlog") {
  ------------------
  |  Branch (402:16): [True: 1.01k, False: 367k]
  ------------------
  403|  1.01k|      inDefaultsPreviewPrologSetup = true;
  404|   367k|    } else if (line == "%%BeginSetup") {
  ------------------
  |  Branch (404:16): [True: 2.68k, False: 365k]
  ------------------
  405|  2.68k|      inDefaultsPreviewPrologSetup = true;
  406|   365k|    } else if (posPage == posEndEps && line.starts_with("%%Page:")) {
  ------------------
  |  Branch (406:16): [True: 53.9k, False: 311k]
  |  Branch (406:40): [True: 190, False: 53.7k]
  ------------------
  407|    190|      posPage = startPos;
  408|   365k|    } else if (posPage != posEndEps && line.starts_with("%%Page:")) {
  ------------------
  |  Branch (408:16): [True: 311k, False: 53.7k]
  |  Branch (408:40): [True: 97, False: 311k]
  ------------------
  409|     97|      if (implicitPage) {
  ------------------
  |  Branch (409:11): [True: 65, False: 32]
  ------------------
  410|     65|#ifndef SUPPRESS_WARNINGS
  411|     65|        EXV_WARNING << "Page at position " << startPos << " conflicts with implicit page at position: " << posPage
  ------------------
  |  |  138|     65|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 65]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     65|  LogMsg(LogMsg::warn).os()
  ------------------
  412|      0|                    << "\n";
  413|     65|#endif
  414|     65|        throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (414:21): [True: 0, False: 65]
  ------------------
  415|     65|      }
  416|     32|#ifndef SUPPRESS_WARNINGS
  417|     32|      EXV_WARNING << "Unable to handle multiple PostScript pages. Found second page at position: " << startPos << "\n";
  ------------------
  |  |  138|     32|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 32]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     32|  LogMsg(LogMsg::warn).os()
  ------------------
  418|     32|#endif
  419|     32|      throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (419:19): [True: 0, False: 32]
  ------------------
  420|   364k|    } else if (line == "%%BeginPageSetup") {
  ------------------
  |  Branch (420:16): [True: 253, False: 364k]
  ------------------
  421|    253|      posBeginPageSetup = startPos;
  422|   364k|    } else if (!inRemovableEmbedding && line == "%Exiv2BeginXMP: Before %%EndPageSetup") {
  ------------------
  |  Branch (422:16): [True: 280k, False: 84.0k]
  |  Branch (422:41): [True: 1.05k, False: 279k]
  ------------------
  423|  1.05k|      inRemovableEmbedding = true;
  424|  1.05k|      removableEmbeddings.emplace_back(startPos, startPos);
  425|  1.05k|      removableEmbeddingEndLine = "%Exiv2EndXMP";
  426|   363k|    } else if (!inRemovableEmbedding && line == "%Exiv2BeginXMP: After %%PageTrailer") {
  ------------------
  |  Branch (426:16): [True: 279k, False: 84.0k]
  |  Branch (426:41): [True: 6.69k, False: 272k]
  ------------------
  427|  6.69k|      inRemovableEmbedding = true;
  428|  6.69k|      removableEmbeddings.emplace_back(startPos, startPos);
  429|  6.69k|      removableEmbeddingEndLine = "%Exiv2EndXMP";
  430|   356k|    } else if (!inRemovableEmbedding && line == "%ADOBeginClientInjection: PageSetup End \"AI11EPS\"") {
  ------------------
  |  Branch (430:16): [True: 272k, False: 84.0k]
  |  Branch (430:41): [True: 265, False: 272k]
  ------------------
  431|    265|      inRemovableEmbedding = true;
  432|    265|      removableEmbeddings.emplace_back(startPos, startPos);
  433|    265|      removableEmbeddingEndLine = "%ADOEndClientInjection: PageSetup End \"AI11EPS\"";
  434|   356k|    } else if (!inRemovableEmbedding && line == "%ADOBeginClientInjection: PageTrailer Start \"AI11EPS\"") {
  ------------------
  |  Branch (434:16): [True: 272k, False: 84.0k]
  |  Branch (434:41): [True: 258, False: 272k]
  ------------------
  435|    258|      inRemovableEmbedding = true;
  436|    258|      removableEmbeddings.emplace_back(startPos, startPos);
  437|    258|      removableEmbeddingEndLine = "%ADOEndClientInjection: PageTrailer Start \"AI11EPS\"";
  438|   356k|    } else if (!inRemovableEmbedding && line == "%begin_xml_code") {
  ------------------
  |  Branch (438:16): [True: 272k, False: 84.0k]
  |  Branch (438:41): [True: 1.41k, False: 270k]
  ------------------
  439|  1.41k|      inRemovableEmbedding = true;
  440|  1.41k|      removableEmbeddings.emplace_back(startPos, startPos);
  441|  1.41k|      removableEmbeddingEndLine = "%end_xml_code";
  442|  1.41k|      removableEmbeddingsWithUnmarkedTrailer++;
  443|   354k|    } else {
  444|       |#ifdef DEBUG
  445|       |      significantLine = false;
  446|       |#endif
  447|   354k|    }
  448|       |#ifdef DEBUG
  449|       |    if (significantLine) {
  450|       |      EXV_DEBUG << "readWriteEpsMetadata: Found significant line \"" << line << "\" at position: " << startPos << "\n";
  451|       |    }
  452|       |    significantLine = true;
  453|       |#endif
  454|       |    // implicit comments
  455|   369k|    if (line == "%%EOF" || line == "%begin_xml_code" || line.size() < 2 || line.front() != '%' || '\x21' > line[1] ||
  ------------------
  |  Branch (455:9): [True: 31, False: 369k]
  |  Branch (455:28): [True: 1.63k, False: 368k]
  |  Branch (455:57): [True: 39.6k, False: 328k]
  |  Branch (455:76): [True: 163k, False: 165k]
  |  Branch (455:99): [True: 3.35k, False: 162k]
  ------------------
  456|   208k|        line[1] > '\x7e') {
  ------------------
  |  Branch (456:9): [True: 243, False: 161k]
  ------------------
  457|   208k|      if (posEndComments == posEndEps) {
  ------------------
  |  Branch (457:11): [True: 2.54k, False: 205k]
  ------------------
  458|  2.54k|        posEndComments = startPos;
  459|       |#ifdef DEBUG
  460|       |        EXV_DEBUG << "readWriteEpsMetadata: Found implicit EndComments at position: " << startPos << "\n";
  461|       |#endif
  462|  2.54k|      }
  463|   208k|    }
  464|   369k|    if (posPage == posEndEps && posEndComments != posEndEps && !inDefaultsPreviewPrologSetup && !inRemovableEmbedding &&
  ------------------
  |  Branch (464:9): [True: 58.1k, False: 311k]
  |  Branch (464:33): [True: 37.3k, False: 20.7k]
  |  Branch (464:64): [True: 11.2k, False: 26.0k]
  |  Branch (464:97): [True: 4.36k, False: 6.90k]
  ------------------
  465|  4.36k|        !onlyWhitespaces(line)) {
  ------------------
  |  Branch (465:9): [True: 2.11k, False: 2.25k]
  ------------------
  466|  2.11k|      posPage = startPos;
  467|  2.11k|      implicitPage = true;
  468|       |#ifdef DEBUG
  469|       |      EXV_DEBUG << "readWriteEpsMetadata: Found implicit Page at position: " << startPos << "\n";
  470|       |#endif
  471|  2.11k|    }
  472|   369k|    if (posBeginPageSetup == posEndEps &&
  ------------------
  |  Branch (472:9): [True: 45.8k, False: 324k]
  ------------------
  473|  45.8k|        (implicitPage || (posPage != posEndEps && !inRemovableEmbedding && !line.empty() && line.front() != '%'))) {
  ------------------
  |  Branch (473:10): [True: 2.03k, False: 43.8k]
  |  Branch (473:27): [True: 2.46k, False: 41.3k]
  |  Branch (473:51): [True: 1.60k, False: 854]
  |  Branch (473:76): [True: 1.42k, False: 182]
  |  Branch (473:93): [True: 79, False: 1.34k]
  ------------------
  474|  2.11k|      posBeginPageSetup = startPos;
  475|  2.11k|      implicitPageSetup = true;
  476|       |#ifdef DEBUG
  477|       |      EXV_DEBUG << "readWriteEpsMetadata: Found implicit BeginPageSetup at position: " << startPos << "\n";
  478|       |#endif
  479|  2.11k|    }
  480|   369k|    if (posEndPageSetup == posEndEps && implicitPageSetup && !inRemovableEmbedding && !line.empty() &&
  ------------------
  |  Branch (480:9): [True: 51.7k, False: 318k]
  |  Branch (480:41): [True: 8.09k, False: 43.6k]
  |  Branch (480:62): [True: 3.69k, False: 4.40k]
  |  Branch (480:87): [True: 3.40k, False: 281]
  ------------------
  481|  3.40k|        line.front() != '%') {
  ------------------
  |  Branch (481:9): [True: 1.87k, False: 1.53k]
  ------------------
  482|  1.87k|      posEndPageSetup = startPos;
  483|       |#ifdef DEBUG
  484|       |      EXV_DEBUG << "readWriteEpsMetadata: Found implicit EndPageSetup at position: " << startPos << "\n";
  485|       |#endif
  486|  1.87k|    }
  487|   369k|    if (!line.empty() && line.front() != '%')
  ------------------
  |  Branch (487:9): [True: 342k, False: 27.8k]
  |  Branch (487:26): [True: 174k, False: 167k]
  ------------------
  488|   174k|      continue;  // performance optimization
  489|   195k|    if (line == "%%EOF" || line == "%%Trailer" || line == "%%PageTrailer") {
  ------------------
  |  Branch (489:9): [True: 31, False: 195k]
  |  Branch (489:28): [True: 515, False: 194k]
  |  Branch (489:51): [True: 168, False: 194k]
  ------------------
  490|    714|      if (posBeginPageSetup == posEndEps) {
  ------------------
  |  Branch (490:11): [True: 119, False: 595]
  ------------------
  491|    119|        posBeginPageSetup = startPos;
  492|    119|        implicitPageSetup = true;
  493|       |#ifdef DEBUG
  494|       |        EXV_DEBUG << "readWriteEpsMetadata: Found implicit BeginPageSetup at position: " << startPos << "\n";
  495|       |#endif
  496|    119|      }
  497|    714|      if (posEndPageSetup == posEndEps) {
  ------------------
  |  Branch (497:11): [True: 126, False: 588]
  ------------------
  498|    126|        posEndPageSetup = startPos;
  499|    126|        implicitPageSetup = true;
  500|       |#ifdef DEBUG
  501|       |        EXV_DEBUG << "readWriteEpsMetadata: Found implicit EndPageSetup at position: " << startPos << "\n";
  502|       |#endif
  503|    126|      }
  504|    714|    }
  505|   195k|    if ((line == "%%EOF" || line == "%%Trailer") && posPageTrailer == posEndEps) {
  ------------------
  |  Branch (505:10): [True: 31, False: 195k]
  |  Branch (505:29): [True: 515, False: 194k]
  |  Branch (505:53): [True: 142, False: 404]
  ------------------
  506|    142|      posPageTrailer = startPos;
  507|    142|      implicitPageTrailer = true;
  508|       |#ifdef DEBUG
  509|       |      EXV_DEBUG << "readWriteEpsMetadata: Found implicit PageTrailer at position: " << startPos << "\n";
  510|       |#endif
  511|    142|    }
  512|       |    // remaining explicit comments
  513|   195k|    if (posEndComments == posEndEps && posLanguageLevel == posEndEps && line.starts_with("%%LanguageLevel:")) {
  ------------------
  |  Branch (513:9): [True: 21.9k, False: 173k]
  |  Branch (513:40): [True: 18.8k, False: 3.06k]
  |  Branch (513:73): [True: 623, False: 18.2k]
  ------------------
  514|    623|      posLanguageLevel = startPos;
  515|   194k|    } else if (posEndComments == posEndEps && posContainsXmp == posEndEps && line.starts_with("%ADO_ContainsXMP:")) {
  ------------------
  |  Branch (515:16): [True: 21.2k, False: 173k]
  |  Branch (515:47): [True: 21.0k, False: 286]
  |  Branch (515:78): [True: 619, False: 20.3k]
  ------------------
  516|    619|      posContainsXmp = startPos;
  517|   194k|    } else if (posEndComments == posEndEps && posPages == posEndEps && line.starts_with("%%Pages:")) {
  ------------------
  |  Branch (517:16): [True: 20.6k, False: 173k]
  |  Branch (517:47): [True: 19.8k, False: 854]
  |  Branch (517:72): [True: 80, False: 19.7k]
  ------------------
  518|     80|      posPages = startPos;
  519|   194k|    } else if (posEndComments == posEndEps && posExiv2Version == posEndEps && line.starts_with("%Exiv2Version:")) {
  ------------------
  |  Branch (519:16): [True: 20.5k, False: 173k]
  |  Branch (519:47): [True: 19.3k, False: 1.27k]
  |  Branch (519:79): [True: 98, False: 19.2k]
  ------------------
  520|     98|      posExiv2Version = startPos;
  521|   194k|    } else if (posEndComments == posEndEps && posExiv2Website == posEndEps && line.starts_with("%Exiv2Website:")) {
  ------------------
  |  Branch (521:16): [True: 20.4k, False: 173k]
  |  Branch (521:47): [True: 19.4k, False: 1.02k]
  |  Branch (521:79): [True: 120, False: 19.3k]
  ------------------
  522|    120|      posExiv2Website = startPos;
  523|   193k|    } else if (posEndComments == posEndEps && line.starts_with("%%Creator: Adobe Illustrator") &&
  ------------------
  |  Branch (523:16): [True: 20.3k, False: 173k]
  |  Branch (523:47): [True: 244, False: 20.1k]
  ------------------
  524|    244|               firstLine == "%!PS-Adobe-3.0 EPSF-3.0") {
  ------------------
  |  Branch (524:16): [True: 68, False: 176]
  ------------------
  525|     68|      illustrator8 = true;
  526|   193k|    } else if (posEndComments == posEndEps && line.starts_with("%AI7_Thumbnail:")) {
  ------------------
  |  Branch (526:16): [True: 20.3k, False: 173k]
  |  Branch (526:47): [True: 1.06k, False: 19.2k]
  ------------------
  527|  1.06k|      posAi7Thumbnail = startPos;
  528|   192k|    } else if (posEndComments == posEndEps && posAi7Thumbnail != posEndEps && posAi7ThumbnailEndData == posEndEps &&
  ------------------
  |  Branch (528:16): [True: 19.2k, False: 173k]
  |  Branch (528:47): [True: 5.70k, False: 13.5k]
  |  Branch (528:79): [True: 5.01k, False: 699]
  ------------------
  529|  5.01k|               line == "%%EndData") {
  ------------------
  |  Branch (529:16): [True: 421, False: 4.58k]
  ------------------
  530|    421|      posAi7ThumbnailEndData = startPos;
  531|   192k|    } else if (posEndComments == posEndEps && line == "%%EndComments") {
  ------------------
  |  Branch (531:16): [True: 18.8k, False: 173k]
  |  Branch (531:47): [True: 7, False: 18.8k]
  ------------------
  532|      7|      posEndComments = startPos;
  533|   192k|    } else if (inDefaultsPreviewPrologSetup && line.starts_with("%%BeginResource: procset wCorel")) {
  ------------------
  |  Branch (533:16): [True: 31.1k, False: 161k]
  |  Branch (533:48): [True: 460, False: 30.7k]
  ------------------
  534|    460|      corelDraw = true;
  535|   191k|    } else if (line == "%%EndPreview") {
  ------------------
  |  Branch (535:16): [True: 237, False: 191k]
  ------------------
  536|    237|      inDefaultsPreviewPrologSetup = false;
  537|   191k|    } else if (line == "%%EndDefaults") {
  ------------------
  |  Branch (537:16): [True: 209, False: 191k]
  ------------------
  538|    209|      inDefaultsPreviewPrologSetup = false;
  539|   191k|    } else if (line == "%%EndProlog") {
  ------------------
  |  Branch (539:16): [True: 2.16k, False: 189k]
  ------------------
  540|  2.16k|      inDefaultsPreviewPrologSetup = false;
  541|   189k|    } else if (line == "%%EndSetup") {
  ------------------
  |  Branch (541:16): [True: 513, False: 188k]
  ------------------
  542|    513|      inDefaultsPreviewPrologSetup = false;
  543|   188k|    } else if (posEndPageSetup == posEndEps && line == "%%EndPageSetup") {
  ------------------
  |  Branch (543:16): [True: 36.8k, False: 151k]
  |  Branch (543:48): [True: 13, False: 36.7k]
  ------------------
  544|     13|      posEndPageSetup = startPos;
  545|   188k|    } else if (posPageTrailer == posEndEps && line == "%%PageTrailer") {
  ------------------
  |  Branch (545:16): [True: 152k, False: 36.2k]
  |  Branch (545:47): [True: 48, False: 152k]
  ------------------
  546|     48|      posPageTrailer = startPos;
  547|   188k|    } else if (posBeginPhotoshop == posEndEps && line.starts_with("%BeginPhotoshop:")) {
  ------------------
  |  Branch (547:16): [True: 158k, False: 30.2k]
  |  Branch (547:50): [True: 162, False: 158k]
  ------------------
  548|    162|      posBeginPhotoshop = pos;
  549|   188k|    } else if (posBeginPhotoshop != posEndEps && posEndPhotoshop == posEndEps && line == "%EndPhotoshop") {
  ------------------
  |  Branch (549:16): [True: 30.2k, False: 158k]
  |  Branch (549:50): [True: 29.4k, False: 740]
  |  Branch (549:82): [True: 10, False: 29.4k]
  ------------------
  550|     10|      posEndPhotoshop = startPos;
  551|   188k|    } else if (inRemovableEmbedding && line == removableEmbeddingEndLine) {
  ------------------
  |  Branch (551:16): [True: 70.6k, False: 117k]
  |  Branch (551:40): [True: 8.92k, False: 61.7k]
  ------------------
  552|  8.92k|      inRemovableEmbedding = false;
  553|  8.92k|      removableEmbeddings.back().second = pos;
  554|   179k|    } else if (line == "%%EOF") {
  ------------------
  |  Branch (554:16): [True: 31, False: 179k]
  ------------------
  555|     31|      posEof = startPos;
  556|   179k|    } else {
  557|       |#ifdef DEBUG
  558|       |      significantLine = false;
  559|       |#endif
  560|   179k|    }
  561|       |#ifdef DEBUG
  562|       |    if (significantLine) {
  563|       |      EXV_DEBUG << "readWriteEpsMetadata: Found significant line \"" << line << "\" at position: " << startPos << "\n";
  564|       |    }
  565|       |#endif
  566|   195k|  }
  567|       |
  568|       |  // check for unfinished nested documents
  569|  3.48k|  if (depth != 0) {
  ------------------
  |  Branch (569:7): [True: 38, False: 3.44k]
  ------------------
  570|     38|#ifndef SUPPRESS_WARNINGS
  571|     38|    EXV_WARNING << "Unmatched BeginDocument (" << depth << "x)\n";
  ------------------
  |  |  138|     38|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 38]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     38|  LogMsg(LogMsg::warn).os()
  ------------------
  572|     38|#endif
  573|     38|    throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (573:17): [True: 0, False: 38]
  ------------------
  574|     38|  }
  575|       |
  576|       |  // look for the unmarked trailers of some removable XMP embeddings
  577|  3.44k|  size_t posXmpTrailerEnd = posEof;
  578|  3.67k|  for (size_t i = 0; i < removableEmbeddingsWithUnmarkedTrailer; i++) {
  ------------------
  |  Branch (578:22): [True: 745, False: 2.92k]
  ------------------
  579|    745|    std::string line1;
  580|    745|    const size_t posLine1 = readPrevLine(line1, data, posXmpTrailerEnd, posEndEps);
  581|    745|    std::string line2;
  582|    745|    const size_t posLine2 = readPrevLine(line2, data, posLine1, posEndEps);
  583|    745|    size_t posXmpTrailer;
  584|    745|    if (line1 == "[/EMC pdfmark") {  // Exiftool style
  ------------------
  |  Branch (584:9): [True: 225, False: 520]
  ------------------
  585|    225|      posXmpTrailer = posLine1;
  586|    520|    } else if (line1 == "[/NamespacePop pdfmark" &&
  ------------------
  |  Branch (586:16): [True: 34, False: 486]
  ------------------
  587|     34|               line2 ==
  ------------------
  |  Branch (587:16): [True: 0, False: 34]
  ------------------
  588|     34|                   "[{nextImage} 1 dict begin /Metadata {photoshop_metadata_stream} def currentdict end /PUT "
  589|     34|                   "pdfmark") {  // Photoshop style
  590|      0|      posXmpTrailer = posLine2;
  591|    520|    } else {
  592|    520|#ifndef SUPPRESS_WARNINGS
  593|    520|      EXV_WARNING << "Unable to find XMP embedding trailer ending at position: " << posXmpTrailerEnd << "\n";
  ------------------
  |  |  138|    520|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 520]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    520|  LogMsg(LogMsg::warn).os()
  ------------------
  594|    520|#endif
  595|    520|      if (write)
  ------------------
  |  Branch (595:11): [True: 85, False: 435]
  ------------------
  596|     85|        throw Error(ErrorCode::kerImageWriteFailed);
  597|    435|      break;
  598|    520|    }
  599|    225|    removableEmbeddings.emplace_back(posXmpTrailer, posXmpTrailerEnd);
  600|       |#ifdef DEBUG
  601|       |    auto [r, s] = removableEmbeddings.back();
  602|       |    EXV_DEBUG << "readWriteEpsMetadata: Recognized unmarked trailer of removable XMP embedding at [" << r << "," << s
  603|       |              << ")\n";
  604|       |#endif
  605|    225|    posXmpTrailerEnd = posXmpTrailer;
  606|    225|  }
  607|       |
  608|       |  // interpret comment "%ADO_ContainsXMP:"
  609|  3.36k|  std::string line;
  610|  3.36k|  readLine(line, data, posContainsXmp, posEndEps);
  611|  3.36k|  bool containsXmp;
  612|  3.36k|  if (line == "%ADO_ContainsXMP: MainFirst" || line == "%ADO_ContainsXMP:MainFirst") {
  ------------------
  |  Branch (612:7): [True: 788, False: 2.57k]
  |  Branch (612:48): [True: 12, False: 2.56k]
  ------------------
  613|    405|    containsXmp = true;
  614|  2.95k|  } else if (line.empty() || line == "%ADO_ContainsXMP: NoMain" || line == "%ADO_ContainsXMP:NoMain") {
  ------------------
  |  Branch (614:14): [True: 2.74k, False: 213]
  |  Branch (614:30): [True: 12, False: 201]
  |  Branch (614:68): [True: 13, False: 188]
  ------------------
  615|  2.37k|    containsXmp = false;
  616|  2.37k|  } else {
  617|    583|#ifndef SUPPRESS_WARNINGS
  618|    583|    EXV_WARNING << "Invalid line \"" << line << "\" at position: " << posContainsXmp << "\n";
  ------------------
  |  |  138|    583|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 583]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    583|  LogMsg(LogMsg::warn).os()
  ------------------
  619|    583|#endif
  620|    583|    throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (620:17): [True: 0, False: 583]
  ------------------
  621|    583|  }
  622|       |
  623|  2.78k|  const bool deleteXmp = (write && xmpPacket.empty());
  ------------------
  |  Branch (623:27): [True: 843, False: 1.93k]
  |  Branch (623:36): [True: 773, False: 70]
  ------------------
  624|  2.78k|  bool fixBeginXmlPacket = false;
  625|  2.78k|  bool useFlexibleEmbedding = false;
  626|  2.78k|  size_t xmpPos = posEndEps;
  627|  2.78k|  size_t xmpSize = 0;
  628|  2.78k|  if (containsXmp) {
  ------------------
  |  Branch (628:7): [True: 405, False: 2.37k]
  ------------------
  629|       |    // search for XMP metadata
  630|    405|    findXmp(xmpPos, xmpSize, data, posEps, posEndEps, write);
  631|    405|    if (xmpPos == posEndEps) {
  ------------------
  |  Branch (631:9): [True: 84, False: 321]
  ------------------
  632|     84|#ifndef SUPPRESS_WARNINGS
  633|     84|      EXV_WARNING << "Unable to find XMP metadata as announced at position: " << posContainsXmp << "\n";
  ------------------
  |  |  138|     84|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 84]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     84|  LogMsg(LogMsg::warn).os()
  ------------------
  634|     84|#endif
  635|     84|    }
  636|       |    // check embedding of XMP metadata
  637|    405|    const size_t posLineAfterXmp = readLine(line, data, xmpPos + xmpSize, posEndEps);
  638|    405|    if (!line.empty()) {
  ------------------
  |  Branch (638:9): [True: 188, False: 217]
  ------------------
  639|    188|#ifndef SUPPRESS_WARNINGS
  640|    188|      EXV_WARNING << "Unexpected " << line.size() << " bytes of data after XMP at position: " << (xmpPos + xmpSize)
  ------------------
  |  |  138|    188|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 188]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    188|  LogMsg(LogMsg::warn).os()
  ------------------
  641|      0|                  << "\n";
  642|    188|#endif
  643|    217|    } else if (!deleteXmp) {
  ------------------
  |  Branch (643:16): [True: 156, False: 61]
  ------------------
  644|    156|      readLine(line, data, posLineAfterXmp, posEndEps);
  645|    156|      if (line == "% &&end XMP packet marker&&" || line == "%  &&end XMP packet marker&&") {
  ------------------
  |  Branch (645:11): [True: 35, False: 121]
  |  Branch (645:52): [True: 14, False: 107]
  ------------------
  646|     49|        useFlexibleEmbedding = true;
  647|     49|      }
  648|    156|    }
  649|    405|  }
  650|  2.78k|  if (useFlexibleEmbedding) {
  ------------------
  |  Branch (650:7): [True: 49, False: 2.73k]
  ------------------
  651|       |#ifdef DEBUG
  652|       |    EXV_DEBUG << "readWriteEpsMetadata: Using flexible XMP embedding\n";
  653|       |#endif
  654|     49|    const size_t posBeginXmlPacket = readPrevLine(line, data, xmpPos, posEndEps);
  655|     49|    if (line.starts_with("%begin_xml_packet:")) {
  ------------------
  |  Branch (655:9): [True: 10, False: 39]
  ------------------
  656|       |#ifdef DEBUG
  657|       |      EXV_DEBUG << "readWriteEpsMetadata: XMP embedding contains %begin_xml_packet\n";
  658|       |#endif
  659|     10|      if (write) {
  ------------------
  |  Branch (659:11): [True: 3, False: 7]
  ------------------
  660|      3|        fixBeginXmlPacket = true;
  661|      3|        xmpSize += (xmpPos - posBeginXmlPacket);
  662|      3|        xmpPos = posBeginXmlPacket;
  663|      3|      }
  664|     39|    } else if (posBeginPhotoshop != posEndEps) {
  ------------------
  |  Branch (664:16): [True: 4, False: 35]
  ------------------
  665|      4|#ifndef SUPPRESS_WARNINGS
  666|      4|      EXV_WARNING << "Missing %begin_xml_packet in Photoshop EPS at position: " << xmpPos << "\n";
  ------------------
  |  |  138|      4|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 4]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      4|  LogMsg(LogMsg::warn).os()
  ------------------
  667|      4|#endif
  668|      4|      if (write)
  ------------------
  |  Branch (668:11): [True: 1, False: 3]
  ------------------
  669|      1|        throw Error(ErrorCode::kerImageWriteFailed);
  670|      4|    }
  671|     49|  }
  672|  2.78k|  if (!useFlexibleEmbedding) {
  ------------------
  |  Branch (672:7): [True: 2.69k, False: 89]
  ------------------
  673|       |    // check if there are irremovable XMP metadata blocks before EndPageSetup
  674|  2.69k|    size_t posOtherXmp = containsXmp ? xmpPos : posEps;
  ------------------
  |  Branch (674:26): [True: 315, False: 2.37k]
  ------------------
  675|  2.69k|    size_t sizeOtherXmp = 0;
  676|  4.06k|    for (;;) {
  677|  4.06k|      findXmp(posOtherXmp, sizeOtherXmp, data, posOtherXmp + sizeOtherXmp, posEndPageSetup, write);
  678|  4.06k|      if (posOtherXmp >= posEndPageSetup)
  ------------------
  |  Branch (678:11): [True: 2.42k, False: 1.63k]
  ------------------
  679|  2.42k|        break;
  680|  1.63k|      bool isRemovableEmbedding = false;
  681|  7.24k|      for (const auto& [r, s] : removableEmbeddings) {
  ------------------
  |  Branch (681:31): [True: 7.24k, False: 262]
  ------------------
  682|  7.24k|        if (r <= posOtherXmp && posOtherXmp < s) {
  ------------------
  |  Branch (682:13): [True: 7.21k, False: 26]
  |  Branch (682:33): [True: 1.37k, False: 5.84k]
  ------------------
  683|  1.37k|          isRemovableEmbedding = true;
  684|  1.37k|          break;
  685|  1.37k|        }
  686|  7.24k|      }
  687|  1.63k|      if (!isRemovableEmbedding) {
  ------------------
  |  Branch (687:11): [True: 101, False: 1.53k]
  ------------------
  688|    101|#ifndef SUPPRESS_WARNINGS
  689|    101|        EXV_WARNING << "XMP metadata block is not removable at position: " << posOtherXmp << "\n";
  ------------------
  |  |  138|    101|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 101]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    101|  LogMsg(LogMsg::warn).os()
  ------------------
  690|    101|#endif
  691|    101|        if (write)
  ------------------
  |  Branch (691:13): [True: 11, False: 90]
  ------------------
  692|     11|          throw Error(ErrorCode::kerImageWriteFailed);
  693|     90|        break;
  694|    101|      }
  695|  1.63k|    }
  696|  2.69k|  }
  697|       |
  698|  2.76k|  if (!write) {
  ------------------
  |  Branch (698:7): [True: 1.73k, False: 1.03k]
  ------------------
  699|       |    // copy XMP metadata
  700|  1.73k|    xmpPacket.assign(reinterpret_cast<const char*>(data + xmpPos), xmpSize);
  701|       |
  702|       |    // native previews
  703|  1.73k|    nativePreviews.clear();
  704|  1.73k|    if (posAi7ThumbnailEndData != posEndEps) {
  ------------------
  |  Branch (704:9): [True: 347, False: 1.38k]
  ------------------
  705|    347|      NativePreview nativePreview;
  706|    347|      std::string dummy;
  707|    347|      std::string lineAi7Thumbnail;
  708|    347|      const size_t posBeginData = readLine(lineAi7Thumbnail, data, posAi7Thumbnail, posEndEps);
  709|    347|      std::istringstream lineStreamAi7Thumbnail(lineAi7Thumbnail);
  710|    347|      lineStreamAi7Thumbnail >> dummy;
  711|    347|      lineStreamAi7Thumbnail >> nativePreview.width_;
  712|    347|      lineStreamAi7Thumbnail >> nativePreview.height_;
  713|    347|      std::string depthStr;
  714|    347|      lineStreamAi7Thumbnail >> depthStr;
  715|    347|      std::string lineBeginData;
  716|    347|      const size_t posAfterBeginData = readLine(lineBeginData, data, posBeginData, posEndEps);
  717|    347|      std::istringstream lineStreamBeginData(lineBeginData);
  718|    347|      std::string beginData;
  719|    347|      lineStreamBeginData >> beginData;
  720|    347|      lineStreamBeginData >> dummy;
  721|    347|      std::string type;
  722|    347|      lineStreamBeginData >> type;
  723|    347|      nativePreview.position_ = static_cast<long>(posAfterBeginData);
  724|    347|      nativePreview.size_ = static_cast<uint32_t>(posAi7ThumbnailEndData - posAfterBeginData);
  725|    347|      nativePreview.filter_ = "hex-ai7thumbnail-pnm";
  726|    347|      nativePreview.mimeType_ = "image/x-portable-anymap";
  727|    347|      if (depthStr != "8") {
  ------------------
  |  Branch (727:11): [True: 236, False: 111]
  ------------------
  728|    236|#ifndef SUPPRESS_WARNINGS
  729|    236|        EXV_WARNING << "Unable to handle Illustrator thumbnail depth: " << depthStr << "\n";
  ------------------
  |  |  138|    236|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 236]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    236|  LogMsg(LogMsg::warn).os()
  ------------------
  730|    236|#endif
  731|    236|      } else if (beginData != "%%BeginData:") {
  ------------------
  |  Branch (731:18): [True: 51, False: 60]
  ------------------
  732|     51|#ifndef SUPPRESS_WARNINGS
  733|     51|        EXV_WARNING << "Unable to handle Illustrator thumbnail data section: " << lineBeginData << "\n";
  ------------------
  |  |  138|     51|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 51]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     51|  LogMsg(LogMsg::warn).os()
  ------------------
  734|     51|#endif
  735|     60|      } else if (type != "Hex") {
  ------------------
  |  Branch (735:18): [True: 54, False: 6]
  ------------------
  736|     54|#ifndef SUPPRESS_WARNINGS
  737|     54|        EXV_WARNING << "Unable to handle Illustrator thumbnail data type: " << type << "\n";
  ------------------
  |  |  138|     54|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 54]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     54|  LogMsg(LogMsg::warn).os()
  ------------------
  738|     54|#endif
  739|     54|      } else {
  740|      6|        nativePreviews.push_back(std::move(nativePreview));
  741|      6|      }
  742|    347|    }
  743|  1.73k|    if (posEndPhotoshop != posEndEps) {
  ------------------
  |  Branch (743:9): [True: 6, False: 1.73k]
  ------------------
  744|      6|      auto sizePhotoshop = posEndPhotoshop - posBeginPhotoshop;
  745|      6|      NativePreview nativePreview{posBeginPhotoshop, sizePhotoshop, 0, 0, "hex-irb", "image/jpeg"};
  746|      6|      nativePreviews.push_back(std::move(nativePreview));
  747|      6|    }
  748|  1.73k|    if (sizeWmf != 0) {
  ------------------
  |  Branch (748:9): [True: 2, False: 1.73k]
  ------------------
  749|      2|      NativePreview nativePreview{posWmf, sizeWmf, 0, 0, "", "image/x-wmf"};
  750|      2|      nativePreviews.push_back(std::move(nativePreview));
  751|      2|    }
  752|  1.73k|    if (sizeTiff != 0) {
  ------------------
  |  Branch (752:9): [True: 2, False: 1.73k]
  ------------------
  753|      2|      NativePreview nativePreview{posTiff, sizeTiff, 0, 0, "", "image/tiff"};
  754|      2|      nativePreviews.push_back(std::move(nativePreview));
  755|      2|    }
  756|  1.73k|  } else {
  757|       |    // check for Adobe Illustrator 8.0 or older
  758|  1.03k|    if (illustrator8) {
  ------------------
  |  Branch (758:9): [True: 2, False: 1.03k]
  ------------------
  759|      2|#ifndef SUPPRESS_WARNINGS
  760|      2|      EXV_WARNING << "Unable to write to EPS files created by Adobe Illustrator 8.0 or older.\n";
  ------------------
  |  |  138|      2|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 2]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      2|  LogMsg(LogMsg::warn).os()
  ------------------
  761|      2|#endif
  762|      2|      throw Error(ErrorCode::kerImageWriteFailed);
  763|      2|    }
  764|       |
  765|       |    // create temporary output file
  766|  1.03k|    MemIo tempIo;
  767|  1.03k|    if (!tempIo.isopen()) {
  ------------------
  |  Branch (767:9): [True: 0, False: 1.03k]
  ------------------
  768|      0|#ifndef SUPPRESS_WARNINGS
  769|      0|      EXV_WARNING << "Unable to create temporary file for writing.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  770|      0|#endif
  771|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  772|      0|    }
  773|       |#ifdef DEBUG
  774|       |    EXV_DEBUG << "readWriteEpsMetadata: Created temporary file " << tempIo.path() << "\n";
  775|       |#endif
  776|       |
  777|       |    // sort all positions
  778|  1.03k|    std::vector<size_t> positions;
  779|  1.03k|    positions.push_back(posLanguageLevel);
  780|  1.03k|    positions.push_back(posContainsXmp);
  781|  1.03k|    positions.push_back(posPages);
  782|  1.03k|    positions.push_back(posExiv2Version);
  783|  1.03k|    positions.push_back(posExiv2Website);
  784|  1.03k|    positions.push_back(posEndComments);
  785|  1.03k|    positions.push_back(posPage);
  786|  1.03k|    positions.push_back(posBeginPageSetup);
  787|  1.03k|    positions.push_back(posEndPageSetup);
  788|  1.03k|    positions.push_back(posPageTrailer);
  789|  1.03k|    positions.push_back(posEof);
  790|  1.03k|    positions.push_back(posEndEps);
  791|  1.03k|    if (useFlexibleEmbedding) {
  ------------------
  |  Branch (791:9): [True: 15, False: 1.01k]
  ------------------
  792|     15|      positions.push_back(xmpPos);
  793|     15|    }
  794|  4.15k|    for (const auto& [r, s] : removableEmbeddings) {
  ------------------
  |  Branch (794:29): [True: 4.15k, False: 1.03k]
  ------------------
  795|  4.15k|      positions.push_back(r);
  796|  4.15k|    }
  797|  1.03k|    std::sort(positions.begin(), positions.end());
  798|       |
  799|       |    // assemble result EPS document
  800|  1.03k|    if (dosEps) {
  ------------------
  |  Branch (800:9): [True: 2, False: 1.02k]
  ------------------
  801|       |      // DOS EPS header will be written afterwards
  802|      2|      writeTemp(tempIo, std::string(30, '\x00'));
  803|      2|    }
  804|  1.03k|    const std::string containsXmpLine = deleteXmp ? "%ADO_ContainsXMP: NoMain" : "%ADO_ContainsXMP: MainFirst";
  ------------------
  |  Branch (804:41): [True: 760, False: 271]
  ------------------
  805|  1.03k|    const uint32_t posEpsNew = posTemp(tempIo);
  806|  1.03k|    size_t prevPos = posEps;
  807|  1.03k|    size_t prevSkipPos = prevPos;
  808|  13.7k|    for (const auto& pos : positions) {
  ------------------
  |  Branch (808:26): [True: 13.7k, False: 1.01k]
  ------------------
  809|  13.7k|      if (pos == prevPos)
  ------------------
  |  Branch (809:11): [True: 7.89k, False: 5.89k]
  ------------------
  810|  7.89k|        continue;
  811|       |#ifdef DEBUG
  812|       |      EXV_DEBUG << "readWriteEpsMetadata: Writing at " << pos << "\n";
  813|       |#endif
  814|  5.89k|      if (pos < prevSkipPos) {
  ------------------
  |  Branch (814:11): [True: 17, False: 5.88k]
  ------------------
  815|     17|#ifndef SUPPRESS_WARNINGS
  816|     17|        EXV_WARNING << "Internal error while assembling the result EPS document: "
  ------------------
  |  |  138|     17|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 17]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     17|  LogMsg(LogMsg::warn).os()
  ------------------
  817|      0|                       "Unable to continue at position "
  818|      0|                    << pos << " after skipping to position " << prevSkipPos << "\n";
  819|     17|#endif
  820|     17|        throw Error(ErrorCode::kerImageWriteFailed);
  821|     17|      }
  822|  5.88k|      writeTemp(tempIo, data + prevSkipPos, pos - prevSkipPos);
  823|  5.88k|      const size_t posLineEnd = readLine(line, data, pos, posEndEps);
  824|  5.88k|      size_t skipPos = pos;
  825|       |      // add last line ending if necessary
  826|  5.88k|      if (pos == posEndEps && pos >= 1 && data[pos - 1] != '\r' && data[pos - 1] != '\n') {
  ------------------
  |  Branch (826:11): [True: 812, False: 5.06k]
  |  Branch (826:31): [True: 812, False: 0]
  |  Branch (826:43): [True: 771, False: 41]
  |  Branch (826:68): [True: 716, False: 55]
  ------------------
  827|    716|        writeTemp(tempIo, lineEnding);
  828|       |#ifdef DEBUG
  829|       |        EXV_DEBUG << "readWriteEpsMetadata: Added missing line ending of last line\n";
  830|       |#endif
  831|    716|      }
  832|       |      // update and complement DSC comments
  833|  5.88k|      if (pos == posLanguageLevel && posLanguageLevel != posEndEps && !deleteXmp && !useFlexibleEmbedding &&
  ------------------
  |  Branch (833:11): [True: 814, False: 5.06k]
  |  Branch (833:38): [True: 46, False: 768]
  |  Branch (833:71): [True: 8, False: 38]
  |  Branch (833:85): [True: 5, False: 3]
  ------------------
  834|      5|          (line == "%%LanguageLevel:1" || line == "%%LanguageLevel: 1")) {
  ------------------
  |  Branch (834:12): [True: 1, False: 4]
  |  Branch (834:43): [True: 1, False: 3]
  ------------------
  835|      2|        writeTemp(tempIo, "%%LanguageLevel: 2" + lineEnding);
  836|      2|        skipPos = posLineEnd;
  837|       |#ifdef DEBUG
  838|       |        EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  839|       |#endif
  840|      2|      }
  841|  5.88k|      if (pos == posContainsXmp && posContainsXmp != posEndEps && line != containsXmpLine) {
  ------------------
  |  Branch (841:11): [True: 814, False: 5.06k]
  |  Branch (841:36): [True: 97, False: 717]
  |  Branch (841:67): [True: 27, False: 70]
  ------------------
  842|     27|        writeTemp(tempIo, containsXmpLine + lineEnding);
  843|     27|        skipPos = posLineEnd;
  844|       |#ifdef DEBUG
  845|       |        EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  846|       |#endif
  847|     27|      }
  848|  5.88k|      if (pos == posExiv2Version && posExiv2Version != posEndEps) {
  ------------------
  |  Branch (848:11): [True: 813, False: 5.06k]
  |  Branch (848:37): [True: 29, False: 784]
  ------------------
  849|     29|        writeTemp(tempIo, "%Exiv2Version: " + versionNumberHexString() + lineEnding);
  850|     29|        skipPos = posLineEnd;
  851|       |#ifdef DEBUG
  852|       |        EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  853|       |#endif
  854|     29|      }
  855|  5.88k|      if (pos == posExiv2Website && posExiv2Website != posEndEps) {
  ------------------
  |  Branch (855:11): [True: 812, False: 5.06k]
  |  Branch (855:37): [True: 32, False: 780]
  ------------------
  856|     32|        writeTemp(tempIo, "%Exiv2Website: http://www.exiv2.org/" + lineEnding);
  857|     32|        skipPos = posLineEnd;
  858|       |#ifdef DEBUG
  859|       |        EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  860|       |#endif
  861|     32|      }
  862|  5.88k|      if (pos == posEndComments) {
  ------------------
  |  Branch (862:11): [True: 814, False: 5.06k]
  ------------------
  863|    814|        if (posLanguageLevel == posEndEps && !deleteXmp && !useFlexibleEmbedding) {
  ------------------
  |  Branch (863:13): [True: 769, False: 45]
  |  Branch (863:46): [True: 61, False: 708]
  |  Branch (863:60): [True: 49, False: 12]
  ------------------
  864|     49|          writeTemp(tempIo, "%%LanguageLevel: 2" + lineEnding);
  865|     49|        }
  866|    814|        if (posContainsXmp == posEndEps) {
  ------------------
  |  Branch (866:13): [True: 717, False: 97]
  ------------------
  867|    717|          writeTemp(tempIo, containsXmpLine + lineEnding);
  868|    717|        }
  869|    814|        if (posPages == posEndEps) {
  ------------------
  |  Branch (869:13): [True: 802, False: 12]
  ------------------
  870|    802|          writeTemp(tempIo, "%%Pages: 1" + lineEnding);
  871|    802|        }
  872|    814|        if (posExiv2Version == posEndEps) {
  ------------------
  |  Branch (872:13): [True: 785, False: 29]
  ------------------
  873|    785|          writeTemp(tempIo, "%Exiv2Version: " + versionNumberHexString() + lineEnding);
  874|    785|        }
  875|    814|        if (posExiv2Website == posEndEps) {
  ------------------
  |  Branch (875:13): [True: 782, False: 32]
  ------------------
  876|    782|          writeTemp(tempIo, "%Exiv2Website: http://www.exiv2.org/" + lineEnding);
  877|    782|        }
  878|    814|        readLine(line, data, posEndComments, posEndEps);
  879|    814|        if (line != "%%EndComments") {
  ------------------
  |  Branch (879:13): [True: 812, False: 2]
  ------------------
  880|    812|          writeTemp(tempIo, "%%EndComments" + lineEnding);
  881|    812|        }
  882|    814|      }
  883|  5.88k|      if (pos == posPage && !line.starts_with("%%Page:")) {
  ------------------
  |  Branch (883:11): [True: 814, False: 5.06k]
  |  Branch (883:29): [True: 779, False: 35]
  ------------------
  884|    779|        writeTemp(tempIo, "%%Page: 1 1" + lineEnding);
  885|    779|        writeTemp(tempIo, "%%EndPageComments" + lineEnding);
  886|    779|      }
  887|  5.88k|      if (pos == posBeginPageSetup && line != "%%BeginPageSetup") {
  ------------------
  |  Branch (887:11): [True: 815, False: 5.06k]
  |  Branch (887:39): [True: 807, False: 8]
  ------------------
  888|    807|        writeTemp(tempIo, "%%BeginPageSetup" + lineEnding);
  889|    807|      }
  890|       |      // insert XMP metadata into existing flexible embedding
  891|  5.88k|      if (useFlexibleEmbedding && pos == xmpPos) {
  ------------------
  |  Branch (891:11): [True: 2.11k, False: 3.76k]
  |  Branch (891:35): [True: 15, False: 2.09k]
  ------------------
  892|     15|        if (fixBeginXmlPacket) {
  ------------------
  |  Branch (892:13): [True: 3, False: 12]
  ------------------
  893|      3|          writeTemp(tempIo, "%begin_xml_packet: " + toString(xmpPacket.size()) + lineEnding);
  894|      3|        }
  895|     15|        writeTemp(tempIo, xmpPacket);
  896|     15|        skipPos += xmpSize;
  897|       |#ifdef DEBUG
  898|       |        EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  899|       |#endif
  900|     15|      }
  901|  5.88k|      if (!useFlexibleEmbedding) {
  ------------------
  |  Branch (901:11): [True: 3.76k, False: 2.11k]
  ------------------
  902|       |        // remove preceding embedding(s)
  903|   176k|        for (const auto& [p, s] : removableEmbeddings) {
  ------------------
  |  Branch (903:33): [True: 176k, False: 1.81k]
  ------------------
  904|   176k|          if (pos == p) {
  ------------------
  |  Branch (904:15): [True: 1.95k, False: 174k]
  ------------------
  905|  1.95k|            skipPos = s;
  906|       |#ifdef DEBUG
  907|       |            EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__
  908|       |                      << "\n";
  909|       |#endif
  910|  1.95k|            break;
  911|  1.95k|          }
  912|   176k|        }
  913|       |        // insert XMP metadata with new flexible embedding, if necessary
  914|  3.76k|        if (pos == posEndPageSetup && !deleteXmp) {
  ------------------
  |  Branch (914:13): [True: 800, False: 2.96k]
  |  Branch (914:39): [True: 54, False: 746]
  ------------------
  915|     54|          writeTemp(tempIo, "%Exiv2BeginXMP: Before %%EndPageSetup" + lineEnding);
  916|     54|          if (corelDraw) {
  ------------------
  |  Branch (916:15): [True: 1, False: 53]
  ------------------
  917|      1|            writeTemp(tempIo, "%Exiv2Notice: The following line is needed by CorelDRAW." + lineEnding);
  918|      1|            writeTemp(tempIo, "@rs" + lineEnding);
  919|      1|          }
  920|     54|          if (posBeginPhotoshop != posEndEps) {
  ------------------
  |  Branch (920:15): [True: 3, False: 51]
  ------------------
  921|      3|            writeTemp(tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding);
  922|      3|            writeTemp(tempIo, "%begin_xml_code" + lineEnding);
  923|      3|          }
  924|     54|          writeTemp(tempIo, "/currentdistillerparams where" + lineEnding);
  925|     54|          writeTemp(tempIo, "{pop currentdistillerparams /CoreDistVersion get 5000 lt} {true} ifelse" + lineEnding);
  926|     54|          writeTemp(tempIo, "{userdict /Exiv2_pdfmark /cleartomark load put" + lineEnding);
  927|     54|          writeTemp(tempIo, "    userdict /Exiv2_metafile_pdfmark {flushfile cleartomark} bind put}" + lineEnding);
  928|     54|          writeTemp(tempIo, "{userdict /Exiv2_pdfmark /pdfmark load put" + lineEnding);
  929|     54|          writeTemp(tempIo, "    userdict /Exiv2_metafile_pdfmark {/PUT pdfmark} bind put} ifelse" + lineEnding);
  930|     54|          writeTemp(tempIo, "[/NamespacePush Exiv2_pdfmark" + lineEnding);
  931|     54|          writeTemp(tempIo, "[/_objdef {Exiv2_metadata_stream} /type /stream /OBJ Exiv2_pdfmark" + lineEnding);
  932|     54|          writeTemp(tempIo, "[{Exiv2_metadata_stream} 2 dict begin" + lineEnding);
  933|     54|          writeTemp(tempIo,
  934|     54|                    "    /Type /Metadata def /Subtype /XML def currentdict end /PUT Exiv2_pdfmark" + lineEnding);
  935|     54|          writeTemp(tempIo, "[{Exiv2_metadata_stream}" + lineEnding);
  936|     54|          writeTemp(tempIo, "    currentfile 0 (% &&end XMP packet marker&&)" + lineEnding);
  937|     54|          writeTemp(tempIo, "    /SubFileDecode filter Exiv2_metafile_pdfmark" + lineEnding);
  938|     54|          if (posBeginPhotoshop != posEndEps) {
  ------------------
  |  Branch (938:15): [True: 3, False: 51]
  ------------------
  939|      3|            writeTemp(tempIo,
  940|      3|                      "%Exiv2Notice: The following line is needed by Photoshop. "
  941|      3|                      "Parameter must be exact size of XMP metadata." +
  942|      3|                          lineEnding);
  943|      3|            writeTemp(tempIo, "%begin_xml_packet: " + toString(xmpPacket.size()) + lineEnding);
  944|      3|          }
  945|     54|          writeTemp(tempIo, xmpPacket);
  946|     54|          writeTemp(tempIo, lineEnding);
  947|     54|          writeTemp(tempIo, "% &&end XMP packet marker&&" + lineEnding);
  948|     54|          writeTemp(tempIo, "[/Document 1 dict begin" + lineEnding);
  949|     54|          writeTemp(tempIo,
  950|     54|                    "    /Metadata {Exiv2_metadata_stream} def currentdict end /BDC Exiv2_pdfmark" + lineEnding);
  951|     54|          if (posBeginPhotoshop != posEndEps) {
  ------------------
  |  Branch (951:15): [True: 3, False: 51]
  ------------------
  952|      3|            writeTemp(tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding);
  953|      3|            writeTemp(tempIo, "%end_xml_code" + lineEnding);
  954|      3|          }
  955|     54|          if (corelDraw) {
  ------------------
  |  Branch (955:15): [True: 1, False: 53]
  ------------------
  956|      1|            writeTemp(tempIo, "%Exiv2Notice: The following line is needed by CorelDRAW." + lineEnding);
  957|      1|            writeTemp(tempIo, "@sv" + lineEnding);
  958|      1|          }
  959|     54|          writeTemp(tempIo, "%Exiv2EndXMP" + lineEnding);
  960|     54|        }
  961|  3.76k|      }
  962|  5.88k|      if (pos == posEndPageSetup && line != "%%EndPageSetup") {
  ------------------
  |  Branch (962:11): [True: 814, False: 5.06k]
  |  Branch (962:37): [True: 811, False: 3]
  ------------------
  963|    811|        writeTemp(tempIo, "%%EndPageSetup" + lineEnding);
  964|    811|      }
  965|  5.88k|      if (!useFlexibleEmbedding && pos == posPageTrailer && !deleteXmp) {
  ------------------
  |  Branch (965:11): [True: 3.76k, False: 2.11k]
  |  Branch (965:36): [True: 799, False: 2.97k]
  |  Branch (965:61): [True: 54, False: 745]
  ------------------
  966|     54|        if (!implicitPageTrailer) {
  ------------------
  |  Branch (966:13): [True: 52, False: 2]
  ------------------
  967|     52|          skipPos = posLineEnd;
  968|       |#ifdef DEBUG
  969|       |          EXV_DEBUG << "readWriteEpsMetadata: Skipping to " << skipPos << " at " << __FILE__ << ":" << __LINE__ << "\n";
  970|       |#endif
  971|     52|        }
  972|     54|        writeTemp(tempIo, "%%PageTrailer" + lineEnding);
  973|     54|        writeTemp(tempIo, "%Exiv2BeginXMP: After %%PageTrailer" + lineEnding);
  974|     54|        writeTemp(tempIo, "[/EMC Exiv2_pdfmark" + lineEnding);
  975|     54|        writeTemp(tempIo, "[/NamespacePop Exiv2_pdfmark" + lineEnding);
  976|     54|        writeTemp(tempIo, "%Exiv2EndXMP" + lineEnding);
  977|     54|      }
  978|       |      // add EOF comment if necessary
  979|  5.88k|      if (pos == posEndEps && posEof == posEndEps) {
  ------------------
  |  Branch (979:11): [True: 812, False: 5.06k]
  |  Branch (979:31): [True: 801, False: 11]
  ------------------
  980|    801|        writeTemp(tempIo, "%%EOF" + lineEnding);
  981|    801|      }
  982|  5.88k|      prevPos = pos;
  983|  5.88k|      prevSkipPos = skipPos;
  984|  5.88k|    }
  985|  1.01k|    const uint32_t posEndEpsNew = posTemp(tempIo);
  986|       |#ifdef DEBUG
  987|       |    EXV_DEBUG << "readWriteEpsMetadata: New EPS size: " << (posEndEpsNew - posEpsNew) << "\n";
  988|       |#endif
  989|  1.01k|    if (dosEps) {
  ------------------
  |  Branch (989:9): [True: 2, False: 1.01k]
  ------------------
  990|       |      // write WMF and/or TIFF section if present
  991|      2|      writeTemp(tempIo, data + posWmf, sizeWmf);
  992|      2|      writeTemp(tempIo, data + posTiff, sizeTiff);
  993|       |#ifdef DEBUG
  994|       |      EXV_DEBUG << "readWriteEpsMetadata: New DOS EPS total size: " << posTemp(tempIo) << "\n";
  995|       |#endif
  996|       |      // write DOS EPS header
  997|      2|      if (tempIo.seek(0, BasicIo::beg) != 0) {
  ------------------
  |  Branch (997:11): [True: 0, False: 2]
  ------------------
  998|      0|#ifndef SUPPRESS_WARNINGS
  999|      0|        EXV_WARNING << "Internal error while seeking in temporary file.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 1000|      0|#endif
 1001|      0|        throw Error(ErrorCode::kerImageWriteFailed);
 1002|      0|      }
 1003|      2|      byte dosEpsHeader[30];
 1004|      2|      dosEpsSignature.copy(reinterpret_cast<char*>(dosEpsHeader), dosEpsSignature.size());
 1005|      2|      ul2Data(dosEpsHeader + 4, posEpsNew, littleEndian);
 1006|      2|      ul2Data(dosEpsHeader + 8, posEndEpsNew - posEpsNew, littleEndian);
 1007|      2|      ul2Data(dosEpsHeader + 12, sizeWmf == 0 ? 0 : posEndEpsNew, littleEndian);
  ------------------
  |  Branch (1007:34): [True: 1, False: 1]
  ------------------
 1008|      2|      ul2Data(dosEpsHeader + 16, sizeWmf, littleEndian);
 1009|      2|      ul2Data(dosEpsHeader + 20, sizeTiff == 0 ? 0 : posEndEpsNew + sizeWmf, littleEndian);
  ------------------
  |  Branch (1009:34): [True: 1, False: 1]
  ------------------
 1010|      2|      ul2Data(dosEpsHeader + 24, sizeTiff, littleEndian);
 1011|      2|      us2Data(dosEpsHeader + 28, 0xFFFF, littleEndian);
 1012|      2|      writeTemp(tempIo, dosEpsHeader, sizeof(dosEpsHeader));
 1013|      2|    }
 1014|       |
 1015|       |    // copy temporary file to real output file
 1016|  1.01k|    io.close();
 1017|  1.01k|    io.transfer(tempIo);
 1018|  1.01k|  }
 1019|  2.76k|}
epsimage.cpp:_ZN12_GLOBAL__N_18readLineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPKhmm:
  117|   437k|size_t readLine(std::string& line, const byte* data, size_t startPos, size_t size) {
  118|   437k|  line.clear();
  119|   437k|  size_t pos = startPos;
  120|       |  // step through line
  121|  85.5M|  while (pos < size && data[pos] != '\r' && data[pos] != '\n') {
  ------------------
  |  Branch (121:10): [True: 85.5M, False: 6.88k]
  |  Branch (121:24): [True: 85.3M, False: 253k]
  |  Branch (121:45): [True: 85.1M, False: 177k]
  ------------------
  122|  85.1M|    line += data[pos];
  123|  85.1M|    pos++;
  124|  85.1M|  }
  125|       |  // skip line ending, if present
  126|   437k|  if (pos >= size)
  ------------------
  |  Branch (126:7): [True: 6.88k, False: 430k]
  ------------------
  127|  6.88k|    return pos;
  128|   430k|  pos++;
  129|   430k|  if (pos >= size)
  ------------------
  |  Branch (129:7): [True: 365, False: 430k]
  ------------------
  130|    365|    return pos;
  131|   430k|  if (data[pos - 1] == '\r' && data[pos] == '\n')
  ------------------
  |  Branch (131:7): [True: 252k, False: 177k]
  |  Branch (131:32): [True: 3.08k, False: 249k]
  ------------------
  132|  3.08k|    pos++;
  133|   430k|  return pos;
  134|   430k|}
epsimage.cpp:_ZN12_GLOBAL__N_115onlyWhitespacesERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  110|  4.36k|bool onlyWhitespaces(const std::string& s) {
  111|       |  // According to the DSC 3.0 specification, 4.4 Parsing Rules,
  112|       |  // only spaces and tabs are considered to be white space characters.
  113|  4.36k|  return s.find_first_not_of(" \t") == std::string::npos;
  114|  4.36k|}
epsimage.cpp:_ZN12_GLOBAL__N_112readPrevLineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPKhmm:
  137|  1.53k|size_t readPrevLine(std::string& line, const byte* data, size_t startPos, size_t size) {
  138|  1.53k|  line.clear();
  139|  1.53k|  size_t pos = startPos;
  140|  1.53k|  if (pos > size)
  ------------------
  |  Branch (140:7): [True: 0, False: 1.53k]
  ------------------
  141|      0|    return pos;
  142|       |  // skip line ending of previous line, if present
  143|  1.53k|  if (pos <= 0)
  ------------------
  |  Branch (143:7): [True: 0, False: 1.53k]
  ------------------
  144|      0|    return pos;
  145|  1.53k|  if (data[pos - 1] == '\r' || data[pos - 1] == '\n') {
  ------------------
  |  Branch (145:7): [True: 663, False: 876]
  |  Branch (145:32): [True: 377, False: 499]
  ------------------
  146|  1.04k|    pos--;
  147|  1.04k|    if (pos <= 0)
  ------------------
  |  Branch (147:9): [True: 0, False: 1.04k]
  ------------------
  148|      0|      return pos;
  149|  1.04k|    if (data[pos - 1] == '\r' && data[pos] == '\n') {
  ------------------
  |  Branch (149:9): [True: 86, False: 954]
  |  Branch (149:34): [True: 42, False: 44]
  ------------------
  150|     42|      pos--;
  151|     42|      if (pos <= 0)
  ------------------
  |  Branch (151:11): [True: 0, False: 42]
  ------------------
  152|      0|        return pos;
  153|     42|    }
  154|  1.04k|  }
  155|       |  // step through previous line
  156|  6.93M|  while (pos >= 1 && data[pos - 1] != '\r' && data[pos - 1] != '\n') {
  ------------------
  |  Branch (156:10): [True: 6.93M, False: 4]
  |  Branch (156:22): [True: 6.93M, False: 844]
  |  Branch (156:47): [True: 6.93M, False: 691]
  ------------------
  157|  6.93M|    pos--;
  158|  6.93M|    line += data[pos];
  159|  6.93M|  }
  160|  1.53k|  std::reverse(line.begin(), line.end());
  161|  1.53k|  return pos;
  162|  1.53k|}
epsimage.cpp:_ZN12_GLOBAL__N_17findXmpERmS0_PKhmmb:
  165|  4.46k|void findXmp(size_t& xmpPos, size_t& xmpSize, const byte* data, size_t startPos, size_t size, bool write) {
  166|       |  // search for valid XMP header
  167|  4.46k|  xmpSize = 0;
  168|  22.7M|  for (xmpPos = startPos; xmpPos < size; xmpPos++) {
  ------------------
  |  Branch (168:27): [True: 22.7M, False: 2.51k]
  ------------------
  169|  22.7M|    if (data[xmpPos] != '\x00' && data[xmpPos] != '<')
  ------------------
  |  Branch (169:9): [True: 15.7M, False: 7.00M]
  |  Branch (169:35): [True: 15.7M, False: 17.7k]
  ------------------
  170|  15.7M|      continue;
  171|  56.1M|    for (auto&& header : xmpHeaders) {
  ------------------
  |  Branch (171:24): [True: 56.1M, False: 7.01M]
  ------------------
  172|  56.1M|      if (xmpPos + header.size() > size)
  ------------------
  |  Branch (172:11): [True: 82.2k, False: 56.0M]
  ------------------
  173|  82.2k|        continue;
  174|  56.0M|      if (memcmp(data + xmpPos, header.data(), header.size()) != 0)
  ------------------
  |  Branch (174:11): [True: 56.0M, False: 1.95k]
  ------------------
  175|  56.0M|        continue;
  176|       |#ifdef DEBUG
  177|       |      EXV_DEBUG << "findXmp: Found XMP header at position: " << xmpPos << "\n";
  178|       |#endif
  179|       |
  180|       |      // search for valid XMP trailer
  181|  17.2M|      for (size_t trailerPos = xmpPos + header.size(); trailerPos < size; trailerPos++) {
  ------------------
  |  Branch (181:56): [True: 17.2M, False: 125]
  ------------------
  182|  17.2M|        if (data[trailerPos] != '\x00' && data[trailerPos] != '<')
  ------------------
  |  Branch (182:13): [True: 16.2M, False: 953k]
  |  Branch (182:43): [True: 16.2M, False: 23.5k]
  ------------------
  183|  16.2M|          continue;
  184|  3.90M|        for (const auto& [trailer, readOnly] : xmpTrailers) {
  ------------------
  |  Branch (184:46): [True: 3.90M, False: 975k]
  ------------------
  185|  3.90M|          if (trailerPos + trailer.size() > size)
  ------------------
  |  Branch (185:15): [True: 1.27k, False: 3.90M]
  ------------------
  186|  1.27k|            continue;
  187|  3.90M|          if (memcmp(data + trailerPos, trailer.data(), trailer.size()) != 0)
  ------------------
  |  Branch (187:15): [True: 3.90M, False: 1.82k]
  ------------------
  188|  3.90M|            continue;
  189|       |#ifdef DEBUG
  190|       |          EXV_DEBUG << "findXmp: Found XMP trailer at position: " << trailerPos << "\n";
  191|       |#endif
  192|       |
  193|  1.82k|          if (readOnly) {
  ------------------
  |  Branch (193:15): [True: 18, False: 1.81k]
  ------------------
  194|     18|#ifndef SUPPRESS_WARNINGS
  195|     18|            EXV_WARNING << "Unable to handle read-only XMP metadata yet. Please provide your "
  ------------------
  |  |  138|     18|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 18]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     18|  LogMsg(LogMsg::warn).os()
  ------------------
  196|      0|                           "sample EPS file to the Exiv2 project: http://dev.exiv2.org/projects/exiv2\n";
  197|     18|#endif
  198|     18|            throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (198:25): [True: 0, False: 18]
  ------------------
  199|     18|          }
  200|       |
  201|       |          // search for end of XMP trailer
  202|   244k|          for (size_t trailerEndPos = trailerPos + trailer.size(); trailerEndPos + xmpTrailerEnd.size() <= size;
  ------------------
  |  Branch (202:68): [True: 244k, False: 59]
  ------------------
  203|   244k|               trailerEndPos++) {
  204|   244k|            if (memcmp(data + trailerEndPos, xmpTrailerEnd.data(), xmpTrailerEnd.size()) == 0) {
  ------------------
  |  Branch (204:17): [True: 1.75k, False: 242k]
  ------------------
  205|  1.75k|              xmpSize = (trailerEndPos + xmpTrailerEnd.size()) - xmpPos;
  206|  1.75k|              return;
  207|  1.75k|            }
  208|   244k|          }
  209|     59|#ifndef SUPPRESS_WARNINGS
  210|     59|          EXV_WARNING << "Found XMP header but incomplete XMP trailer.\n";
  ------------------
  |  |  138|     59|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 59]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     59|  LogMsg(LogMsg::warn).os()
  ------------------
  211|     59|#endif
  212|     59|          throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (212:23): [True: 0, False: 59]
  ------------------
  213|  1.81k|        }
  214|   977k|      }
  215|    125|#ifndef SUPPRESS_WARNINGS
  216|    125|      EXV_WARNING << "Found XMP header but no XMP trailer.\n";
  ------------------
  |  |  138|    125|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 125]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    125|  LogMsg(LogMsg::warn).os()
  ------------------
  217|    125|#endif
  218|    125|      throw Error(write ? ErrorCode::kerImageWriteFailed : ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (218:19): [True: 0, False: 125]
  ------------------
  219|  1.95k|    }
  220|  7.01M|  }
  221|  4.46k|}
epsimage.cpp:_ZN12_GLOBAL__N_19writeTempERN5Exiv27BasicIoERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   98|  10.1k|void writeTemp(BasicIo& tempIo, const std::string& data) {
   99|  10.1k|  writeTemp(tempIo, reinterpret_cast<const byte*>(data.data()), data.size());
  100|  10.1k|}
epsimage.cpp:_ZN12_GLOBAL__N_17posTempERKN5Exiv27BasicIoE:
  103|  1.64k|uint32_t posTemp(const BasicIo& tempIo) {
  104|  1.64k|  const size_t pos = tempIo.tell();
  105|  1.64k|  enforce(pos <= std::numeric_limits<uint32_t>::max(), ErrorCode::kerImageWriteFailed);
  106|  1.64k|  return static_cast<uint32_t>(pos);
  107|  1.64k|}
epsimage.cpp:_ZN12_GLOBAL__N_19writeTempERN5Exiv27BasicIoEPKhm:
   86|  16.0k|void writeTemp(BasicIo& tempIo, const byte* data, size_t size) {
   87|  16.0k|  if (size == 0)
  ------------------
  |  Branch (87:7): [True: 679, False: 15.3k]
  ------------------
   88|    679|    return;
   89|  15.3k|  if (tempIo.write(data, size) != size) {
  ------------------
  |  Branch (89:7): [True: 0, False: 15.3k]
  ------------------
   90|      0|#ifndef SUPPRESS_WARNINGS
   91|      0|    EXV_WARNING << "Failed to write to temporary file.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
   92|      0|#endif
   93|      0|    throw Error(ErrorCode::kerImageWriteFailed);
   94|      0|  }
   95|  15.3k|}

_ZN5Exiv26LogMsg8setLevelENS0_5LevelE:
  119|  19.0k|void LogMsg::setLevel(LogMsg::Level level) {
  120|  19.0k|  level_ = level;
  121|  19.0k|}
_ZN5Exiv26LogMsg5levelEv:
  127|  4.50M|LogMsg::Level LogMsg::level() {
  128|  4.50M|  return level_;
  129|  4.50M|}
_ZN5Exiv25ErrorC2ENS_9ErrorCodeE:
  155|  12.7k|Error::Error(ErrorCode code) : code_(code) {
  156|  12.7k|  setMsg(0);
  157|  12.7k|}
_ZNK5Exiv25Error4codeEv:
  159|     40|ErrorCode Error::code() const noexcept {
  160|     40|  return code_;
  161|     40|}
_ZN5Exiv25Error6setMsgEi:
  167|  16.9k|void Error::setMsg(int count) {
  168|  16.9k|  std::string msg{_(errList.at(static_cast<size_t>(code_)))};
  ------------------
  |  |   40|  16.9k|#define _(String) (String)
  ------------------
  169|  16.9k|  auto pos = msg.find("%0");
  170|  16.9k|  if (pos != std::string::npos) {
  ------------------
  |  Branch (170:7): [True: 0, False: 16.9k]
  ------------------
  171|      0|    msg.replace(pos, 2, std::to_string(static_cast<int>(code_)));
  172|      0|  }
  173|  16.9k|  if (count > 0) {
  ------------------
  |  Branch (173:7): [True: 4.25k, False: 12.7k]
  ------------------
  174|  4.25k|    pos = msg.find("%1");
  175|  4.25k|    if (pos != std::string::npos) {
  ------------------
  |  Branch (175:9): [True: 4.25k, False: 0]
  ------------------
  176|  4.25k|      msg.replace(pos, 2, arg1_);
  177|  4.25k|    }
  178|  4.25k|  }
  179|  16.9k|  if (count > 1) {
  ------------------
  |  Branch (179:7): [True: 1, False: 16.9k]
  ------------------
  180|      1|    pos = msg.find("%2");
  181|      1|    if (pos != std::string::npos) {
  ------------------
  |  Branch (181:9): [True: 1, False: 0]
  ------------------
  182|      1|      msg.replace(pos, 2, arg2_);
  183|      1|    }
  184|      1|  }
  185|  16.9k|  if (count > 2) {
  ------------------
  |  Branch (185:7): [True: 0, False: 16.9k]
  ------------------
  186|      0|    pos = msg.find("%3");
  187|      0|    if (pos != std::string::npos) {
  ------------------
  |  Branch (187:9): [True: 0, False: 0]
  ------------------
  188|      0|      msg.replace(pos, 2, arg3_);
  189|      0|    }
  190|      0|  }
  191|  16.9k|  msg_ = std::move(msg);
  192|  16.9k|}

_ZN5Exiv29ExifdatumC2ERKNS_7ExifKeyEPKNS_5ValueE:
  157|  1.70M|Exifdatum::Exifdatum(const ExifKey& key, const Value* pValue) : key_(key.clone()) {
  158|  1.70M|  if (pValue)
  ------------------
  |  Branch (158:7): [True: 1.70M, False: 4.69k]
  ------------------
  159|  1.70M|    value_ = pValue->clone();
  160|  1.70M|}
_ZN5Exiv29ExifdatumC2ERKS0_:
  162|  5.20M|Exifdatum::Exifdatum(const Exifdatum& rhs) {
  163|  5.20M|  if (rhs.key_)
  ------------------
  |  Branch (163:7): [True: 5.20M, False: 0]
  ------------------
  164|  5.20M|    key_ = rhs.key_->clone();  // deep copy
  165|  5.20M|  if (rhs.value_)
  ------------------
  |  Branch (165:7): [True: 5.20M, False: 0]
  ------------------
  166|  5.20M|    value_ = rhs.value_->clone();  // deep copy
  167|  5.20M|}
_ZN5Exiv29ExifdatumD2Ev:
  169|  6.91M|Exifdatum::~Exifdatum() = default;
_ZNK5Exiv29Exifdatum5valueEv:
  203|  24.7k|const Value& Exifdatum::value() const {
  204|  24.7k|  if (!value_)
  ------------------
  |  Branch (204:7): [True: 0, False: 24.7k]
  ------------------
  205|      0|    throw Error(ErrorCode::kerValueNotSet, key());
  206|  24.7k|  return *value_;
  207|  24.7k|}
_ZN5Exiv29ExifdatumaSERKS0_:
  209|  11.3k|Exifdatum& Exifdatum::operator=(const Exifdatum& rhs) {
  210|  11.3k|  if (this == &rhs)
  ------------------
  |  Branch (210:7): [True: 0, False: 11.3k]
  ------------------
  211|      0|    return *this;
  212|       |
  213|  11.3k|  key_.reset();
  214|  11.3k|  if (rhs.key_)
  ------------------
  |  Branch (214:7): [True: 11.3k, False: 0]
  ------------------
  215|  11.3k|    key_ = rhs.key_->clone();  // deep copy
  216|       |
  217|  11.3k|  value_.reset();
  218|  11.3k|  if (rhs.value_)
  ------------------
  |  Branch (218:7): [True: 11.3k, False: 0]
  ------------------
  219|  11.3k|    value_ = rhs.value_->clone();  // deep copy
  220|       |
  221|  11.3k|  return *this;
  222|  11.3k|}  // Exifdatum::operator=
_ZN5Exiv29ExifdatumaSERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  224|  3.02k|Exifdatum& Exifdatum::operator=(const std::string& value) {
  225|  3.02k|  setValue(value);
  226|  3.02k|  return *this;
  227|  3.02k|}
_ZN5Exiv29ExifdatumaSERKt:
  229|     67|Exifdatum& Exifdatum::operator=(const uint16_t& value) {
  230|     67|  return Exiv2::setValue(*this, value);
  231|     67|}
_ZN5Exiv29ExifdatumaSERKj:
  233|  3.34k|Exifdatum& Exifdatum::operator=(const uint32_t& value) {
  234|  3.34k|  return Exiv2::setValue(*this, value);
  235|  3.34k|}
_ZN5Exiv29ExifdatumaSERKNS_5ValueE:
  253|  4.32k|Exifdatum& Exifdatum::operator=(const Value& value) {
  254|  4.32k|  setValue(&value);
  255|  4.32k|  return *this;
  256|  4.32k|}
_ZN5Exiv29Exifdatum8setValueEPKNS_5ValueE:
  258|  4.33k|void Exifdatum::setValue(const Value* pValue) {
  259|  4.33k|  value_.reset();
  260|  4.33k|  if (pValue)
  ------------------
  |  Branch (260:7): [True: 4.33k, False: 0]
  ------------------
  261|  4.33k|    value_ = pValue->clone();
  262|  4.33k|}
_ZN5Exiv29Exifdatum8setValueERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  264|  3.36k|int Exifdatum::setValue(const std::string& value) {
  265|  3.36k|  if (!value_) {
  ------------------
  |  Branch (265:7): [True: 1.94k, False: 1.41k]
  ------------------
  266|  1.94k|    TypeId type = key_->defaultTypeId();
  267|  1.94k|    value_ = Value::create(type);
  268|  1.94k|  }
  269|  3.36k|  return value_->read(value);
  270|  3.36k|}
_ZNK5Exiv29Exifdatum11setDataAreaEPKhm:
  272|     67|int Exifdatum::setDataArea(const byte* buf, size_t len) const {
  273|     67|  return value_ ? value_->setDataArea(buf, len) : -1;
  ------------------
  |  Branch (273:10): [True: 67, False: 0]
  ------------------
  274|     67|}
_ZNK5Exiv29Exifdatum3keyEv:
  276|  82.8M|std::string Exifdatum::key() const {
  277|  82.8M|  return key_ ? key_->key() : "";
  ------------------
  |  Branch (277:10): [True: 82.8M, False: 0]
  ------------------
  278|  82.8M|}
_ZNK5Exiv29Exifdatum9groupNameEv:
  284|  2.60M|std::string Exifdatum::groupName() const {
  285|  2.60M|  return key_ ? key_->groupName() : "";
  ------------------
  |  Branch (285:10): [True: 2.60M, False: 0]
  ------------------
  286|  2.60M|}
_ZNK5Exiv29Exifdatum7tagNameEv:
  288|    293|std::string Exifdatum::tagName() const {
  289|    293|  return key_ ? key_->tagName() : "";
  ------------------
  |  Branch (289:10): [True: 293, False: 0]
  ------------------
  290|    293|}
_ZNK5Exiv29Exifdatum3tagEv:
  300|  7.15M|uint16_t Exifdatum::tag() const {
  301|  7.15M|  return key_ ? key_->tag() : 0xffff;
  ------------------
  |  Branch (301:10): [True: 7.15M, False: 0]
  ------------------
  302|  7.15M|}
_ZNK5Exiv29Exifdatum5ifdIdEv:
  304|  11.7M|IfdId Exifdatum::ifdId() const {
  305|  11.7M|  return key_ ? key_->ifdId() : IfdId::ifdIdNotSet;
  ------------------
  |  Branch (305:10): [True: 11.7M, False: 0]
  ------------------
  306|  11.7M|}
_ZNK5Exiv29Exifdatum3idxEv:
  312|  2.65M|int Exifdatum::idx() const {
  313|  2.65M|  return key_ ? key_->idx() : 0;
  ------------------
  |  Branch (313:10): [True: 2.65M, False: 0]
  ------------------
  314|  2.65M|}
_ZNK5Exiv29Exifdatum4copyEPhNS_9ByteOrderE:
  316|  4.59k|size_t Exifdatum::copy(byte* buf, ByteOrder byteOrder) const {
  317|  4.59k|  return value_ ? value_->copy(buf, byteOrder) : 0;
  ------------------
  |  Branch (317:10): [True: 4.59k, False: 0]
  ------------------
  318|  4.59k|}
_ZNK5Exiv29Exifdatum6typeIdEv:
  320|    302|TypeId Exifdatum::typeId() const {
  321|    302|  return value_ ? value_->typeId() : invalidTypeId;
  ------------------
  |  Branch (321:10): [True: 302, False: 0]
  ------------------
  322|    302|}
_ZNK5Exiv29Exifdatum8typeSizeEv:
  328|     80|size_t Exifdatum::typeSize() const {
  329|     80|  return TypeInfo::typeSize(typeId());
  330|     80|}
_ZNK5Exiv29Exifdatum5countEv:
  332|   110k|size_t Exifdatum::count() const {
  333|   110k|  return value_ ? value_->count() : 0;
  ------------------
  |  Branch (333:10): [True: 110k, False: 0]
  ------------------
  334|   110k|}
_ZNK5Exiv29Exifdatum4sizeEv:
  336|  3.76M|size_t Exifdatum::size() const {
  337|  3.76M|  return value_ ? value_->size() : 0;
  ------------------
  |  Branch (337:10): [True: 3.76M, False: 0]
  ------------------
  338|  3.76M|}
_ZNK5Exiv29Exifdatum8toStringEv:
  340|  15.9k|std::string Exifdatum::toString() const {
  341|  15.9k|  return value_ ? value_->toString() : "";
  ------------------
  |  Branch (341:10): [True: 15.9k, False: 0]
  ------------------
  342|  15.9k|}
_ZNK5Exiv29Exifdatum7toInt64Em:
  348|   117k|int64_t Exifdatum::toInt64(size_t n) const {
  349|   117k|  return value_ ? value_->toInt64(n) : -1;
  ------------------
  |  Branch (349:10): [True: 117k, False: 0]
  ------------------
  350|   117k|}
_ZNK5Exiv29Exifdatum8getValueEv:
  360|  2.37M|Value::UniquePtr Exifdatum::getValue() const {
  361|  2.37M|  return value_ ? value_->clone() : nullptr;
  ------------------
  |  Branch (361:10): [True: 2.37M, False: 0]
  ------------------
  362|  2.37M|}
_ZNK5Exiv29Exifdatum12sizeDataAreaEv:
  364|    215|size_t Exifdatum::sizeDataArea() const {
  365|    215|  return value_ ? value_->sizeDataArea() : 0;
  ------------------
  |  Branch (365:10): [True: 215, False: 0]
  ------------------
  366|    215|}
_ZNK5Exiv29Exifdatum8dataAreaEv:
  368|    220|DataBuf Exifdatum::dataArea() const {
  369|    220|  return value_ ? value_->dataArea() : DataBuf(nullptr, 0);
  ------------------
  |  Branch (369:10): [True: 220, False: 0]
  ------------------
  370|    220|}
_ZN5Exiv210ExifThumbCC2ERKNS_8ExifDataE:
  372|    242|ExifThumbC::ExifThumbC(const ExifData& exifData) : exifData_(exifData) {
  373|    242|}
_ZNK5Exiv210ExifThumbC4copyEv:
  375|    175|DataBuf ExifThumbC::copy() const {
  376|    175|  auto thumbnail = Thumbnail::create(exifData_);
  377|    175|  if (!thumbnail)
  ------------------
  |  Branch (377:7): [True: 158, False: 17]
  ------------------
  378|    158|    return {};
  379|     17|  return thumbnail->copy(exifData_);
  380|    175|}
_ZN5Exiv29ExifThumbC2ERNS_8ExifDataE:
  411|     67|ExifThumb::ExifThumb(ExifData& exifData) : ExifThumbC(exifData), exifData_(exifData) {
  412|     67|}
_ZN5Exiv29ExifThumb16setJpegThumbnailEPKhm:
  435|     67|void ExifThumb::setJpegThumbnail(const byte* buf, size_t size) {
  436|     67|  exifData_["Exif.Thumbnail.Compression"] = std::uint16_t{6};
  437|     67|  Exifdatum& format = exifData_["Exif.Thumbnail.JPEGInterchangeFormat"];
  438|     67|  format = 0U;
  439|     67|  format.setDataArea(buf, size);
  440|     67|  exifData_["Exif.Thumbnail.JPEGInterchangeFormatLength"] = static_cast<uint32_t>(size);
  441|     67|}
_ZN5Exiv28ExifDataixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  447|  13.8k|Exifdatum& ExifData::operator[](const std::string& key) {
  448|  13.8k|  ExifKey exifKey(key);
  449|  13.8k|  auto pos = findKey(exifKey);
  450|  13.8k|  if (pos == end()) {
  ------------------
  |  Branch (450:7): [True: 4.36k, False: 9.50k]
  ------------------
  451|  4.36k|    return exifMetadata_.emplace_back(exifKey);
  452|  4.36k|  }
  453|  9.50k|  return *pos;
  454|  13.8k|}
_ZN5Exiv28ExifData3addERKNS_7ExifKeyEPKNS_5ValueE:
  456|  1.69M|void ExifData::add(const ExifKey& key, const Value* pValue) {
  457|  1.69M|  add(Exifdatum(key, pValue));
  458|  1.69M|}
_ZN5Exiv28ExifData3addERKNS_9ExifdatumE:
  460|  1.90M|void ExifData::add(const Exifdatum& exifdatum) {
  461|       |  // allow duplicates
  462|  1.90M|  exifMetadata_.push_back(exifdatum);
  463|  1.90M|}
_ZNK5Exiv28ExifData7findKeyERKNS_7ExifKeyE:
  465|   258k|ExifData::const_iterator ExifData::findKey(const ExifKey& key) const {
  466|   258k|  return std::find_if(exifMetadata_.begin(), exifMetadata_.end(), FindExifdatumByKey(key.key()));
  467|   258k|}
_ZN5Exiv28ExifData7findKeyERKNS_7ExifKeyE:
  469|   543k|ExifData::iterator ExifData::findKey(const ExifKey& key) {
  470|   543k|  return std::find_if(exifMetadata_.begin(), exifMetadata_.end(), FindExifdatumByKey(key.key()));
  471|   543k|}
_ZN5Exiv28ExifData5clearEv:
  473|  28.5k|void ExifData::clear() {
  474|  28.5k|  exifMetadata_.clear();
  475|  28.5k|}
_ZN5Exiv28ExifData5eraseENSt3__115__list_iteratorINS_9ExifdatumEPvEES5_:
  485|  55.8k|ExifData::iterator ExifData::erase(ExifData::iterator beg, ExifData::iterator end) {
  486|  55.8k|  return exifMetadata_.erase(beg, end);
  487|  55.8k|}
_ZN5Exiv28ExifData5eraseENSt3__115__list_iteratorINS_9ExifdatumEPvEE:
  489|  58.3k|ExifData::iterator ExifData::erase(ExifData::iterator pos) {
  490|  58.3k|  return exifMetadata_.erase(pos);
  491|  58.3k|}
_ZN5Exiv212DecodeParamsC2Em:
  493|  22.5k|DecodeParams::DecodeParams(size_t max_recursion_depth) : max_recursion_depth_(max_recursion_depth) {
  494|  22.5k|}
_ZN5Exiv210ExifParser6decodeERNS_8ExifDataEPKhmRKNS_12DecodeParamsE:
  496|    302|ByteOrder ExifParser::decode(ExifData& exifData, const byte* pData, size_t size, const DecodeParams& dp) {
  497|    302|  IptcData iptcData;
  498|    302|  XmpData xmpData;
  499|    302|  ByteOrder bo = TiffParser::decode(exifData, iptcData, xmpData, pData, size, dp);
  500|    302|#ifndef SUPPRESS_WARNINGS
  501|    302|  if (!iptcData.empty()) {
  ------------------
  |  Branch (501:7): [True: 55, False: 247]
  ------------------
  502|     55|    EXV_WARNING << "Ignoring IPTC information encoded in the Exif data.\n";
  ------------------
  |  |  138|     55|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 55]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     55|  LogMsg(LogMsg::warn).os()
  ------------------
  503|     55|  }
  504|    302|  if (!xmpData.empty()) {
  ------------------
  |  Branch (504:7): [True: 1, False: 301]
  ------------------
  505|      1|    EXV_WARNING << "Ignoring XMP information encoded in the Exif data.\n";
  ------------------
  |  |  138|      1|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 1]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      1|  LogMsg(LogMsg::warn).os()
  ------------------
  506|      1|  }
  507|    302|#endif
  508|    302|  return bo;
  509|    302|}
_ZN5Exiv210ExifParser6encodeERNSt3__16vectorIhNS1_9allocatorIhEEEEPKhmNS_9ByteOrderERNS_8ExifDataE:
  515|  3.71k|WriteMethod ExifParser::encode(Blob& blob, const byte* pData, size_t size, ByteOrder byteOrder, ExifData& exifData) {
  516|       |  // Delete IFD0 tags that are "not recorded" in compressed images
  517|       |  // Reference: Exif 2.2 specs, 4.6.8 Tag Support Levels, section A
  518|  3.71k|  static constexpr auto filteredIfd0Tags = std::array{
  519|  3.71k|      "Exif.Image.PhotometricInterpretation",
  520|  3.71k|      "Exif.Image.StripOffsets",
  521|  3.71k|      "Exif.Image.RowsPerStrip",
  522|  3.71k|      "Exif.Image.StripByteCounts",
  523|  3.71k|      "Exif.Image.JPEGInterchangeFormat",
  524|  3.71k|      "Exif.Image.JPEGInterchangeFormatLength",
  525|  3.71k|      "Exif.Image.SubIFDs",
  526|       |      // Issue 981.  Never allow manufactured data to be written
  527|  3.71k|      "Exif.Canon.AFInfoSize",
  528|  3.71k|      "Exif.Canon.AFAreaMode",
  529|  3.71k|      "Exif.Canon.AFNumPoints",
  530|  3.71k|      "Exif.Canon.AFValidPoints",
  531|  3.71k|      "Exif.Canon.AFCanonImageWidth",
  532|  3.71k|      "Exif.Canon.AFCanonImageHeight",
  533|  3.71k|      "Exif.Canon.AFImageWidth",
  534|  3.71k|      "Exif.Canon.AFImageHeight",
  535|  3.71k|      "Exif.Canon.AFAreaWidths",
  536|  3.71k|      "Exif.Canon.AFAreaHeights",
  537|  3.71k|      "Exif.Canon.AFXPositions",
  538|  3.71k|      "Exif.Canon.AFYPositions",
  539|  3.71k|      "Exif.Canon.AFPointsInFocus",
  540|  3.71k|      "Exif.Canon.AFPointsSelected",
  541|  3.71k|      "Exif.Canon.AFPointsUnusable",
  542|  3.71k|      "Exif.Canon.AFFineRotation",
  543|  3.71k|  };
  544|  85.3k|  for (auto&& filteredIfd0Tag : filteredIfd0Tags) {
  ------------------
  |  Branch (544:31): [True: 85.3k, False: 3.71k]
  ------------------
  545|  85.3k|    auto pos = exifData.findKey(ExifKey(filteredIfd0Tag));
  546|  85.3k|    if (pos != exifData.end()) {
  ------------------
  |  Branch (546:9): [True: 454, False: 84.8k]
  ------------------
  547|       |#ifdef EXIV2_DEBUG_MESSAGES
  548|       |      std::cerr << "Warning: Exif tag " << pos->key() << " not encoded\n";
  549|       |#endif
  550|    454|      exifData.erase(pos);
  551|    454|    }
  552|  85.3k|  }
  553|       |
  554|       |  // Delete IFDs which do not occur in JPEGs
  555|  3.71k|  static constexpr auto filteredIfds = std::array{
  556|  3.71k|      IfdId::subImage1Id, IfdId::subImage2Id, IfdId::subImage3Id, IfdId::subImage4Id, IfdId::subImage5Id,
  557|  3.71k|      IfdId::subImage6Id, IfdId::subImage7Id, IfdId::subImage8Id, IfdId::subImage9Id, IfdId::subThumb1Id,
  558|  3.71k|      IfdId::panaRawId,   IfdId::ifd2Id,      IfdId::ifd3Id,
  559|  3.71k|  };
  560|  48.2k|  for (auto&& filteredIfd : filteredIfds) {
  ------------------
  |  Branch (560:27): [True: 48.2k, False: 3.71k]
  ------------------
  561|       |#ifdef EXIV2_DEBUG_MESSAGES
  562|       |    std::cerr << "Warning: Exif IFD " << filteredIfd << " not encoded\n";
  563|       |#endif
  564|  48.2k|    eraseIfd(exifData, filteredIfd);
  565|  48.2k|  }
  566|       |
  567|       |  // IPTC and XMP are stored elsewhere, not in the Exif APP1 segment.
  568|  3.71k|  IptcData emptyIptc;
  569|  3.71k|  XmpData emptyXmp;
  570|       |
  571|       |  // Encode and check if the result fits into a JPEG Exif APP1 segment
  572|  3.71k|  MemIo mio1;
  573|  3.71k|  TiffHeader header(byteOrder, 0x00000008, false);
  574|  3.71k|  WriteMethod wm = TiffParserWorker::encode(mio1, pData, size, exifData, emptyIptc, emptyXmp, Tag::root,
  575|  3.71k|                                            TiffMapping::findEncoder, &header, nullptr);
  576|  3.71k|  if (mio1.size() <= 65527) {
  ------------------
  |  Branch (576:7): [True: 1.81k, False: 1.89k]
  ------------------
  577|  1.81k|    append(blob, mio1.mmap(), mio1.size());
  578|  1.81k|    return wm;
  579|  1.81k|  }
  580|       |
  581|       |  // If it doesn't fit, remove additional tags
  582|       |
  583|       |  // Delete preview tags if the preview is larger than 32kB.
  584|       |  // Todo: Enhance preview classes to be able to write and delete previews and use that instead.
  585|       |  // Table must be sorted by preview, the first tag in each group is the size
  586|  1.89k|  static constexpr auto filteredPvTags = std::array{
  587|  1.89k|      std::pair(pttLen, "Exif.Minolta.ThumbnailLength"),
  588|  1.89k|      std::pair(pttTag, "Exif.Minolta.ThumbnailOffset"),
  589|  1.89k|      std::pair(pttLen, "Exif.Minolta.Thumbnail"),
  590|  1.89k|      std::pair(pttLen, "Exif.NikonPreview.JPEGInterchangeFormatLength"),
  591|  1.89k|      std::pair(pttIfd, "NikonPreview"),
  592|  1.89k|      std::pair(pttLen, "Exif.Olympus.ThumbnailLength"),
  593|  1.89k|      std::pair(pttTag, "Exif.Olympus.ThumbnailOffset"),
  594|  1.89k|      std::pair(pttLen, "Exif.Olympus.ThumbnailImage"),
  595|  1.89k|      std::pair(pttLen, "Exif.Olympus.Thumbnail"),
  596|  1.89k|      std::pair(pttLen, "Exif.Olympus2.ThumbnailLength"),
  597|  1.89k|      std::pair(pttTag, "Exif.Olympus2.ThumbnailOffset"),
  598|  1.89k|      std::pair(pttLen, "Exif.Olympus2.ThumbnailImage"),
  599|  1.89k|      std::pair(pttLen, "Exif.Olympus2.Thumbnail"),
  600|  1.89k|      std::pair(pttLen, "Exif.OlympusCs.PreviewImageLength"),
  601|  1.89k|      std::pair(pttTag, "Exif.OlympusCs.PreviewImageStart"),
  602|  1.89k|      std::pair(pttTag, "Exif.OlympusCs.PreviewImageValid"),
  603|  1.89k|      std::pair(pttLen, "Exif.Pentax.PreviewLength"),
  604|  1.89k|      std::pair(pttTag, "Exif.Pentax.PreviewOffset"),
  605|  1.89k|      std::pair(pttTag, "Exif.Pentax.PreviewResolution"),
  606|  1.89k|      std::pair(pttLen, "Exif.PentaxDng.PreviewLength"),
  607|  1.89k|      std::pair(pttTag, "Exif.PentaxDng.PreviewOffset"),
  608|  1.89k|      std::pair(pttTag, "Exif.PentaxDng.PreviewResolution"),
  609|  1.89k|      std::pair(pttLen, "Exif.SamsungPreview.JPEGInterchangeFormatLength"),
  610|  1.89k|      std::pair(pttIfd, "SamsungPreview"),
  611|  1.89k|      std::pair(pttLen, "Exif.Thumbnail.StripByteCounts"),
  612|  1.89k|      std::pair(pttIfd, "Thumbnail"),
  613|  1.89k|      std::pair(pttLen, "Exif.Thumbnail.JPEGInterchangeFormatLength"),
  614|  1.89k|      std::pair(pttIfd, "Thumbnail"),
  615|  1.89k|  };
  616|  1.89k|  bool delTags = false;
  617|  53.0k|  for (auto&& [ptt, key] : filteredPvTags) {
  ------------------
  |  Branch (617:26): [True: 53.0k, False: 1.89k]
  ------------------
  618|  53.0k|    switch (ptt) {
  ------------------
  |  Branch (618:13): [True: 53.0k, False: 0]
  ------------------
  619|  28.4k|      case pttLen: {
  ------------------
  |  Branch (619:7): [True: 28.4k, False: 24.6k]
  ------------------
  620|  28.4k|        delTags = false;
  621|  28.4k|        if (auto pos = exifData.findKey(ExifKey(key)); pos != exifData.end() && sumToLong(*pos) > 32768) {
  ------------------
  |  Branch (621:56): [True: 1.18k, False: 27.2k]
  |  Branch (621:56): [True: 27, False: 28.3k]
  |  Branch (621:81): [True: 27, False: 1.15k]
  ------------------
  622|     27|          delTags = true;
  623|     27|#ifndef SUPPRESS_WARNINGS
  624|     27|          EXV_WARNING << "Exif tag " << pos->key() << " not encoded\n";
  ------------------
  |  |  138|     27|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 27]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     27|  LogMsg(LogMsg::warn).os()
  ------------------
  625|     27|#endif
  626|     27|          exifData.erase(pos);
  627|     27|        }
  628|  28.4k|        break;
  629|      0|      }
  630|  17.0k|      case pttTag: {
  ------------------
  |  Branch (630:7): [True: 17.0k, False: 35.9k]
  ------------------
  631|  17.0k|        if (delTags) {
  ------------------
  |  Branch (631:13): [True: 18, False: 17.0k]
  ------------------
  632|     18|          if (auto pos = exifData.findKey(ExifKey(key)); pos != exifData.end()) {
  ------------------
  |  Branch (632:58): [True: 9, False: 9]
  ------------------
  633|      9|#ifndef SUPPRESS_WARNINGS
  634|      9|            EXV_WARNING << "Exif tag " << pos->key() << " not encoded\n";
  ------------------
  |  |  138|      9|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 9]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      9|  LogMsg(LogMsg::warn).os()
  ------------------
  635|      9|#endif
  636|      9|            exifData.erase(pos);
  637|      9|          }
  638|     18|        }
  639|  17.0k|        break;
  640|      0|      }
  641|  7.57k|      case pttIfd:
  ------------------
  |  Branch (641:7): [True: 7.57k, False: 45.4k]
  ------------------
  642|  7.57k|        if (delTags) {
  ------------------
  |  Branch (642:13): [True: 7, False: 7.57k]
  ------------------
  643|      7|#ifndef SUPPRESS_WARNINGS
  644|      7|          EXV_WARNING << "Exif IFD " << key << " not encoded\n";
  ------------------
  |  |  138|      7|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 7]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      7|  LogMsg(LogMsg::warn).os()
  ------------------
  645|      7|#endif
  646|      7|          eraseIfd(exifData, Internal::groupId(key));
  647|      7|        }
  648|  7.57k|        break;
  649|  53.0k|    }
  650|  53.0k|  }
  651|       |
  652|       |  // Delete unknown tags larger than 4kB and known tags larger than 20kB.
  653|  1.89k|  auto f = [](const auto& tag) { return (tag.size() > 4096 && tag.tagName().starts_with("0x")) || tag.size() > 20480; };
  654|  1.89k|  exifData.erase(std::remove_if(exifData.begin(), exifData.end(), f), exifData.end());
  655|       |
  656|       |  // Encode the remaining Exif tags again, don't care if it fits this time
  657|  1.89k|  MemIo mio2;
  658|  1.89k|  wm = TiffParserWorker::encode(mio2, pData, size, exifData, emptyIptc, emptyXmp, Tag::root, TiffMapping::findEncoder,
  659|  1.89k|                                &header, nullptr);
  660|  1.89k|  append(blob, mio2.mmap(), mio2.size());
  661|       |#ifdef EXIV2_DEBUG_MESSAGES
  662|       |  if (wm == wmIntrusive) {
  663|       |    std::cerr << "SIZE OF EXIF DATA IS " << std::dec << mio2.size() << " BYTES\n";
  664|       |  } else {
  665|       |    std::cerr << "SIZE DOESN'T MATTER, NON-INTRUSIVE WRITING USED\n";
  666|       |  }
  667|       |#endif
  668|  1.89k|  return wm;
  669|       |
  670|  1.89k|}  // ExifParser::encode
exif.cpp:_ZNK12_GLOBAL__N_118FindExifdatumByKeyclERKN5Exiv29ExifdatumE:
   45|  82.7M|  bool operator()(const Exiv2::Exifdatum& exifdatum) const {
   46|  82.7M|    return key_ == exifdatum.key();
   47|  82.7M|  }
exif.cpp:_ZN12_GLOBAL__N_118FindExifdatumByKeyC2ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   39|   802k|  explicit FindExifdatumByKey(std::string key) : key_(std::move(key)) {
   40|   802k|  }
exif.cpp:_ZZN5Exiv210ExifParser6encodeERNSt3__16vectorIhNS1_9allocatorIhEEEEPKhmNS_9ByteOrderERNS_8ExifDataEENK3$_0clINS_9ExifdatumEEEDaRKT_:
  653|   694k|  auto f = [](const auto& tag) { return (tag.size() > 4096 && tag.tagName().starts_with("0x")) || tag.size() > 20480; };
  ------------------
  |  Branch (653:42): [True: 293, False: 694k]
  |  Branch (653:63): [True: 210, False: 83]
  |  Branch (653:99): [True: 42, False: 694k]
  ------------------
exif.cpp:_ZN12_GLOBAL__N_19Thumbnail6createERKN5Exiv28ExifDataE:
  678|    175|Thumbnail::UniquePtr Thumbnail::create(const Exiv2::ExifData& exifData) {
  679|    175|  const Exiv2::ExifKey k1("Exif.Thumbnail.Compression");
  680|    175|  auto pos = exifData.findKey(k1);
  681|    175|  if (pos != exifData.end()) {
  ------------------
  |  Branch (681:7): [True: 17, False: 158]
  ------------------
  682|     17|    if (pos->count() == 0)
  ------------------
  |  Branch (682:9): [True: 0, False: 17]
  ------------------
  683|      0|      return nullptr;
  684|     17|    if (pos->toInt64() == 6)
  ------------------
  |  Branch (684:9): [True: 17, False: 0]
  ------------------
  685|     17|      return std::make_unique<JpegThumbnail>();
  686|      0|    return std::make_unique<TiffThumbnail>();
  687|     17|  }
  688|       |
  689|    158|  const Exiv2::ExifKey k2("Exif.Thumbnail.JPEGInterchangeFormat");
  690|    158|  pos = exifData.findKey(k2);
  691|    158|  if (pos != exifData.end())
  ------------------
  |  Branch (691:7): [True: 0, False: 158]
  ------------------
  692|      0|    return std::make_unique<JpegThumbnail>();
  693|    158|  return nullptr;
  694|    158|}
exif.cpp:_ZN12_GLOBAL__N_19ThumbnailC2Ev:
   67|     17|  Thumbnail() = default;
exif.cpp:_ZN12_GLOBAL__N_19ThumbnailD2Ev:
   69|     17|  virtual ~Thumbnail() = default;
exif.cpp:_ZNK12_GLOBAL__N_113JpegThumbnail4copyERKN5Exiv28ExifDataE:
  729|     17|Exiv2::DataBuf JpegThumbnail::copy(const Exiv2::ExifData& exifData) const {
  730|     17|  Exiv2::ExifKey key("Exif.Thumbnail.JPEGInterchangeFormat");
  731|     17|  auto format = exifData.findKey(key);
  732|     17|  if (format == exifData.end())
  ------------------
  |  Branch (732:7): [True: 0, False: 17]
  ------------------
  733|      0|    return {};
  734|     17|  return format->dataArea();
  735|     17|}
exif.cpp:_ZN12_GLOBAL__N_19sumToLongERKN5Exiv29ExifdatumE:
  737|  1.18k|int64_t sumToLong(const Exiv2::Exifdatum& md) {
  738|  1.18k|  int64_t sum = 0;
  739|  73.0k|  for (size_t i = 0; i < md.count(); ++i) {
  ------------------
  |  Branch (739:22): [True: 71.8k, False: 1.18k]
  ------------------
  740|  71.8k|    sum = Safe::add(sum, md.toInt64(i));
  741|  71.8k|  }
  742|  1.18k|  return sum;
  743|  1.18k|}
exif.cpp:_ZN12_GLOBAL__N_18eraseIfdERN5Exiv28ExifDataENS0_5IfdIdE:
  745|  48.2k|void eraseIfd(Exiv2::ExifData& ed, Exiv2::IfdId ifdId) {
  746|  48.2k|  ed.erase(std::remove_if(ed.begin(), ed.end(), Exiv2::FindExifdatum(ifdId)), ed.end());
  747|  48.2k|}
_ZN5Exiv28setValueItEERNS_9ExifdatumES2_RKT_:
  150|     67|Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value) {
  151|     67|  auto v = std::make_unique<Exiv2::ValueType<T>>();
  152|     67|  v->value_.push_back(value);
  153|     67|  exifDatum.value_ = std::move(v);
  154|     67|  return exifDatum;
  155|     67|}
_ZN5Exiv28setValueIjEERNS_9ExifdatumES2_RKT_:
  150|  3.34k|Exiv2::Exifdatum& setValue(Exiv2::Exifdatum& exifDatum, const T& value) {
  151|  3.34k|  auto v = std::make_unique<Exiv2::ValueType<T>>();
  152|  3.34k|  v->value_.push_back(value);
  153|  3.34k|  exifDatum.value_ = std::move(v);
  154|  3.34k|  return exifDatum;
  155|  3.34k|}

_ZN5Exiv28Internal13FujiMakerNote7tagListEv:
   19|    678|  static constexpr auto tagList() {
   20|    678|    return tagInfo_;
   21|    678|  }

_ZN5Exiv28GifImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   20|     57|    Image(ImageType::gif, mdNone, std::move(io), params) {
   21|     57|}
_ZN5Exiv28GifImage12readMetadataEv:
   42|     50|void GifImage::readMetadata() {
   43|       |#ifdef EXIV2_DEBUG_MESSAGES
   44|       |  std::cerr << "Exiv2::GifImage::readMetadata: Reading GIF file " << io_->path() << "\n";
   45|       |#endif
   46|     50|  if (io_->open() != 0) {
  ------------------
  |  Branch (46:7): [True: 0, False: 50]
  ------------------
   47|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   48|      0|  }
   49|     50|  IoCloser closer(*io_);
   50|       |  // Ensure that this is the correct image type
   51|     50|  if (!isGifType(*io_, true)) {
  ------------------
  |  Branch (51:7): [True: 0, False: 50]
  ------------------
   52|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (52:9): [True: 0, False: 0]
  |  Branch (52:25): [True: 0, False: 0]
  ------------------
   53|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   54|      0|    throw Error(ErrorCode::kerNotAnImage, "GIF");
   55|      0|  }
   56|     50|  clearMetadata();
   57|       |
   58|     50|  byte buf[4];
   59|     50|  if (io_->read(buf, sizeof(buf)) == sizeof(buf)) {
  ------------------
  |  Branch (59:7): [True: 50, False: 0]
  ------------------
   60|     50|    pixelWidth_ = getShort(buf, littleEndian);
   61|     50|    pixelHeight_ = getShort(buf + 2, littleEndian);
   62|     50|  }
   63|     50|}  // GifImage::readMetadata
_ZN5Exiv28GifImage13writeMetadataEv:
   65|      1|void GifImage::writeMetadata() {
   66|       |  // Todo: implement me!
   67|      1|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "GIF"));
   68|      1|}  // GifImage::writeMetadata
_ZN5Exiv214newGifInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
   72|     57|Image::UniquePtr newGifInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
   73|     57|  auto image = std::make_unique<GifImage>(std::move(io), params);
   74|     57|  if (!image->good()) {
  ------------------
  |  Branch (74:7): [True: 7, False: 50]
  ------------------
   75|      7|    return nullptr;
   76|      7|  }
   77|     50|  return image;
   78|     57|}
_ZN5Exiv29isGifTypeERNS_7BasicIoEb:
   80|  11.6k|bool isGifType(BasicIo& iIo, bool advance) {
   81|  11.6k|  const int32_t len = 6;
   82|  11.6k|  const std::array<byte, len> Gif87aId{'G', 'I', 'F', '8', '7', 'a'};
   83|  11.6k|  const std::array<byte, len> Gif89aId{'G', 'I', 'F', '8', '9', 'a'};
   84|  11.6k|  std::array<byte, len> buf;
   85|  11.6k|  iIo.read(buf.data(), len);
   86|  11.6k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (86:7): [True: 0, False: 11.6k]
  |  Branch (86:22): [True: 246, False: 11.4k]
  ------------------
   87|    246|    return false;
   88|    246|  }
   89|  11.4k|  bool matched = buf == Gif87aId || buf == Gif89aId;
  ------------------
  |  Branch (89:18): [True: 76, False: 11.3k]
  |  Branch (89:37): [True: 81, False: 11.2k]
  ------------------
   90|  11.4k|  if (!advance || !matched) {
  ------------------
  |  Branch (90:7): [True: 11.3k, False: 50]
  |  Branch (90:19): [True: 0, False: 50]
  ------------------
   91|  11.3k|    iIo.seek(-len, BasicIo::cur);
   92|  11.3k|  }
   93|  11.4k|  return matched;
   94|  11.6k|}

_Z24string_from_unterminatedPKcm:
   13|  7.37k|std::string string_from_unterminated(const char* data, size_t data_length) {
   14|  7.37k|  if (data_length == 0) {
  ------------------
  |  Branch (14:7): [True: 0, False: 7.37k]
  ------------------
   15|      0|    return {};
   16|      0|  }
   17|  7.37k|  const size_t StringLength = strnlen(data, data_length);
   18|  7.37k|  return {data, StringLength};
   19|  7.37k|}
_ZN5Exiv212readQWORDTagERKNSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEE:
   22|  8.92k|uint64_t readQWORDTag(const BasicIo::UniquePtr& io) {
   23|  8.92k|  Internal::enforce(QWORD <= io->size() - io->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
   24|  8.92k|  auto FieldBuf = io->read(QWORD);
   25|  8.92k|  return FieldBuf.read_uint64(0, littleEndian);
   26|  8.92k|}
_ZN5Exiv212readDWORDTagERKNSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEE:
   28|  21.5k|uint32_t readDWORDTag(const BasicIo::UniquePtr& io) {
   29|  21.5k|  Internal::enforce(DWORD <= io->size() - io->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
   30|  21.5k|  DataBuf FieldBuf = io->read(DWORD);
   31|  21.5k|  return FieldBuf.read_uint32(0, littleEndian);
   32|  21.5k|}
_ZN5Exiv211readWORDTagERKNSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEE:
   34|  89.6k|uint16_t readWORDTag(const BasicIo::UniquePtr& io) {
   35|  89.6k|  Internal::enforce(WORD <= io->size() - io->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
   36|  89.6k|  DataBuf FieldBuf = io->read(WORD);
   37|  89.6k|  return FieldBuf.read_uint16(0, littleEndian);
   38|  89.6k|}
_ZN5Exiv218readStringWcharTagERKNSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEEm:
   40|  7.04k|std::string readStringWcharTag(const BasicIo::UniquePtr& io, size_t length) {
   41|  7.04k|  Internal::enforce(length >= 2 && length <= io->size() - io->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (41:21): [True: 7.00k, False: 38]
  |  Branch (41:36): [True: 6.83k, False: 169]
  ------------------
   42|  7.04k|  DataBuf FieldBuf(length + 1);
   43|  7.04k|  io->readOrThrow(FieldBuf.data(), length, ErrorCode::kerFailedToReadImageData);
   44|  7.04k|  std::string wst(FieldBuf.begin(), FieldBuf.end() - 3);
   45|  7.04k|  if (wst.size() % 2 != 0)
  ------------------
  |  Branch (45:7): [True: 3.95k, False: 3.08k]
  ------------------
   46|  3.95k|    Exiv2::convertStringCharset(wst, "UCS-2LE", "UTF-8");
   47|  7.04k|  Exiv2::convertStringCharset(wst, "UCS-2LE", "UTF-8");
   48|  7.04k|  return wst;
   49|  7.04k|}
_ZN5Exiv213readStringTagERKNSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEEm:
   51|  10.5k|std::string readStringTag(const BasicIo::UniquePtr& io, size_t length) {
   52|  10.5k|  Internal::enforce(length <= io->size() - io->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
   53|  10.5k|  DataBuf FieldBuf(length + 1);
   54|  10.5k|  io->readOrThrow(FieldBuf.data(), length, ErrorCode::kerFailedToReadImageData);
   55|  10.5k|  return Exiv2::toString(FieldBuf.data()).substr(0, length);
   56|  10.5k|}
_ZN5Exiv214getAspectRatioEmm:
   58|  2.36k|std::string getAspectRatio(uint64_t width, uint64_t height) {
   59|  2.36k|  if (height == 0 || width == 0)
  ------------------
  |  Branch (59:7): [True: 113, False: 2.25k]
  |  Branch (59:22): [True: 99, False: 2.15k]
  ------------------
   60|    212|    return std::to_string(width) + ":" + std::to_string(height);
   61|       |
   62|  2.15k|  auto ratioWidth = width / std::gcd(width, height);
   63|  2.15k|  auto ratioHeight = height / std::gcd(width, height);
   64|  2.15k|  return std::to_string(ratioWidth) + ":" + std::to_string(ratioHeight);
   65|  2.36k|}

_ZN5Exiv215ImageCtorParamsC2Ebm:
  141|  32.3k|    create_(create), max_recursion_depth_(max_recursion_depth) {
  142|  32.3k|}
_ZN5Exiv25ImageC2ENS_9ImageTypeEtNSt3__110unique_ptrINS_7BasicIoENS2_14default_deleteIS4_EEEERKNS_15ImageCtorParamsE:
  145|  32.3k|    io_(std::move(io)),
  146|  32.3k|    max_recursion_depth_(params.max_recursion_depth()),
  147|  32.3k|    imageType_(type),
  148|  32.3k|    supportedMetadata_(supportedMetadata) {
  149|  32.3k|}
_ZN5Exiv25ImageD2Ev:
  151|  32.3k|Image::~Image() = default;
_ZN5Exiv25Image19isBigEndianPlatformEv:
  189|    651|bool Image::isBigEndianPlatform() {
  190|    651|  return std::endian::native == std::endian::big;
  191|    651|}
_ZN5Exiv25Image8byteSwapEjb:
  213|  3.19k|uint32_t Image::byteSwap(uint32_t value, bool bSwap) {
  214|       |#ifdef __cpp_lib_byteswap
  215|       |  return bSwap ? std::byteswap(value) : value;
  216|       |#elif defined(_MSC_VER)
  217|       |  return bSwap ? _byteswap_ulong(value) : value;
  218|       |#else
  219|  3.19k|  uint32_t result = 0;
  220|  3.19k|  result |= (value & 0x000000FFU) << 24;
  221|  3.19k|  result |= (value & 0x0000FF00U) << 8;
  222|  3.19k|  result |= (value & 0x00FF0000U) >> 8;
  223|  3.19k|  result |= (value & 0xFF000000U) >> 24;
  224|  3.19k|  return bSwap ? result : value;
  ------------------
  |  Branch (224:10): [True: 0, False: 3.19k]
  ------------------
  225|  3.19k|#endif
  226|  3.19k|}
_ZN5Exiv25Image13clearMetadataEv:
  545|  27.9k|void Image::clearMetadata() {
  546|  27.9k|  clearExifData();
  547|  27.9k|  clearIptcData();
  548|  27.9k|  clearXmpPacket();
  549|  27.9k|  clearXmpData();
  550|  27.9k|  clearComment();
  551|  27.9k|  clearIccProfile();
  552|  27.9k|}
_ZN5Exiv25Image8exifDataEv:
  554|  10.3k|ExifData& Image::exifData() {
  555|  10.3k|  return exifData_;
  556|  10.3k|}
_ZN5Exiv25Image8iptcDataEv:
  558|  3.52k|IptcData& Image::iptcData() {
  559|  3.52k|  return iptcData_;
  560|  3.52k|}
_ZN5Exiv25Image7xmpDataEv:
  562|  18.2k|XmpData& Image::xmpData() {
  563|  18.2k|  return xmpData_;
  564|  18.2k|}
_ZN5Exiv25Image9xmpPacketEv:
  566|    282|std::string& Image::xmpPacket() {
  567|       |  // Serialize the current XMP
  568|    282|  if (!xmpData_.empty() && !writeXmpFromPacket()) {
  ------------------
  |  Branch (568:7): [True: 0, False: 282]
  |  Branch (568:28): [True: 0, False: 0]
  ------------------
  569|      0|    XmpParser::encode(xmpPacket_, xmpData_, XmpParser::useCompactFormat | XmpParser::omitAllFormatting);
  570|      0|  }
  571|    282|  return xmpPacket_;
  572|    282|}
_ZN5Exiv25Image13clearExifDataEv:
  594|  27.9k|void Image::clearExifData() {
  595|  27.9k|  exifData_.clear();
  596|  27.9k|}
_ZN5Exiv25Image11setExifDataERKNS_8ExifDataE:
  598|    317|void Image::setExifData(const ExifData& exifData) {
  599|    317|  exifData_ = exifData;
  600|    317|}
_ZN5Exiv25Image13clearIptcDataEv:
  602|  27.9k|void Image::clearIptcData() {
  603|  27.9k|  iptcData_.clear();
  604|  27.9k|}
_ZN5Exiv25Image11setIptcDataERKNS_8IptcDataE:
  606|    317|void Image::setIptcData(const IptcData& iptcData) {
  607|    317|  iptcData_ = iptcData;
  608|    317|}
_ZN5Exiv25Image14clearXmpPacketEv:
  610|  27.9k|void Image::clearXmpPacket() {
  611|  27.9k|  xmpPacket_.clear();
  612|       |  // Also clear the packet cached inside xmpData_. Some formats (e.g. TIFF, where
  613|       |  // XMP is stored in the Exif.Image.XMLPacket tag) write XMP from xmpData_'s
  614|       |  // packet when writeXmpFromPacket() is set. Without this, a stale packet would
  615|       |  // survive and the XMP would not be erased (e.g. "exiv2 -dx" on a TIFF).
  616|  27.9k|  xmpData_.setPacket(std::string());
  617|  27.9k|  writeXmpFromPacket(true);
  618|  27.9k|}
_ZN5Exiv25Image12clearXmpDataEv:
  628|  27.9k|void Image::clearXmpData() {
  629|  27.9k|  xmpData_.clear();
  630|  27.9k|  writeXmpFromPacket(false);
  631|  27.9k|}
_ZN5Exiv25Image10setXmpDataERKNS_7XmpDataE:
  633|    317|void Image::setXmpData(const XmpData& xmpData) {
  634|    317|  xmpData_ = xmpData;
  635|    317|  writeXmpFromPacket(false);
  636|    317|}
_ZN5Exiv25Image18writeXmpFromPacketEb:
  639|  56.1k|void Image::writeXmpFromPacket(bool flag) {
  640|  56.1k|  writeXmpFromPacket_ = flag;
  641|  56.1k|}
_ZN5Exiv25Image12clearCommentEv:
  647|  27.9k|void Image::clearComment() {
  648|  27.9k|  comment_.erase();
  649|  27.9k|}
_ZN5Exiv25Image10setCommentERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  651|    173|void Image::setComment(const std::string& comment) {
  652|    173|  comment_ = comment;
  653|    173|}
_ZN5Exiv25Image13setIccProfileEONS_7DataBufEb:
  655|    342|void Image::setIccProfile(Exiv2::DataBuf&& iccProfile, bool bTestValid) {
  656|    342|  iccProfile_ = std::move(iccProfile);
  657|    342|  if (bTestValid) {
  ------------------
  |  Branch (657:7): [True: 342, False: 0]
  ------------------
  658|    342|    checkIccProfile();
  659|    342|  }
  660|    342|}
_ZN5Exiv25Image16appendIccProfileEPKhmb:
  662|  4.81k|void Image::appendIccProfile(const uint8_t* bytes, size_t size, bool bTestValid) {
  663|  4.81k|  if (size == 0) {
  ------------------
  |  Branch (663:7): [True: 146, False: 4.66k]
  ------------------
  664|    146|    return;
  665|    146|  }
  666|  4.66k|  const size_t start = iccProfile_.size();
  667|  4.66k|  iccProfile_.resize(Safe::add(start, size));
  668|  4.66k|  memcpy(iccProfile_.data(start), bytes, size);
  669|  4.66k|  if (bTestValid) {
  ------------------
  |  Branch (669:7): [True: 35, False: 4.63k]
  ------------------
  670|     35|    checkIccProfile();
  671|     35|  }
  672|  4.66k|}
_ZNK5Exiv25Image15checkIccProfileEv:
  674|    377|void Image::checkIccProfile() const {
  675|    377|  if (iccProfile_.size() < sizeof(long)) {
  ------------------
  |  Branch (675:7): [True: 11, False: 366]
  ------------------
  676|     11|    throw Error(ErrorCode::kerInvalidIccProfile);
  677|     11|  }
  678|    366|  const size_t size = iccProfile_.read_uint32(0, bigEndian);
  679|    366|  if (size != iccProfile_.size()) {
  ------------------
  |  Branch (679:7): [True: 53, False: 313]
  ------------------
  680|     53|    throw Error(ErrorCode::kerInvalidIccProfile);
  681|     53|  }
  682|    366|}
_ZN5Exiv25Image15clearIccProfileEv:
  684|  27.9k|void Image::clearIccProfile() {
  685|  27.9k|  iccProfile_.reset();
  686|  27.9k|}
_ZN5Exiv25Image12setByteOrderENS_9ByteOrderE:
  688|  17.1k|void Image::setByteOrder(ByteOrder byteOrder) {
  689|  17.1k|  byteOrder_ = byteOrder;
  690|  17.1k|}
_ZNK5Exiv25Image9byteOrderEv:
  692|  4.38k|ByteOrder Image::byteOrder() const {
  693|  4.38k|  return byteOrder_;
  694|  4.38k|}
_ZNK5Exiv25Image10pixelWidthEv:
  696|  1.67k|uint32_t Image::pixelWidth() const {
  697|  1.67k|  return pixelWidth_;
  698|  1.67k|}
_ZNK5Exiv25Image11pixelHeightEv:
  700|  1.67k|uint32_t Image::pixelHeight() const {
  701|  1.67k|  return pixelHeight_;
  702|  1.67k|}
_ZNK5Exiv25Image8exifDataEv:
  704|   257k|const ExifData& Image::exifData() const {
  705|   257k|  return exifData_;
  706|   257k|}
_ZNK5Exiv25Image7xmpDataEv:
  712|  6.19k|const XmpData& Image::xmpData() const {
  713|  6.19k|  return xmpData_;
  714|  6.19k|}
_ZNK5Exiv25Image7commentEv:
  716|  1.24k|std::string Image::comment() const {
  717|  1.24k|  return comment_;
  718|  1.24k|}
_ZNK5Exiv25Image2ioEv:
  724|  35.4k|BasicIo& Image::io() const {
  725|  35.4k|  return *io_;
  726|  35.4k|}
_ZNK5Exiv25Image18writeXmpFromPacketEv:
  728|  12.2k|bool Image::writeXmpFromPacket() const {
  729|  12.2k|  return writeXmpFromPacket_;
  730|  12.2k|}
_ZNK5Exiv25Image14nativePreviewsEv:
  732|  25.3k|const NativePreviewList& Image::nativePreviews() const {
  733|  25.3k|  return nativePreviews_;
  734|  25.3k|}
_ZNK5Exiv25Image4goodEv:
  736|  32.1k|bool Image::good() const {
  737|  32.1k|  if (io_->open() != 0)
  ------------------
  |  Branch (737:7): [True: 0, False: 32.1k]
  ------------------
  738|      0|    return false;
  739|  32.1k|  IoCloser closer(*io_);
  740|  32.1k|  return ImageFactory::checkType(imageType_, *io_, false);
  741|  32.1k|}
_ZN5Exiv212ImageFactory9checkTypeENS_9ImageTypeERNS_7BasicIoEb:
  791|  32.1k|bool ImageFactory::checkType(ImageType type, BasicIo& io, bool advance) {
  792|  32.1k|  if (auto r = Exiv2::find(registry, type))
  ------------------
  |  Branch (792:12): [True: 32.1k, False: 0]
  ------------------
  793|  32.1k|    return r->isThisType_(io, advance);
  794|      0|  return false;
  795|  32.1k|}
_ZN5Exiv212ImageFactory4openEPKhm:
  877|  33.0k|Image::UniquePtr ImageFactory::open(const byte* data, size_t size) {
  878|  33.0k|  auto image = open(std::make_unique<MemIo>(data, size));  // may throw
  879|  33.0k|  if (!image)
  ------------------
  |  Branch (879:7): [True: 969, False: 32.0k]
  ------------------
  880|    969|    throw Error(ErrorCode::kerMemoryContainsUnknownImageType);
  881|  32.0k|  return image;
  882|  33.0k|}
_ZN5Exiv212ImageFactory4openENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEE:
  884|  33.0k|Image::UniquePtr ImageFactory::open(BasicIo::UniquePtr io) {
  885|  33.0k|  if (io->open() != 0) {
  ------------------
  |  Branch (885:7): [True: 0, False: 33.0k]
  ------------------
  886|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io->path(), strError());
  887|      0|  }
  888|   560k|  for (const auto& r : registry) {
  ------------------
  |  Branch (888:22): [True: 560k, False: 1.14k]
  ------------------
  889|   560k|    if (r.isThisType_(*io, false)) {
  ------------------
  |  Branch (889:9): [True: 31.8k, False: 528k]
  ------------------
  890|  31.8k|      return r.newInstance_(std::move(io), ImageCtorParams(false, 1000));
  891|  31.8k|    }
  892|   560k|  }
  893|  1.14k|  return nullptr;
  894|  33.0k|}
_ZN5Exiv212ImageFactory6createENS_9ImageTypeE:
  913|    317|Image::UniquePtr ImageFactory::create(ImageType type) {
  914|    317|  auto image = create(type, std::make_unique<MemIo>());
  915|    317|  if (!image)
  ------------------
  |  Branch (915:7): [True: 0, False: 317]
  ------------------
  916|      0|    throw Error(ErrorCode::kerUnsupportedImageType, static_cast<int>(type));
  917|    317|  return image;
  918|    317|}
_ZN5Exiv212ImageFactory6createENS_9ImageTypeENSt3__110unique_ptrINS_7BasicIoENS2_14default_deleteIS4_EEEE:
  920|    317|Image::UniquePtr ImageFactory::create(ImageType type, BasicIo::UniquePtr io) {
  921|       |  // BasicIo instance does not need to be open
  922|    317|  if (type == ImageType::none)
  ------------------
  |  Branch (922:7): [True: 0, False: 317]
  ------------------
  923|      0|    return {};
  924|    317|  if (auto r = Exiv2::find(registry, type))
  ------------------
  |  Branch (924:12): [True: 317, False: 0]
  ------------------
  925|    317|    return r->newInstance_(std::move(io), ImageCtorParams(true, 1000));
  926|      0|  return {};
  927|    317|}
_ZN5Exiv26appendERNSt3__16vectorIhNS0_9allocatorIhEEEEPKhm:
  932|  73.7k|void append(Blob& blob, const byte* buf, size_t len) {
  933|  73.7k|  if (len != 0) {
  ------------------
  |  Branch (933:7): [True: 71.7k, False: 1.93k]
  ------------------
  934|  71.7k|    Blob::size_type size = blob.size();
  935|  71.7k|    if (blob.capacity() - size < len) {
  ------------------
  |  Branch (935:9): [True: 4.60k, False: 67.1k]
  ------------------
  936|  4.60k|      blob.reserve(size + 65536);
  937|  4.60k|    }
  938|  71.7k|    blob.resize(size + len);
  939|  71.7k|    std::copy_n(buf, len, blob.begin() + size);
  940|  71.7k|  }
  941|  73.7k|}  // append
image.cpp:_ZNK12_GLOBAL__N_18RegistryeqERKN5Exiv29ImageTypeE:
   66|   539k|  bool operator==(const ImageType& imageType) const {
   67|   539k|    return imageType == imageType_;
   68|   539k|  }

_ZN5Exiv29IptcdatumC2ERKNS_7IptcKeyEPKNS_5ValueE:
   56|  52.5k|Iptcdatum::Iptcdatum(const IptcKey& key, const Value* pValue) : key_(key.clone()) {
   57|  52.5k|  if (pValue)
  ------------------
  |  Branch (57:7): [True: 28.4k, False: 24.1k]
  ------------------
   58|  28.4k|    value_ = pValue->clone();
   59|  52.5k|}
_ZN5Exiv29IptcdatumC2ERKS0_:
   61|   187k|Iptcdatum::Iptcdatum(const Iptcdatum& rhs) {
   62|   187k|  if (rhs.key_)
  ------------------
  |  Branch (62:7): [True: 187k, False: 0]
  ------------------
   63|   187k|    key_ = rhs.key_->clone();  // deep copy
   64|   187k|  if (rhs.value_)
  ------------------
  |  Branch (64:7): [True: 187k, False: 0]
  ------------------
   65|   187k|    value_ = rhs.value_->clone();  // deep copy
   66|   187k|}
_ZN5Exiv29IptcdatumD2Ev:
   68|   240k|Iptcdatum::~Iptcdatum() = default;
_ZNK5Exiv29Iptcdatum3keyEv:
   78|  41.6k|std::string Iptcdatum::key() const {
   79|  41.6k|  return key_ ? key_->key() : "";
  ------------------
  |  Branch (79:10): [True: 41.6k, False: 0]
  ------------------
   80|  41.6k|}
_ZNK5Exiv29Iptcdatum6recordEv:
   86|   375k|uint16_t Iptcdatum::record() const {
   87|   375k|  return key_ ? key_->record() : 0;
  ------------------
  |  Branch (87:10): [True: 375k, False: 0]
  ------------------
   88|   375k|}
_ZNK5Exiv29Iptcdatum3tagEv:
  110|   692k|uint16_t Iptcdatum::tag() const {
  111|   692k|  return key_ ? key_->tag() : 0;
  ------------------
  |  Branch (111:10): [True: 692k, False: 0]
  ------------------
  112|   692k|}
_ZNK5Exiv29Iptcdatum4sizeEv:
  130|  49.1k|size_t Iptcdatum::size() const {
  131|  49.1k|  return value_ ? value_->size() : 0;
  ------------------
  |  Branch (131:10): [True: 49.1k, False: 0]
  ------------------
  132|  49.1k|}
_ZNK5Exiv29Iptcdatum8toStringEv:
  134|  21.9k|std::string Iptcdatum::toString() const {
  135|  21.9k|  return value_ ? value_->toString() : "";
  ------------------
  |  Branch (135:10): [True: 21.9k, False: 0]
  ------------------
  136|  21.9k|}
_ZNK5Exiv29Iptcdatum5valueEv:
  158|  46.4k|const Value& Iptcdatum::value() const {
  159|  46.4k|  if (!value_)
  ------------------
  |  Branch (159:7): [True: 0, False: 46.4k]
  ------------------
  160|      0|    throw Error(ErrorCode::kerValueNotSet, key());
  161|  46.4k|  return *value_;
  162|  46.4k|}
_ZN5Exiv29IptcdatumaSERKS0_:
  164|  77.5k|Iptcdatum& Iptcdatum::operator=(const Iptcdatum& rhs) {
  165|  77.5k|  if (this == &rhs)
  ------------------
  |  Branch (165:7): [True: 0, False: 77.5k]
  ------------------
  166|      0|    return *this;
  167|       |
  168|  77.5k|  key_.reset();
  169|  77.5k|  if (rhs.key_)
  ------------------
  |  Branch (169:7): [True: 77.5k, False: 0]
  ------------------
  170|  77.5k|    key_ = rhs.key_->clone();  // deep copy
  171|       |
  172|  77.5k|  value_.reset();
  173|  77.5k|  if (rhs.value_)
  ------------------
  |  Branch (173:7): [True: 77.5k, False: 0]
  ------------------
  174|  77.5k|    value_ = rhs.value_->clone();  // deep copy
  175|       |
  176|  77.5k|  return *this;
  177|  77.5k|}  // Iptcdatum::operator=
_ZN5Exiv29IptcdatumaSERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  186|  1.20k|Iptcdatum& Iptcdatum::operator=(const std::string& value) {
  187|  1.20k|  setValue(value);
  188|  1.20k|  return *this;
  189|  1.20k|}
_ZN5Exiv29Iptcdatum8setValueERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  202|  24.3k|int Iptcdatum::setValue(const std::string& value) {
  203|  24.3k|  if (!value_) {
  ------------------
  |  Branch (203:7): [True: 24.1k, False: 199]
  ------------------
  204|  24.1k|    TypeId type = IptcDataSets::dataSetType(tag(), record());
  205|  24.1k|    value_ = Value::create(type);
  206|  24.1k|  }
  207|  24.3k|  return value_->read(value);
  208|  24.3k|}
_ZN5Exiv28IptcDataixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  210|  1.20k|Iptcdatum& IptcData::operator[](const std::string& key) {
  211|  1.20k|  IptcKey iptcKey(key);
  212|  1.20k|  auto pos = findKey(iptcKey);
  213|  1.20k|  if (pos == end()) {
  ------------------
  |  Branch (213:7): [True: 1.00k, False: 199]
  ------------------
  214|  1.00k|    return iptcMetadata_.emplace_back(iptcKey);
  215|  1.00k|  }
  216|    199|  return *pos;
  217|  1.20k|}
_ZNK5Exiv28IptcData4sizeEv:
  219|    997|size_t IptcData::size() const {
  220|    997|  size_t newSize = 0;
  221|  24.5k|  for (auto&& iptc : iptcMetadata_) {
  ------------------
  |  Branch (221:20): [True: 24.5k, False: 997]
  ------------------
  222|       |    // marker, record Id, dataset num, first 2 bytes of size
  223|  24.5k|    newSize += 5;
  224|  24.5k|    size_t dataSize = iptc.size();
  225|  24.5k|    newSize += dataSize;
  226|  24.5k|    if (dataSize > 32767) {
  ------------------
  |  Branch (226:9): [True: 0, False: 24.5k]
  ------------------
  227|       |      // extended dataset (we always use 4 bytes)
  228|      0|      newSize += 4;
  229|      0|    }
  230|  24.5k|  }
  231|    997|  return newSize;
  232|    997|}
_ZN5Exiv28IptcData3addERKNS_7IptcKeyEPKNS_5ValueE:
  234|  28.4k|int IptcData::add(const IptcKey& key, const Value* value) {
  235|  28.4k|  return add(Iptcdatum(key, value));
  236|  28.4k|}
_ZN5Exiv28IptcData3addERKNS_9IptcdatumE:
  238|  51.5k|int IptcData::add(const Iptcdatum& iptcDatum) {
  239|  51.5k|  if (!IptcDataSets::dataSetRepeatable(iptcDatum.tag(), iptcDatum.record()) &&
  ------------------
  |  Branch (239:7): [True: 18.0k, False: 33.5k]
  |  Branch (239:7): [True: 15.3k, False: 36.2k]
  ------------------
  240|  18.0k|      findId(iptcDatum.tag(), iptcDatum.record()) != end()) {
  ------------------
  |  Branch (240:7): [True: 15.3k, False: 2.70k]
  ------------------
  241|  15.3k|    return 6;
  242|  15.3k|  }
  243|       |  // allow duplicates
  244|  36.2k|  iptcMetadata_.push_back(iptcDatum);
  245|  36.2k|  return 0;
  246|  51.5k|}
_ZNK5Exiv28IptcData7findKeyERKNS_7IptcKeyE:
  248|  1.48k|IptcData::const_iterator IptcData::findKey(const IptcKey& key) const {
  249|  1.48k|  return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(), FindIptcdatum(key.tag(), key.record()));
  250|  1.48k|}
_ZN5Exiv28IptcData7findKeyERKNS_7IptcKeyE:
  252|  31.6k|IptcData::iterator IptcData::findKey(const IptcKey& key) {
  253|  31.6k|  return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(), FindIptcdatum(key.tag(), key.record()));
  254|  31.6k|}
_ZN5Exiv28IptcData6findIdEtt:
  260|  18.0k|IptcData::iterator IptcData::findId(uint16_t dataset, uint16_t record) {
  261|  18.0k|  return std::find_if(iptcMetadata_.begin(), iptcMetadata_.end(), FindIptcdatum(dataset, record));
  262|  18.0k|}
_ZNK5Exiv28IptcData13detectCharsetEv:
  304|  1.48k|const char* IptcData::detectCharset() const {
  305|  1.48k|  auto pos = findKey(IptcKey("Iptc.Envelope.CharacterSet"));
  306|  1.48k|  if (pos != end()) {
  ------------------
  |  Branch (306:7): [True: 463, False: 1.02k]
  ------------------
  307|    463|    const std::string value = pos->toString();
  308|    463|    if (pos->value().ok() && value == "\033%G")
  ------------------
  |  Branch (308:9): [True: 463, False: 0]
  |  Branch (308:30): [True: 463, False: 0]
  ------------------
  309|    463|      return "UTF-8";
  310|    463|  }
  311|       |
  312|  1.02k|  bool ascii = true;
  313|  1.02k|  bool utf8 = true;
  314|       |
  315|  1.02k|  for (const auto& key : *this) {
  ------------------
  |  Branch (315:24): [True: 0, False: 1.02k]
  ------------------
  316|      0|    std::string value = key.toString();
  317|      0|    if (key.value().ok()) {
  ------------------
  |  Branch (317:9): [True: 0, False: 0]
  ------------------
  318|      0|      int seqCount = 0;
  319|      0|      for (auto c : value) {
  ------------------
  |  Branch (319:19): [True: 0, False: 0]
  ------------------
  320|      0|        if (seqCount) {
  ------------------
  |  Branch (320:13): [True: 0, False: 0]
  ------------------
  321|      0|          if ((c & 0xc0) != 0x80) {
  ------------------
  |  Branch (321:15): [True: 0, False: 0]
  ------------------
  322|      0|            utf8 = false;
  323|      0|            break;
  324|      0|          }
  325|      0|          --seqCount;
  326|      0|        } else {
  327|      0|          if (c & 0x80)
  ------------------
  |  Branch (327:15): [True: 0, False: 0]
  ------------------
  328|      0|            ascii = false;
  329|      0|          else
  330|      0|            continue;  // ascii character
  331|       |
  332|      0|          if ((c & 0xe0) == 0xc0)
  ------------------
  |  Branch (332:15): [True: 0, False: 0]
  ------------------
  333|      0|            seqCount = 1;
  334|      0|          else if ((c & 0xf0) == 0xe0)
  ------------------
  |  Branch (334:20): [True: 0, False: 0]
  ------------------
  335|      0|            seqCount = 2;
  336|      0|          else if ((c & 0xf8) == 0xf0)
  ------------------
  |  Branch (336:20): [True: 0, False: 0]
  ------------------
  337|      0|            seqCount = 3;
  338|      0|          else if ((c & 0xfc) == 0xf8)
  ------------------
  |  Branch (338:20): [True: 0, False: 0]
  ------------------
  339|      0|            seqCount = 4;
  340|      0|          else if ((c & 0xfe) == 0xfc)
  ------------------
  |  Branch (340:20): [True: 0, False: 0]
  ------------------
  341|      0|            seqCount = 5;
  342|      0|          else {
  343|      0|            utf8 = false;
  344|      0|            break;
  345|      0|          }
  346|      0|        }
  347|      0|      }
  348|      0|      if (seqCount)
  ------------------
  |  Branch (348:11): [True: 0, False: 0]
  ------------------
  349|      0|        utf8 = false;  // unterminated seq
  350|      0|      if (!utf8)
  ------------------
  |  Branch (350:11): [True: 0, False: 0]
  ------------------
  351|      0|        break;
  352|      0|    }
  353|      0|  }
  354|       |
  355|  1.02k|  if (ascii)
  ------------------
  |  Branch (355:7): [True: 1.02k, False: 0]
  ------------------
  356|  1.02k|    return "ASCII";
  357|      0|  if (utf8)
  ------------------
  |  Branch (357:7): [True: 0, False: 0]
  ------------------
  358|      0|    return "UTF-8";
  359|      0|  return nullptr;
  360|      0|}
_ZN5Exiv210IptcParser6decodeERNS_8IptcDataEPKhm:
  362|  1.80k|int IptcParser::decode(IptcData& iptcData, const byte* pData, size_t size) {
  363|       |#ifdef EXIV2_DEBUG_MESSAGES
  364|       |  std::cerr << "IptcParser::decode, size = " << size << "\n";
  365|       |#endif
  366|  1.80k|  auto pRead = pData;
  367|  1.80k|  const auto pEnd = pData + size;
  368|  1.80k|  iptcData.clear();
  369|       |
  370|  1.80k|  uint16_t record = 0;
  371|  1.80k|  uint16_t dataSet = 0;
  372|  1.80k|  uint32_t sizeData = 0;
  373|  1.80k|  byte extTest = 0;
  374|       |
  375|   971k|  while (6 <= static_cast<size_t>(pEnd - pRead)) {
  ------------------
  |  Branch (375:10): [True: 970k, False: 1.17k]
  ------------------
  376|       |    // First byte should be a marker. If it isn't, scan forward and skip
  377|       |    // the chunk bytes present in some images. This deviates from the
  378|       |    // standard, which advises to treat such cases as errors.
  379|   970k|    if (*pRead++ != marker_)
  ------------------
  |  Branch (379:9): [True: 941k, False: 29.0k]
  ------------------
  380|   941k|      continue;
  381|  29.0k|    record = *pRead++;
  382|  29.0k|    dataSet = *pRead++;
  383|       |
  384|  29.0k|    extTest = *pRead;
  385|  29.0k|    if (extTest & 0x80) {
  ------------------
  |  Branch (385:9): [True: 1.82k, False: 27.2k]
  ------------------
  386|       |      // extended dataset
  387|  1.82k|      uint16_t sizeOfSize = (getUShort(pRead, bigEndian) & 0x7FFF);
  388|  1.82k|      if (sizeOfSize > 4)
  ------------------
  |  Branch (388:11): [True: 171, False: 1.65k]
  ------------------
  389|    171|        return 5;
  390|  1.65k|      pRead += 2;
  391|  1.65k|      if (sizeOfSize > pEnd - pRead)
  ------------------
  |  Branch (391:11): [True: 8, False: 1.64k]
  ------------------
  392|      8|        return 6;
  393|  1.64k|      sizeData = 0;
  394|  4.61k|      for (; sizeOfSize > 0; --sizeOfSize) {
  ------------------
  |  Branch (394:14): [True: 2.97k, False: 1.64k]
  ------------------
  395|  2.97k|        sizeData |= *pRead++ << (8 * (sizeOfSize - 1));
  396|  2.97k|      }
  397|  27.2k|    } else {
  398|       |      // standard dataset
  399|  27.2k|      sizeData = getUShort(pRead, bigEndian);
  400|  27.2k|      pRead += 2;
  401|  27.2k|    }
  402|  28.8k|    if (sizeData <= static_cast<size_t>(pEnd - pRead)) {
  ------------------
  |  Branch (402:9): [True: 28.4k, False: 450]
  ------------------
  403|  28.4k|      int rc = readData(iptcData, dataSet, record, pRead, sizeData);
  404|  28.4k|      if (rc != 0) {
  ------------------
  |  Branch (404:11): [True: 0, False: 28.4k]
  ------------------
  405|      0|#ifndef SUPPRESS_WARNINGS
  406|      0|        EXV_WARNING << "Failed to read IPTC dataset " << IptcKey(dataSet, record) << " (rc = " << rc << "); skipped.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  407|      0|#endif
  408|      0|      }
  409|  28.4k|    } else {
  410|    450|#ifndef SUPPRESS_WARNINGS
  411|    450|      EXV_WARNING << "IPTC dataset " << IptcKey(dataSet, record) << " has invalid size " << sizeData << "; skipped.\n";
  ------------------
  |  |  138|    450|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 450]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    450|  LogMsg(LogMsg::warn).os()
  ------------------
  412|    450|#endif
  413|    450|      return 7;
  414|    450|    }
  415|  28.4k|    pRead += sizeData;
  416|  28.4k|  }
  417|       |
  418|  1.17k|  return 0;
  419|  1.80k|}  // IptcParser::decode
_ZN5Exiv210IptcParser6encodeERKNS_8IptcDataE:
  421|  15.6k|DataBuf IptcParser::encode(const IptcData& iptcData) {
  422|  15.6k|  DataBuf buf;
  423|  15.6k|  if (iptcData.empty())
  ------------------
  |  Branch (423:7): [True: 14.6k, False: 997]
  ------------------
  424|  14.6k|    return buf;
  425|       |
  426|    997|  buf = DataBuf(iptcData.size());
  427|    997|  byte* pWrite = buf.data();
  428|       |
  429|       |  // Copy the iptc data sets and sort them by record but preserve the order of datasets
  430|    997|  IptcMetadata sortedIptcData(iptcData.begin(), iptcData.end());
  431|    997|  std::stable_sort(sortedIptcData.begin(), sortedIptcData.end(),
  432|    997|                   [](const auto& l, const auto& r) { return l.record() < r.record(); });
  433|       |
  434|  24.5k|  for (const auto& iter : sortedIptcData) {
  ------------------
  |  Branch (434:25): [True: 24.5k, False: 997]
  ------------------
  435|       |    // marker, record Id, dataset num
  436|  24.5k|    *pWrite++ = marker_;
  437|  24.5k|    *pWrite++ = static_cast<byte>(iter.record());
  438|  24.5k|    *pWrite++ = static_cast<byte>(iter.tag());
  439|       |
  440|       |    // extended or standard dataset?
  441|  24.5k|    if (size_t dataSize = iter.size(); dataSize > 32767) {
  ------------------
  |  Branch (441:40): [True: 0, False: 24.5k]
  ------------------
  442|       |      // always use 4 bytes for extended length
  443|      0|      uint16_t sizeOfSize = 4 | 0x8000;
  444|      0|      us2Data(pWrite, sizeOfSize, bigEndian);
  445|      0|      pWrite += 2;
  446|      0|      ul2Data(pWrite, static_cast<uint32_t>(dataSize), bigEndian);
  447|      0|      pWrite += 4;
  448|  24.5k|    } else {
  449|  24.5k|      us2Data(pWrite, static_cast<uint16_t>(dataSize), bigEndian);
  450|  24.5k|      pWrite += 2;
  451|  24.5k|    }
  452|  24.5k|    pWrite += iter.value().copy(pWrite, bigEndian);
  453|  24.5k|  }
  454|       |
  455|    997|  return buf;
  456|  15.6k|}  // IptcParser::encode
iptc.cpp:_ZNK12_GLOBAL__N_113FindIptcdatumclERKN5Exiv29IptcdatumE:
   41|   574k|  bool operator()(const Exiv2::Iptcdatum& iptcdatum) const {
   42|   574k|    return dataset_ == iptcdatum.tag() && record_ == iptcdatum.record();
  ------------------
  |  Branch (42:12): [True: 21.5k, False: 552k]
  |  Branch (42:43): [True: 16.3k, False: 5.25k]
  ------------------
   43|   574k|  }
iptc.cpp:_ZN12_GLOBAL__N_113FindIptcdatumC2Ett:
   35|  51.1k|  FindIptcdatum(uint16_t dataset, uint16_t record) : dataset_(dataset), record_(record) {
   36|  51.1k|  }
iptc.cpp:_ZN12_GLOBAL__N_18readDataERN5Exiv28IptcDataEttPKhj:
  463|  28.4k|int readData(Exiv2::IptcData& iptcData, uint16_t dataSet, uint16_t record, const Exiv2::byte* data, uint32_t sizeData) {
  464|  28.4k|  Exiv2::TypeId type = Exiv2::IptcDataSets::dataSetType(dataSet, record);
  465|  28.4k|  auto value = Exiv2::Value::create(type);
  466|  28.4k|  int rc = value->read(data, sizeData, Exiv2::bigEndian);
  467|  28.4k|  if (0 == rc) {
  ------------------
  |  Branch (467:7): [True: 17.7k, False: 10.6k]
  ------------------
  468|  17.7k|    Exiv2::IptcKey key(dataSet, record);
  469|  17.7k|    iptcData.add(key, value.get());
  470|  17.7k|  } else if (1 == rc) {
  ------------------
  |  Branch (470:14): [True: 10.6k, False: 0]
  ------------------
  471|       |    // If the first attempt failed, try with a string value
  472|  10.6k|    value = Exiv2::Value::create(Exiv2::string);
  473|  10.6k|    rc = value->read(data, sizeData, Exiv2::bigEndian);
  474|  10.6k|    if (0 == rc) {
  ------------------
  |  Branch (474:9): [True: 10.6k, False: 0]
  ------------------
  475|  10.6k|      Exiv2::IptcKey key(dataSet, record);
  476|  10.6k|      iptcData.add(key, value.get());
  477|  10.6k|    }
  478|  10.6k|  }
  479|  28.4k|  return rc;
  480|  28.4k|}
iptc.cpp:_ZZN5Exiv210IptcParser6encodeERKNS_8IptcDataEENK3$_0clINS_9IptcdatumES6_EEDaRKT_RKT0_:
  432|   118k|                   [](const auto& l, const auto& r) { return l.record() < r.record(); });

_ZN5Exiv28Jp2ImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  101|  1.05k|    Image(ImageType::jp2, mdExif | mdIptc | mdXmp, std::move(io), params) {
  102|  1.05k|  if (params.create() && io_->open() == 0) {
  ------------------
  |  Branch (102:7): [True: 0, False: 1.05k]
  |  Branch (102:26): [True: 0, False: 0]
  ------------------
  103|       |#ifdef EXIV2_DEBUG_MESSAGES
  104|       |    std::cerr << "Exiv2::Jp2Image:: Creating JPEG2000 image to memory" << '\n';
  105|       |#endif
  106|      0|    IoCloser closer(*io_);
  107|      0|    if (io_->write(Jp2Blank.data(), Jp2Blank.size()) != Jp2Blank.size()) {
  ------------------
  |  Branch (107:9): [True: 0, False: 0]
  ------------------
  108|       |#ifdef EXIV2_DEBUG_MESSAGES
  109|       |      std::cerr << "Exiv2::Jp2Image:: Failed to create JPEG2000 image on memory" << '\n';
  110|       |#endif
  111|      0|    }
  112|      0|  }
  113|  1.05k|}
_ZN5Exiv28Jp2Image12readMetadataEv:
  135|  1.05k|void Jp2Image::readMetadata() {
  136|       |#ifdef EXIV2_DEBUG_MESSAGES
  137|       |  std::cerr << "Exiv2::Jp2Image::readMetadata: Reading JPEG-2000 file " << io_->path() << '\n';
  138|       |#endif
  139|  1.05k|  if (io_->open() != 0) {
  ------------------
  |  Branch (139:7): [True: 0, False: 1.05k]
  ------------------
  140|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  141|      0|  }
  142|  1.05k|  IoCloser closer(*io_);
  143|  1.05k|  if (!isJp2Type(*io_, false)) {
  ------------------
  |  Branch (143:7): [True: 0, False: 1.05k]
  ------------------
  144|      0|    throw Error(ErrorCode::kerNotAnImage, "JPEG-2000");
  145|      0|  }
  146|       |
  147|  1.05k|  Internal::Jp2BoxHeader box = {0, 0};
  148|  1.05k|  Internal::Jp2BoxHeader subBox = {0, 0};
  149|  1.05k|  Internal::Jp2ImageHeaderBox ihdr = {0, 0, 0, 0, 0, 0, 0};
  150|  1.05k|  Internal::Jp2UuidBox uuid = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
  151|  1.05k|  size_t boxesCount = 0;
  152|  1.05k|  const size_t boxem = 1000;  // boxes max
  153|  1.05k|  uint32_t lastBoxTypeRead = 0;
  154|  1.05k|  bool boxSignatureFound = false;
  155|  1.05k|  bool boxFileTypeFound = false;
  156|       |
  157|  14.3k|  while (io_->read(reinterpret_cast<byte*>(&box), boxHSize) == boxHSize) {
  ------------------
  |  Branch (157:10): [True: 14.0k, False: 324]
  ------------------
  158|  14.0k|    boxes_check(boxesCount++, boxem);
  159|  14.0k|    const size_t position = io_->tell();
  160|  14.0k|    box.length = getULong(reinterpret_cast<byte*>(&box.length), bigEndian);
  161|  14.0k|    box.type = getULong(reinterpret_cast<byte*>(&box.type), bigEndian);
  162|       |#ifdef EXIV2_DEBUG_MESSAGES
  163|       |    std::cout << "Exiv2::Jp2Image::readMetadata: Position: " << position << " box type: " << toAscii(box.type)
  164|       |              << " length: " << box.length << '\n';
  165|       |#endif
  166|  14.0k|    Internal::enforce(box.length <= boxHSize + io_->size() - io_->tell(), ErrorCode::kerCorruptedMetadata);
  167|       |
  168|  14.0k|    if (box.length == 0)
  ------------------
  |  Branch (168:9): [True: 235, False: 13.7k]
  ------------------
  169|    235|      return;
  170|       |
  171|  13.7k|    if (box.length == 1) {
  ------------------
  |  Branch (171:9): [True: 5, False: 13.7k]
  ------------------
  172|       |      /// \todo In this case, the real box size is given in XLBox (bytes 8-15)
  173|      5|    }
  174|       |
  175|  13.7k|    switch (box.type) {
  176|  1.06k|      case kJp2BoxType::Signature: {
  ------------------
  |  Branch (176:7): [True: 1.06k, False: 12.7k]
  ------------------
  177|  1.06k|        if (boxSignatureFound)  // Only one is allowed
  ------------------
  |  Branch (177:13): [True: 11, False: 1.05k]
  ------------------
  178|     11|          throw Error(ErrorCode::kerCorruptedMetadata);
  179|  1.05k|        boxSignatureFound = true;
  180|  1.05k|        break;
  181|  1.06k|      }
  182|    156|      case kJp2BoxType::FileTypeBox: {
  ------------------
  |  Branch (182:7): [True: 156, False: 13.6k]
  ------------------
  183|       |        // This box shall immediately follow the JPEG 2000 Signature box
  184|    156|        if (boxFileTypeFound || lastBoxTypeRead != kJp2BoxType::Signature) {  // Only one is allowed
  ------------------
  |  Branch (184:13): [True: 10, False: 146]
  |  Branch (184:33): [True: 14, False: 132]
  ------------------
  185|     24|          throw Error(ErrorCode::kerCorruptedMetadata);
  186|     24|        }
  187|    132|        boxFileTypeFound = true;
  188|    132|        Internal::enforce(box.length >= boxHSize, ErrorCode::kerCorruptedMetadata);
  189|    132|        Blob boxData(box.length - boxHSize);
  190|    132|        io_->readOrThrow(boxData.data(), boxData.size(), ErrorCode::kerCorruptedMetadata);
  191|    132|        if (!Internal::isValidBoxFileType(boxData))
  ------------------
  |  Branch (191:13): [True: 109, False: 23]
  ------------------
  192|    109|          throw Error(ErrorCode::kerCorruptedMetadata);
  193|     23|        brand_ = getULong(boxData.data(), bigEndian);
  194|     23|        break;
  195|    132|      }
  196|  3.94k|      case kJp2BoxType::Header: {
  ------------------
  |  Branch (196:7): [True: 3.94k, False: 9.85k]
  ------------------
  197|       |#ifdef EXIV2_DEBUG_MESSAGES
  198|       |        std::cout << "Exiv2::Jp2Image::readMetadata: JP2Header box found\n";
  199|       |#endif
  200|  3.94k|        size_t restore = io_->tell();
  201|       |
  202|  78.3k|        while (io_->read(reinterpret_cast<byte*>(&subBox), boxHSize) == boxHSize && subBox.length) {
  ------------------
  |  Branch (202:16): [True: 76.7k, False: 1.60k]
  |  Branch (202:85): [True: 74.5k, False: 2.23k]
  ------------------
  203|  74.5k|          boxes_check(boxesCount++, boxem);
  204|  74.5k|          subBox.length = getULong(reinterpret_cast<byte*>(&subBox.length), bigEndian);
  205|  74.5k|          subBox.type = getULong(reinterpret_cast<byte*>(&subBox.type), bigEndian);
  206|  74.5k|          if (subBox.length > io_->size()) {
  ------------------
  |  Branch (206:15): [True: 71, False: 74.4k]
  ------------------
  207|     71|            throw Error(ErrorCode::kerCorruptedMetadata);
  208|     71|          }
  209|       |#ifdef EXIV2_DEBUG_MESSAGES
  210|       |          std::cout << "Exiv2::Jp2Image::readMetadata: "
  211|       |                    << "subBox = " << toAscii(subBox.type) << " length = " << subBox.length << '\n';
  212|       |#endif
  213|  74.4k|          if (subBox.type == kJp2BoxType::ColorSpec && subBox.length != 15) {
  ------------------
  |  Branch (213:15): [True: 123, False: 74.3k]
  |  Branch (213:56): [True: 48, False: 75]
  ------------------
  214|       |#ifdef EXIV2_DEBUG_MESSAGES
  215|       |            std::cout << "Exiv2::Jp2Image::readMetadata: "
  216|       |                      << "Color data found" << '\n';
  217|       |#endif
  218|       |
  219|     48|            const size_t pad = 3;  // 3 padding bytes 2 0 0
  220|     48|            const size_t data_length = Safe::add(subBox.length, 8u);
  221|       |            // data_length makes no sense if it is larger than the rest of the file
  222|     48|            if (data_length > io_->size() - io_->tell()) {
  ------------------
  |  Branch (222:17): [True: 2, False: 46]
  ------------------
  223|      2|              throw Error(ErrorCode::kerCorruptedMetadata);
  224|      2|            }
  225|     46|            DataBuf data(data_length);
  226|     46|            io_->read(data.data(), data.size());
  227|     46|            const size_t iccLength = data.read_uint32(pad, bigEndian);
  228|       |            // subtracting pad from data.size() is safe:
  229|       |            // data.size() is at least 8 and pad = 3
  230|     46|            if (iccLength > data.size() - pad) {
  ------------------
  |  Branch (230:17): [True: 16, False: 30]
  ------------------
  231|     16|              throw Error(ErrorCode::kerCorruptedMetadata);
  232|     16|            }
  233|     30|            DataBuf icc(iccLength);
  234|     30|            std::copy_n(data.begin() + pad, icc.size(), icc.begin());
  235|       |#ifdef EXIV2_DEBUG_MESSAGES
  236|       |            const char* iccPath = "/tmp/libexiv2_jp2.icc";
  237|       |            if (auto f = std::ofstream(iccPath, std::ios::binary)) {
  238|       |              f.write(reinterpret_cast<const char*>(icc.c_data()), static_cast<std::streamsize>(icc.size()));
  239|       |              f.close();
  240|       |              std::cout << "Exiv2::Jp2Image::readMetadata: wrote iccProfile " << icc.size() << " bytes to " << iccPath
  241|       |                        << '\n';
  242|       |            }
  243|       |#endif
  244|     30|            setIccProfile(std::move(icc));
  245|     30|          }
  246|       |
  247|  74.4k|          if (subBox.type == kJp2BoxType::ImageHeader) {
  ------------------
  |  Branch (247:15): [True: 46, False: 74.3k]
  ------------------
  248|     46|            io_->read(reinterpret_cast<byte*>(&ihdr), sizeof(ihdr));
  249|       |#ifdef EXIV2_DEBUG_MESSAGES
  250|       |            std::cout << "Exiv2::Jp2Image::readMetadata: Ihdr data found" << '\n';
  251|       |#endif
  252|     46|            ihdr.imageHeight = getULong(reinterpret_cast<byte*>(&ihdr.imageHeight), bigEndian);
  253|     46|            ihdr.imageWidth = getULong(reinterpret_cast<byte*>(&ihdr.imageWidth), bigEndian);
  254|     46|            ihdr.componentCount = getShort(reinterpret_cast<byte*>(&ihdr.componentCount), bigEndian);
  255|     46|            Internal::enforce(ihdr.c == 7, ErrorCode::kerCorruptedMetadata);
  256|       |
  257|     46|            pixelWidth_ = ihdr.imageWidth;
  258|     46|            pixelHeight_ = ihdr.imageHeight;
  259|     46|          }
  260|       |
  261|  74.4k|          io_->seek(restore, BasicIo::beg);
  262|  74.4k|          if (io_->seek(subBox.length, BasicIo::cur) != 0) {
  ------------------
  |  Branch (262:15): [True: 17, False: 74.4k]
  ------------------
  263|     17|            throw Error(ErrorCode::kerCorruptedMetadata);
  264|     17|          }
  265|  74.4k|          restore = io_->tell();
  266|  74.4k|        }
  267|  3.83k|        break;
  268|  3.94k|      }
  269|       |
  270|  3.83k|      case kJp2BoxType::Uuid: {
  ------------------
  |  Branch (270:7): [True: 2.31k, False: 11.4k]
  ------------------
  271|       |#ifdef EXIV2_DEBUG_MESSAGES
  272|       |        std::cout << "Exiv2::Jp2Image::readMetadata: UUID box found" << '\n';
  273|       |#endif
  274|       |
  275|  2.31k|        if (io_->read(reinterpret_cast<byte*>(&uuid), sizeof(uuid)) == sizeof(uuid)) {
  ------------------
  |  Branch (275:13): [True: 2.31k, False: 1]
  ------------------
  276|  2.31k|          DataBuf rawData;
  277|  2.31k|          size_t bufRead;
  278|  2.31k|          bool bIsExif = uuid.uuid == kJp2UuidExif;
  279|  2.31k|          bool bIsIPTC = uuid.uuid == kJp2UuidIptc;
  280|  2.31k|          bool bIsXMP = uuid.uuid == kJp2UuidXmp;
  281|       |
  282|  2.31k|          if (bIsExif) {
  ------------------
  |  Branch (282:15): [True: 652, False: 1.65k]
  ------------------
  283|       |#ifdef EXIV2_DEBUG_MESSAGES
  284|       |            std::cout << "Exiv2::Jp2Image::readMetadata: Exif data found" << '\n';
  285|       |#endif
  286|    652|            Internal::enforce(box.length >= boxHSize + sizeof(uuid), ErrorCode::kerCorruptedMetadata);
  287|    652|            rawData.alloc(box.length - (boxHSize + sizeof(uuid)));
  288|    652|            bufRead = io_->read(rawData.data(), rawData.size());
  289|    652|            if (io_->error())
  ------------------
  |  Branch (289:17): [True: 0, False: 652]
  ------------------
  290|      0|              throw Error(ErrorCode::kerFailedToReadImageData);
  291|    652|            if (bufRead != rawData.size())
  ------------------
  |  Branch (291:17): [True: 0, False: 652]
  ------------------
  292|      0|              throw Error(ErrorCode::kerInputDataReadFailed);
  293|       |
  294|    652|            if (rawData.size() > 8)  // "II*\0long"
  ------------------
  |  Branch (294:17): [True: 569, False: 83]
  ------------------
  295|    569|            {
  296|       |              // Find the position of Exif header in bytes array.
  297|    569|              const char a = rawData.read_uint8(0);
  298|    569|              const char b = rawData.read_uint8(1);
  299|    569|              const size_t notfound = std::numeric_limits<size_t>::max();
  300|    569|              size_t pos = (a == b && (a == 'I' || a == 'M')) ? 0 : notfound;
  ------------------
  |  Branch (300:29): [True: 532, False: 37]
  |  Branch (300:40): [True: 6, False: 526]
  |  Branch (300:52): [True: 262, False: 264]
  ------------------
  301|       |
  302|       |              // #1242  Forgive having Exif\0\0 in rawData.pData_
  303|    569|              std::array<byte, 6> exifHeader{0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
  304|  34.2k|              for (size_t i = 0; pos == notfound && i < (rawData.size() - exifHeader.size()); i++) {
  ------------------
  |  Branch (304:34): [True: 33.7k, False: 551]
  |  Branch (304:53): [True: 33.6k, False: 18]
  ------------------
  305|  33.6k|                if (rawData.cmpBytes(i, exifHeader.data(), exifHeader.size()) == 0) {
  ------------------
  |  Branch (305:21): [True: 283, False: 33.4k]
  ------------------
  306|    283|                  pos = i + sizeof(exifHeader);
  307|    283|#ifndef SUPPRESS_WARNINGS
  308|    283|                  EXV_WARNING << "Reading non-standard UUID-EXIF_bad box in " << io_->path() << '\n';
  ------------------
  |  |  138|    283|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 283]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    283|  LogMsg(LogMsg::warn).os()
  ------------------
  309|    283|#endif
  310|    283|                }
  311|  33.6k|              }
  312|       |
  313|       |              // If found it, store only these data at from this place.
  314|    569|              if (pos != notfound) {
  ------------------
  |  Branch (314:19): [True: 551, False: 18]
  ------------------
  315|       |#ifdef EXIV2_DEBUG_MESSAGES
  316|       |                std::cout << "Exiv2::Jp2Image::readMetadata: Exif header found at position " << pos << '\n';
  317|       |#endif
  318|    551|                const DecodeParams dp(max_recursion_depth_);
  319|    551|                ByteOrder bo = TiffParser::decode(exifData(), iptcData(), xmpData(), rawData.c_data(pos),
  320|    551|                                                  rawData.size() - pos, dp);
  321|    551|                setByteOrder(bo);
  322|    551|              }
  323|    569|            } else {
  324|     83|#ifndef SUPPRESS_WARNINGS
  325|     83|              EXV_WARNING << "Failed to decode Exif metadata." << '\n';
  ------------------
  |  |  138|     83|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 83]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     83|  LogMsg(LogMsg::warn).os()
  ------------------
  326|     83|#endif
  327|     83|              exifData_.clear();
  328|     83|            }
  329|    652|          }
  330|       |
  331|  2.31k|          if (bIsIPTC) {
  ------------------
  |  Branch (331:15): [True: 780, False: 1.53k]
  ------------------
  332|       |#ifdef EXIV2_DEBUG_MESSAGES
  333|       |            std::cout << "Exiv2::Jp2Image::readMetadata: Iptc data found" << '\n';
  334|       |#endif
  335|    780|            Internal::enforce(box.length >= boxHSize + sizeof(uuid), ErrorCode::kerCorruptedMetadata);
  336|    780|            rawData.alloc(box.length - (boxHSize + sizeof(uuid)));
  337|    780|            bufRead = io_->read(rawData.data(), rawData.size());
  338|    780|            if (io_->error())
  ------------------
  |  Branch (338:17): [True: 0, False: 780]
  ------------------
  339|      0|              throw Error(ErrorCode::kerFailedToReadImageData);
  340|    780|            if (bufRead != rawData.size())
  ------------------
  |  Branch (340:17): [True: 0, False: 780]
  ------------------
  341|      0|              throw Error(ErrorCode::kerInputDataReadFailed);
  342|       |
  343|    780|            if (IptcParser::decode(iptcData_, rawData.c_data(), rawData.size())) {
  ------------------
  |  Branch (343:17): [True: 284, False: 496]
  ------------------
  344|    284|#ifndef SUPPRESS_WARNINGS
  345|    284|              EXV_WARNING << "Failed to decode IPTC metadata." << '\n';
  ------------------
  |  |  138|    284|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 284]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    284|  LogMsg(LogMsg::warn).os()
  ------------------
  346|    284|#endif
  347|    284|              iptcData_.clear();
  348|    284|            }
  349|    780|          }
  350|       |
  351|  2.31k|          if (bIsXMP) {
  ------------------
  |  Branch (351:15): [True: 412, False: 1.89k]
  ------------------
  352|       |#ifdef EXIV2_DEBUG_MESSAGES
  353|       |            std::cout << "Exiv2::Jp2Image::readMetadata: Xmp data found" << '\n';
  354|       |#endif
  355|    412|            Internal::enforce(box.length >= boxHSize + sizeof(uuid), ErrorCode::kerCorruptedMetadata);
  356|    412|            rawData.alloc(box.length - (boxHSize + sizeof(uuid)));
  357|    412|            bufRead = io_->read(rawData.data(), rawData.size());
  358|    412|            if (io_->error())
  ------------------
  |  Branch (358:17): [True: 0, False: 412]
  ------------------
  359|      0|              throw Error(ErrorCode::kerFailedToReadImageData);
  360|    412|            if (bufRead != rawData.size())
  ------------------
  |  Branch (360:17): [True: 0, False: 412]
  ------------------
  361|      0|              throw Error(ErrorCode::kerInputDataReadFailed);
  362|    412|            xmpPacket_.assign(rawData.c_str(), rawData.size());
  363|       |
  364|    412|            if (auto idx = xmpPacket_.find_first_of('<'); idx != std::string::npos && idx > 0) {
  ------------------
  |  Branch (364:59): [True: 128, False: 284]
  |  Branch (364:87): [True: 119, False: 9]
  ------------------
  365|    119|#ifndef SUPPRESS_WARNINGS
  366|    119|              EXV_WARNING << "Removing " << static_cast<uint32_t>(idx)
  ------------------
  |  |  138|    119|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 119]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    119|  LogMsg(LogMsg::warn).os()
  ------------------
  367|      0|                          << " characters from the beginning of the XMP packet" << '\n';
  368|    119|#endif
  369|    119|              xmpPacket_ = xmpPacket_.substr(idx);
  370|    119|            }
  371|       |
  372|    412|            const DecodeParams dp(max_recursion_depth_);
  373|    412|            if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp)) {
  ------------------
  |  Branch (373:17): [True: 156, False: 256]
  |  Branch (373:40): [True: 136, False: 20]
  ------------------
  374|    136|#ifndef SUPPRESS_WARNINGS
  375|    136|              EXV_WARNING << "Failed to decode XMP metadata." << '\n';
  ------------------
  |  |  138|    136|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 136]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    136|  LogMsg(LogMsg::warn).os()
  ------------------
  376|    136|#endif
  377|    136|            }
  378|    412|          }
  379|  2.31k|        }
  380|  2.31k|        break;
  381|  2.31k|      }
  382|       |
  383|  6.16k|      default:
  ------------------
  |  Branch (383:7): [True: 6.16k, False: 7.63k]
  ------------------
  384|  6.16k|        break;
  385|  13.7k|    }
  386|  13.3k|    lastBoxTypeRead = box.type;
  387|       |
  388|       |    // Move to the next box.
  389|  13.3k|    io_->seek(static_cast<int64_t>(position - boxHSize + box.length), BasicIo::beg);
  390|  13.3k|    if (io_->error())
  ------------------
  |  Branch (390:9): [True: 0, False: 13.3k]
  ------------------
  391|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  392|  13.3k|  }
  393|       |
  394|  1.05k|}  // Jp2Image::readMetadata
_ZN5Exiv28Jp2Image13writeMetadataEv:
  588|    527|void Jp2Image::writeMetadata() {
  589|    527|  if (io_->open() != 0) {
  ------------------
  |  Branch (589:7): [True: 0, False: 527]
  ------------------
  590|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  591|      0|  }
  592|    527|  IoCloser closer(*io_);
  593|    527|  MemIo tempIo;
  594|       |
  595|    527|  doWriteMetadata(tempIo);  // may throw
  596|    527|  io_->close();
  597|    527|  io_->transfer(tempIo);  // may throw
  598|       |
  599|    527|}  // Jp2Image::writeMetadata
_ZN5Exiv28Jp2Image15encodeJp2HeaderERKNS_7DataBufERS1_:
  601|  3.68k|void Jp2Image::encodeJp2Header(const DataBuf& boxBuf, DataBuf& outBuf) {
  602|  3.68k|  DataBuf output(boxBuf.size() + iccProfile_.size() + 100);  // allocate sufficient space
  603|  3.68k|  size_t outlen = boxHSize;                                  // now many bytes have we written to output?
  604|  3.68k|  size_t inlen = boxHSize;                                   // how many bytes have we read from boxBuf?
  605|  3.68k|  Internal::enforce(boxHSize <= output.size(), ErrorCode::kerCorruptedMetadata);
  606|  3.68k|  uint32_t length = getULong(boxBuf.c_data(0), bigEndian);
  607|  3.68k|  Internal::enforce(length <= output.size(), ErrorCode::kerCorruptedMetadata);
  608|  3.68k|  uint32_t count = boxHSize;
  609|  3.68k|  bool bWroteColor = false;
  610|       |
  611|  3.94k|  while (count < length && !bWroteColor) {
  ------------------
  |  Branch (611:10): [True: 281, False: 3.66k]
  |  Branch (611:28): [True: 266, False: 15]
  ------------------
  612|    266|    Internal::enforce(boxHSize <= length - count, ErrorCode::kerCorruptedMetadata);
  613|    266|    Internal::Jp2BoxHeader subBox;
  614|    266|    std::memcpy(&subBox, boxBuf.c_data(count), boxHSize);
  615|    266|    Internal::Jp2BoxHeader newBox = subBox;
  616|       |
  617|    266|    if (count < length) {
  ------------------
  |  Branch (617:9): [True: 265, False: 1]
  ------------------
  618|    265|      subBox.length = getULong(boxBuf.c_data(count), bigEndian);
  619|    265|      subBox.type = getULong(boxBuf.c_data(count + 4), bigEndian);
  620|       |#ifdef EXIV2_DEBUG_MESSAGES
  621|       |      std::cout << "Jp2Image::encodeJp2Header subbox: " << toAscii(subBox.type) << " length = " << subBox.length
  622|       |                << '\n';
  623|       |#endif
  624|    265|      Internal::enforce(subBox.length > 0, ErrorCode::kerCorruptedMetadata);
  625|    265|      Internal::enforce(subBox.length <= length - count, ErrorCode::kerCorruptedMetadata);
  626|    265|      count += subBox.length;
  627|    265|      newBox.type = subBox.type;
  628|    265|    } else {
  629|      1|      subBox.length = 0;
  630|      1|      newBox.type = kJp2BoxType::ColorSpec;
  631|      1|      count = length;
  632|      1|    }
  633|       |
  634|    266|    size_t newlen = subBox.length;
  635|    266|    if (newBox.type == kJp2BoxType::ColorSpec) {
  ------------------
  |  Branch (635:9): [True: 15, False: 251]
  ------------------
  636|     15|      bWroteColor = true;
  637|     15|      if (!iccProfileDefined()) {
  ------------------
  |  Branch (637:11): [True: 4, False: 11]
  ------------------
  638|      4|        const char* pad = "\x01\x00\x00\x00\x00\x00\x10\x00\x00\x05\x1cuuid";
  639|      4|        uint32_t psize = 15;
  640|      4|        Internal::enforce(newlen <= output.size() - outlen, ErrorCode::kerCorruptedMetadata);
  641|      4|        ul2Data(reinterpret_cast<byte*>(&newBox.length), psize, bigEndian);
  642|      4|        ul2Data(reinterpret_cast<byte*>(&newBox.type), newBox.type, bigEndian);
  643|      4|        std::memcpy(output.data(outlen), &newBox, sizeof(newBox));
  644|      4|        std::memcpy(output.data(outlen) + sizeof(newBox), pad, psize);
  645|     11|      } else {
  646|     11|        const char* pad = "\x02\x00\x00";
  647|     11|        uint32_t psize = 3;
  648|     11|        newlen = sizeof(newBox) + psize + iccProfile_.size();
  649|     11|        Internal::enforce(newlen <= output.size() - outlen, ErrorCode::kerCorruptedMetadata);
  650|     11|        ul2Data(reinterpret_cast<byte*>(&newBox.length), static_cast<uint32_t>(newlen), bigEndian);
  651|     11|        ul2Data(reinterpret_cast<byte*>(&newBox.type), newBox.type, bigEndian);
  652|     11|        std::memcpy(output.data(outlen), &newBox, sizeof(newBox));
  653|     11|        std::memcpy(output.data(outlen) + sizeof(newBox), pad, psize);
  654|     11|        std::copy(iccProfile_.begin(), iccProfile_.end(), output.begin() + outlen + sizeof(newBox) + psize);
  655|     11|      }
  656|    251|    } else {
  657|    251|      Internal::enforce(newlen <= output.size() - outlen, ErrorCode::kerCorruptedMetadata);
  658|    251|      std::copy_n(boxBuf.begin() + inlen, subBox.length, output.begin() + outlen);
  659|    251|    }
  660|       |
  661|    266|    outlen += newlen;
  662|    266|    inlen += subBox.length;
  663|    266|  }
  664|       |
  665|       |  // allocate the correct number of bytes, copy the data and update the box header
  666|  3.68k|  outBuf.alloc(outlen);
  667|  3.68k|  std::copy_n(output.begin(), outlen, outBuf.begin());
  668|  3.68k|  ul2Data(outBuf.data(0), static_cast<uint32_t>(outlen), bigEndian);
  669|  3.68k|  ul2Data(outBuf.data(4), kJp2BoxType::Header, bigEndian);
  670|  3.68k|}
_ZN5Exiv28Jp2Image15doWriteMetadataERNS_7BasicIoE:
  672|    527|void Jp2Image::doWriteMetadata(BasicIo& outIo) {
  673|    527|  if (!io_->isopen())
  ------------------
  |  Branch (673:7): [True: 0, False: 527]
  ------------------
  674|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  675|    527|  if (!outIo.isopen())
  ------------------
  |  Branch (675:7): [True: 0, False: 527]
  ------------------
  676|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  677|       |
  678|       |#ifdef EXIV2_DEBUG_MESSAGES
  679|       |  std::cout << "Exiv2::Jp2Image::doWriteMetadata: Writing JPEG-2000 file " << io_->path() << '\n';
  680|       |  std::cout << "Exiv2::Jp2Image::doWriteMetadata: tmp file created " << outIo.path() << '\n';
  681|       |#endif
  682|       |
  683|       |  // Ensure that this is the correct image type
  684|    527|  if (!isJp2Type(*io_, true)) {
  ------------------
  |  Branch (684:7): [True: 0, False: 527]
  ------------------
  685|      0|    throw Error(ErrorCode::kerNoImageInInputData);
  686|      0|  }
  687|       |
  688|       |  // Write JPEG2000 Signature (This is the 1st box)
  689|    527|  if (outIo.write(Jp2Signature.data(), Jp2Signature.size()) != 12)
  ------------------
  |  Branch (689:7): [True: 0, False: 527]
  ------------------
  690|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  691|       |
  692|       |#ifdef EXIV2_DEBUG_MESSAGES
  693|       |  std::cout << "Jp2Image::doWriteMetadata: JPEG 2000 Signature box written" << '\n';
  694|       |#endif
  695|       |
  696|    527|  Internal::Jp2BoxHeader box = {0, 0};
  697|       |
  698|    527|  std::array<byte, 4> boxDataSize;
  699|    527|  std::array<byte, 4> boxUUIDtype;
  700|    527|  DataBuf bheaderBuf(8);
  701|       |
  702|  10.8k|  while (io_->tell() < io_->size()) {
  ------------------
  |  Branch (702:10): [True: 10.5k, False: 313]
  ------------------
  703|       |#ifdef EXIV2_DEBUG_MESSAGES
  704|       |    std::cout << "Exiv2::Jp2Image::doWriteMetadata: Position: " << io_->tell() << " / " << io_->size() << '\n';
  705|       |#endif
  706|       |
  707|       |    // Read chunk header.
  708|  10.5k|    io_->readOrThrow(bheaderBuf.data(), bheaderBuf.size(), ErrorCode::kerInputDataReadFailed);
  709|       |
  710|       |    // Decode box header.
  711|  10.5k|    box.length = bheaderBuf.read_uint32(0, bigEndian);
  712|  10.5k|    box.type = bheaderBuf.read_uint32(4, bigEndian);
  713|       |
  714|       |#ifdef EXIV2_DEBUG_MESSAGES
  715|       |    std::cout << "Exiv2::Jp2Image::doWriteMetadata: box type: " << toAscii(box.type) << " length: " << box.length
  716|       |              << '\n';
  717|       |#endif
  718|       |
  719|  10.5k|    if (box.length == 0) {
  ------------------
  |  Branch (719:9): [True: 213, False: 10.3k]
  ------------------
  720|       |#ifdef EXIV2_DEBUG_MESSAGES
  721|       |      std::cout << "Exiv2::Jp2Image::doWriteMetadata: Null Box size has been found. "
  722|       |                   "This is the last box of file."
  723|       |                << '\n';
  724|       |#endif
  725|    213|      box.length = static_cast<uint32_t>(io_->size() - io_->tell() + 8);
  726|    213|    }
  727|  10.5k|    if (box.length < 8) {
  ------------------
  |  Branch (727:9): [True: 3, False: 10.5k]
  ------------------
  728|       |      // box is broken, so there is nothing we can do here
  729|      3|      throw Error(ErrorCode::kerCorruptedMetadata);
  730|      3|    }
  731|       |
  732|       |    // Prevent a malicious file from causing a large memory allocation.
  733|  10.5k|    Internal::enforce(box.length - 8 <= io_->size() - io_->tell(), ErrorCode::kerCorruptedMetadata);
  734|       |
  735|       |    // Read whole box : Box header + Box data (not fixed size - can be null).
  736|  10.5k|    DataBuf boxBuf(box.length);                                       // Box header (8 bytes) + box data.
  737|  10.5k|    std::copy(bheaderBuf.begin(), bheaderBuf.end(), boxBuf.begin());  // Copy header.
  738|  10.5k|    io_->readOrThrow(boxBuf.data(8), box.length - 8, ErrorCode::kerInputDataReadFailed);  // Extract box data.
  739|       |
  740|  10.5k|    switch (box.type) {
  741|  3.68k|      case kJp2BoxType::Header: {
  ------------------
  |  Branch (741:7): [True: 3.68k, False: 6.84k]
  ------------------
  742|  3.68k|        DataBuf newBuf;
  743|  3.68k|        encodeJp2Header(boxBuf, newBuf);
  744|       |#ifdef EXIV2_DEBUG_MESSAGES
  745|       |        std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write JP2Header box (length: " << box.length << ")\n";
  746|       |#endif
  747|  3.68k|        if (outIo.write(newBuf.data(), newBuf.size()) != newBuf.size())
  ------------------
  |  Branch (747:13): [True: 0, False: 3.68k]
  ------------------
  748|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  749|       |
  750|       |        // Write all updated metadata here, just after JP2Header.
  751|       |
  752|  3.68k|        if (!exifData_.empty()) {
  ------------------
  |  Branch (752:13): [True: 3.44k, False: 235]
  ------------------
  753|       |          // Update Exif data to a new UUID box
  754|       |
  755|  3.44k|          Blob blob;
  756|  3.44k|          ExifParser::encode(blob, littleEndian, exifData_);
  757|  3.44k|          if (!blob.empty()) {
  ------------------
  |  Branch (757:15): [True: 3.42k, False: 19]
  ------------------
  758|  3.42k|            DataBuf rawExif(blob.size());
  759|  3.42k|            std::copy(blob.begin(), blob.end(), rawExif.begin());
  760|       |
  761|  3.42k|            DataBuf boxData(8 + 16 + rawExif.size());
  762|  3.42k|            ul2Data(boxDataSize.data(), static_cast<uint32_t>(boxData.size()), bigEndian);
  763|  3.42k|            ul2Data(boxUUIDtype.data(), kJp2BoxType::Uuid, bigEndian);
  764|  3.42k|            std::copy(boxDataSize.begin(), boxDataSize.end(), boxData.begin());
  765|  3.42k|            std::copy(boxUUIDtype.begin(), boxUUIDtype.end(), boxData.begin() + 4);
  766|  3.42k|            std::copy(kJp2UuidExif.begin(), kJp2UuidExif.end(), boxData.begin() + 8);
  767|  3.42k|            std::copy(rawExif.begin(), rawExif.end(), boxData.begin() + 8 + 16);
  768|       |
  769|       |#ifdef EXIV2_DEBUG_MESSAGES
  770|       |            std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with Exif metadata (length: " << boxData.size()
  771|       |                      << '\n';
  772|       |#endif
  773|  3.42k|            if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size())
  ------------------
  |  Branch (773:17): [True: 0, False: 3.42k]
  ------------------
  774|      0|              throw Error(ErrorCode::kerImageWriteFailed);
  775|  3.42k|          }
  776|  3.44k|        }
  777|       |
  778|  3.68k|        if (!iptcData_.empty()) {
  ------------------
  |  Branch (778:13): [True: 282, False: 3.39k]
  ------------------
  779|       |          // Update Iptc data to a new UUID box
  780|       |
  781|    282|          DataBuf rawIptc = IptcParser::encode(iptcData_);
  782|    282|          if (!rawIptc.empty()) {
  ------------------
  |  Branch (782:15): [True: 282, False: 0]
  ------------------
  783|    282|            DataBuf boxData(8 + 16 + rawIptc.size());
  784|    282|            ul2Data(boxDataSize.data(), static_cast<uint32_t>(boxData.size()), bigEndian);
  785|    282|            ul2Data(boxUUIDtype.data(), kJp2BoxType::Uuid, bigEndian);
  786|    282|            std::copy(boxDataSize.begin(), boxDataSize.end(), boxData.begin());
  787|    282|            std::copy(boxUUIDtype.begin(), boxUUIDtype.end(), boxData.begin() + 4);
  788|    282|            std::copy(kJp2UuidIptc.begin(), kJp2UuidIptc.end(), boxData.begin() + 8);
  789|    282|            std::copy(rawIptc.begin(), rawIptc.end(), boxData.begin() + 8 + 16);
  790|       |
  791|       |#ifdef EXIV2_DEBUG_MESSAGES
  792|       |            std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with Iptc metadata (length: " << boxData.size()
  793|       |                      << '\n';
  794|       |#endif
  795|    282|            if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size())
  ------------------
  |  Branch (795:17): [True: 0, False: 282]
  ------------------
  796|      0|              throw Error(ErrorCode::kerImageWriteFailed);
  797|    282|          }
  798|    282|        }
  799|       |
  800|  3.68k|        if (!writeXmpFromPacket() && XmpParser::encode(xmpPacket_, xmpData_) > 1) {
  ------------------
  |  Branch (800:13): [True: 3.66k, False: 17]
  |  Branch (800:38): [True: 0, False: 3.66k]
  ------------------
  801|      0|#ifndef SUPPRESS_WARNINGS
  802|      0|          EXV_ERROR << "Failed to encode XMP metadata." << '\n';
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  803|      0|#endif
  804|      0|        }
  805|  3.68k|        if (!xmpPacket_.empty()) {
  ------------------
  |  Branch (805:13): [True: 70, False: 3.61k]
  ------------------
  806|       |          // Update Xmp data to a new UUID box
  807|       |
  808|     70|          DataBuf xmp(reinterpret_cast<const byte*>(xmpPacket_.data()), xmpPacket_.size());
  809|     70|          DataBuf boxData(8 + 16 + xmp.size());
  810|     70|          ul2Data(boxDataSize.data(), static_cast<uint32_t>(boxData.size()), bigEndian);
  811|     70|          ul2Data(boxUUIDtype.data(), kJp2BoxType::Uuid, bigEndian);
  812|     70|          std::copy(boxDataSize.begin(), boxDataSize.end(), boxData.begin());
  813|     70|          std::copy(boxUUIDtype.begin(), boxUUIDtype.end(), boxData.begin() + 4);
  814|     70|          std::copy(kJp2UuidXmp.begin(), kJp2UuidXmp.end(), boxData.begin() + 8);
  815|     70|          std::copy(xmp.begin(), xmp.end(), boxData.begin() + 8 + 16);
  816|       |
  817|       |#ifdef EXIV2_DEBUG_MESSAGES
  818|       |          std::cout << "Exiv2::Jp2Image::doWriteMetadata: Write box with XMP metadata (length: " << boxData.size()
  819|       |                    << ")" << '\n';
  820|       |#endif
  821|     70|          if (outIo.write(boxData.c_data(), boxData.size()) != boxData.size())
  ------------------
  |  Branch (821:15): [True: 0, False: 70]
  ------------------
  822|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  823|     70|        }
  824|       |
  825|  3.68k|        break;
  826|  3.68k|      }
  827|       |
  828|  3.68k|      case kJp2BoxType::Uuid: {
  ------------------
  |  Branch (828:7): [True: 1.11k, False: 9.41k]
  ------------------
  829|  1.11k|        Internal::enforce(boxBuf.size() >= 24, ErrorCode::kerCorruptedMetadata);
  830|  1.11k|        if (boxBuf.cmpBytes(8, kJp2UuidExif.data(), 16) == 0) {
  ------------------
  |  Branch (830:13): [True: 399, False: 711]
  ------------------
  831|       |#ifdef EXIV2_DEBUG_MESSAGES
  832|       |          std::cout << "Exiv2::Jp2Image::doWriteMetadata: strip Exif Uuid box" << '\n';
  833|       |#endif
  834|    711|        } else if (boxBuf.cmpBytes(8, kJp2UuidIptc.data(), 16) == 0) {
  ------------------
  |  Branch (834:20): [True: 290, False: 421]
  ------------------
  835|       |#ifdef EXIV2_DEBUG_MESSAGES
  836|       |          std::cout << "Exiv2::Jp2Image::doWriteMetadata: strip Iptc Uuid box" << '\n';
  837|       |#endif
  838|    421|        } else if (boxBuf.cmpBytes(8, kJp2UuidXmp.data(), 16) == 0) {
  ------------------
  |  Branch (838:20): [True: 175, False: 246]
  ------------------
  839|       |#ifdef EXIV2_DEBUG_MESSAGES
  840|       |          std::cout << "Exiv2::Jp2Image::doWriteMetadata: strip Xmp Uuid box" << '\n';
  841|       |#endif
  842|    246|        } else {
  843|       |#ifdef EXIV2_DEBUG_MESSAGES
  844|       |          std::cout << "Exiv2::Jp2Image::doWriteMetadata: write Uuid box (length: " << box.length << ")" << '\n';
  845|       |#endif
  846|    246|          if (outIo.write(boxBuf.c_data(), boxBuf.size()) != boxBuf.size())
  ------------------
  |  Branch (846:15): [True: 0, False: 246]
  ------------------
  847|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  848|    246|        }
  849|  1.11k|        break;
  850|  1.11k|      }
  851|       |
  852|  5.54k|      default: {
  ------------------
  |  Branch (852:7): [True: 5.54k, False: 4.98k]
  ------------------
  853|       |#ifdef EXIV2_DEBUG_MESSAGES
  854|       |        std::cout << "Exiv2::Jp2Image::doWriteMetadata: write box (length: " << box.length << ")" << '\n';
  855|       |#endif
  856|  5.54k|        if (outIo.write(boxBuf.c_data(), boxBuf.size()) != boxBuf.size())
  ------------------
  |  Branch (856:13): [True: 0, False: 5.54k]
  ------------------
  857|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  858|       |
  859|  5.54k|        break;
  860|  5.54k|      }
  861|  10.5k|    }
  862|  10.5k|  }
  863|       |
  864|       |#ifdef EXIV2_DEBUG_MESSAGES
  865|       |  std::cout << "Exiv2::Jp2Image::doWriteMetadata: EOF" << '\n';
  866|       |#endif
  867|       |
  868|    527|}  // Jp2Image::doWriteMetadata
_ZN5Exiv214newJp2InstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  872|  1.05k|Image::UniquePtr newJp2Instance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  873|  1.05k|  auto image = std::make_unique<Jp2Image>(std::move(io), params);
  874|  1.05k|  if (!image->good()) {
  ------------------
  |  Branch (874:7): [True: 6, False: 1.05k]
  ------------------
  875|      6|    return nullptr;
  876|      6|  }
  877|  1.05k|  return image;
  878|  1.05k|}
_ZN5Exiv29isJp2TypeERNS_7BasicIoEb:
  880|  13.3k|bool isJp2Type(BasicIo& iIo, bool advance) {
  881|  13.3k|  std::array<byte, Jp2Signature.size()> buf;
  882|  13.3k|  const size_t bytesRead = iIo.read(buf.data(), Jp2Signature.size());
  883|  13.3k|  if (iIo.error() || iIo.eof() || bytesRead != Jp2Signature.size()) {
  ------------------
  |  Branch (883:7): [True: 0, False: 13.3k]
  |  Branch (883:22): [True: 245, False: 13.0k]
  |  Branch (883:35): [True: 0, False: 13.0k]
  ------------------
  884|    245|    return false;
  885|    245|  }
  886|  13.0k|  bool matched = buf == Jp2Signature;
  887|  13.0k|  if (!advance || !matched) {
  ------------------
  |  Branch (887:7): [True: 12.5k, False: 527]
  |  Branch (887:19): [True: 0, False: 527]
  ------------------
  888|  12.5k|    iIo.seek(-static_cast<int64_t>(Jp2Signature.size()), BasicIo::cur);  // Return to original position
  889|  12.5k|  }
  890|  13.0k|  return matched;
  891|  13.3k|}
jp2image.cpp:_ZN5Exiv212_GLOBAL__N_111boxes_checkEmm:
   89|  88.5k|void boxes_check(size_t b, size_t m) {
   90|  88.5k|  if (b > m) {
  ------------------
  |  Branch (90:7): [True: 1, False: 88.5k]
  ------------------
   91|       |#ifdef EXIV2_DEBUG_MESSAGES
   92|       |    std::cout << "Exiv2::Jp2Image::readMetadata box maximum exceeded" << '\n';
   93|       |#endif
   94|      1|    throw Error(ErrorCode::kerCorruptedMetadata);
   95|      1|  }
   96|  88.5k|}

_ZN5Exiv28Internal18isValidBoxFileTypeERKNSt3__16vectorIhNS1_9allocatorIhEEEE:
   13|    120|bool isValidBoxFileType(const std::vector<uint8_t>& boxData) {
   14|       |  // BR & MinV are obligatory (4 + 4 bytes). Afterwards we have N compatibility lists (of size 4)
   15|    120|  if (boxData.size() < 8 || ((boxData.size() - 8u) % 4u) != 0) {
  ------------------
  |  Branch (15:7): [True: 19, False: 101]
  |  Branch (15:29): [True: 13, False: 88]
  ------------------
   16|     32|    return false;
   17|     32|  }
   18|       |
   19|     88|  const size_t N = (boxData.size() - 8u) / 4u;
   20|     88|  const uint32_t brand = getULong(boxData.data(), bigEndian);
   21|     88|  const uint32_t minorVersion = getULong(boxData.data() + 4, bigEndian);
   22|       |
   23|     88|  bool clWithRightBrand = false;
   24|  1.28k|  for (size_t i = 0; i < N; i++) {
  ------------------
  |  Branch (24:22): [True: 1.21k, False: 66]
  ------------------
   25|  1.21k|    uint32_t compatibilityList = getULong(boxData.data() + 8 + (i * 4), bigEndian);
   26|  1.21k|    if ((brand == brandJp2 && compatibilityList == brandJp2) || (brand == brandJph && compatibilityList == brandJph)) {
  ------------------
  |  Branch (26:10): [True: 676, False: 541]
  |  Branch (26:31): [True: 14, False: 662]
  |  Branch (26:66): [True: 292, False: 911]
  |  Branch (26:87): [True: 8, False: 284]
  ------------------
   27|     22|      clWithRightBrand = true;
   28|     22|      break;
   29|     22|    }
   30|  1.21k|  }
   31|     88|  return (minorVersion == 0 && clWithRightBrand);
  ------------------
  |  Branch (31:11): [True: 25, False: 63]
  |  Branch (31:32): [True: 11, False: 14]
  ------------------
   32|    120|}

_ZN5Exiv28JpegBaseC2ENS_9ImageTypeENSt3__110unique_ptrINS_7BasicIoENS2_14default_deleteIS4_EEEERKNS_15ImageCtorParamsEPKhm:
  117|  1.31k|    Image(type, mdExif | mdIptc | mdXmp | mdComment, std::move(io), params) {
  118|  1.31k|  if (params.create()) {
  ------------------
  |  Branch (118:7): [True: 0, False: 1.31k]
  ------------------
  119|      0|    initImage(initData, dataSize);
  120|      0|  }
  121|  1.31k|}
_ZNK5Exiv28JpegBase15advanceToMarkerENS_9ErrorCodeE:
  134|  3.56M|byte JpegBase::advanceToMarker(ErrorCode err) const {
  135|  3.56M|  int c = -1;
  136|       |  // Skips potential padding between markers
  137|  7.69M|  while ((c = io_->getb()) != 0xff) {
  ------------------
  |  Branch (137:10): [True: 4.13M, False: 3.56M]
  ------------------
  138|  4.13M|    if (c == EOF)
  ------------------
  |  Branch (138:9): [True: 874, False: 4.13M]
  ------------------
  139|    874|      throw Error(err);
  140|  4.13M|  }
  141|       |
  142|       |  // Markers can start with any number of 0xff
  143|  4.20M|  while ((c = io_->getb()) == 0xff) {
  ------------------
  |  Branch (143:10): [True: 633k, False: 3.56M]
  ------------------
  144|   633k|  }
  145|  3.56M|  if (c == EOF)
  ------------------
  |  Branch (145:7): [True: 56, False: 3.56M]
  ------------------
  146|     56|    throw Error(err);
  147|       |
  148|  3.56M|  return static_cast<byte>(c);
  149|  3.56M|}
_ZN5Exiv28JpegBase12readMetadataEv:
  151|  1.31k|void JpegBase::readMetadata() {
  152|  1.31k|  int rc = 0;  // Todo: this should be the return value
  153|       |
  154|  1.31k|  if (io_->open() != 0)
  ------------------
  |  Branch (154:7): [True: 0, False: 1.31k]
  ------------------
  155|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  156|  1.31k|  IoCloser closer(*io_);
  157|       |  // Ensure that this is the correct image type
  158|  1.31k|  if (!isThisType(*io_, true)) {
  ------------------
  |  Branch (158:7): [True: 99, False: 1.21k]
  ------------------
  159|     99|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (159:9): [True: 0, False: 99]
  |  Branch (159:25): [True: 0, False: 99]
  ------------------
  160|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  161|     99|    throw Error(ErrorCode::kerNotAJpeg);
  162|     99|  }
  163|  1.21k|  clearMetadata();
  164|  1.21k|  int search = 6;  // Exif, ICC, XMP, Comment, IPTC, SOF
  165|  1.21k|  Blob psBlob;
  166|  1.21k|  bool foundCompletePsData = false;
  167|  1.21k|  bool foundExifData = false;
  168|  1.21k|  bool foundXmpData = false;
  169|  1.21k|  bool foundIccData = false;
  170|       |
  171|       |  // Read section marker
  172|  1.21k|  byte marker = advanceToMarker(ErrorCode::kerNotAJpeg);
  173|       |
  174|   572k|  while (marker != sos_ && marker != eoi_ && search > 0) {
  ------------------
  |  Branch (174:10): [True: 572k, False: 154]
  |  Branch (174:28): [True: 572k, False: 151]
  |  Branch (174:46): [True: 572k, False: 18]
  ------------------
  175|   572k|    const auto [sizebuf, size] = readSegmentSize(marker, *io_);
  176|       |
  177|       |    // Read the rest of the segment.
  178|   572k|    DataBuf buf(size);
  179|       |    // check if the segment is not empty
  180|   572k|    if (size > 2) {
  ------------------
  |  Branch (180:9): [True: 54.2k, False: 517k]
  ------------------
  181|  54.2k|      io_->readOrThrow(buf.data(2), size - 2, ErrorCode::kerFailedToReadImageData);
  182|  54.2k|      std::copy(sizebuf.begin(), sizebuf.end(), buf.begin());
  183|  54.2k|    }
  184|       |
  185|   572k|    if (auto itSofMarker = Exiv2::find(jpegProcessMarkerTags, marker)) {
  ------------------
  |  Branch (185:14): [True: 4.40k, False: 567k]
  ------------------
  186|  4.40k|      sof_encoding_process_ = itSofMarker->label_;
  187|  4.40k|      if (size >= 7 && buf.c_data(7)) {
  ------------------
  |  Branch (187:11): [True: 2.43k, False: 1.97k]
  |  Branch (187:24): [True: 2.17k, False: 258]
  ------------------
  188|  2.17k|        num_color_components_ = *buf.c_data(7);
  189|  2.17k|      }
  190|  4.40k|    }
  191|       |
  192|   572k|    if (!foundExifData && marker == app1_ && size >= 8  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (192:9): [True: 569k, False: 2.41k]
  |  Branch (192:27): [True: 2.56k, False: 567k]
  |  Branch (192:46): [True: 1.99k, False: 574]
  ------------------
  193|  1.99k|        && buf.cmpBytes(2, exifId_.data(), 6) == 0) {
  ------------------
  |  Branch (193:12): [True: 162, False: 1.83k]
  ------------------
  194|    162|      const DecodeParams dp(max_recursion_depth_);
  195|    162|      ByteOrder bo = ExifParser::decode(exifData_, buf.c_data(8), size - 8, dp);
  196|    162|      setByteOrder(bo);
  197|    162|      if (size > 8 && byteOrder() == invalidByteOrder) {
  ------------------
  |  Branch (197:11): [True: 120, False: 42]
  |  Branch (197:23): [True: 0, False: 120]
  ------------------
  198|      0|#ifndef SUPPRESS_WARNINGS
  199|      0|        EXV_WARNING << "Failed to decode Exif metadata.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  200|      0|#endif
  201|      0|        exifData_.clear();
  202|      0|      }
  203|    162|      --search;
  204|    162|      foundExifData = true;
  205|   571k|    } else if (!foundXmpData && marker == app1_ && size >= 31  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (205:16): [True: 567k, False: 4.00k]
  |  Branch (205:33): [True: 3.05k, False: 564k]
  |  Branch (205:52): [True: 1.82k, False: 1.22k]
  ------------------
  206|  1.82k|               && buf.cmpBytes(2, xmpId_.data(), 29) == 0) {
  ------------------
  |  Branch (206:19): [True: 31, False: 1.79k]
  ------------------
  207|     31|      xmpPacket_.assign(buf.c_str(31), size - 31);
  208|     31|      const DecodeParams dp(max_recursion_depth_);
  209|     31|      if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp)) {
  ------------------
  |  Branch (209:11): [True: 25, False: 6]
  |  Branch (209:34): [True: 17, False: 8]
  ------------------
  210|     17|#ifndef SUPPRESS_WARNINGS
  211|     17|        EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|     17|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 17]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     17|  LogMsg(LogMsg::warn).os()
  ------------------
  212|     17|#endif
  213|     17|      }
  214|     31|      --search;
  215|     31|      foundXmpData = true;
  216|   571k|    } else if (!foundCompletePsData && marker == app13_ &&
  ------------------
  |  Branch (216:16): [True: 569k, False: 2.68k]
  |  Branch (216:40): [True: 40.4k, False: 528k]
  ------------------
  217|  40.4k|               size >= 16  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (217:16): [True: 40.2k, False: 271]
  ------------------
  218|  40.2k|               && buf.cmpBytes(2, Photoshop::ps3Id_, 14) == 0) {
  ------------------
  |  Branch (218:19): [True: 20.6k, False: 19.5k]
  ------------------
  219|       |#ifdef EXIV2_DEBUG_MESSAGES
  220|       |      std::cerr << "Found app13 segment, size = " << size << "\n";
  221|       |#endif
  222|  20.6k|      if (buf.size() > 16) {  // Append to psBlob
  ------------------
  |  Branch (222:11): [True: 19.3k, False: 1.37k]
  ------------------
  223|  19.3k|        append(psBlob, buf.c_data(16), size - 16);
  224|  19.3k|      }
  225|       |      // Check whether psBlob is complete
  226|  20.6k|      if (!psBlob.empty() && Photoshop::valid(psBlob.data(), psBlob.size())) {
  ------------------
  |  Branch (226:11): [True: 20.3k, False: 363]
  |  Branch (226:30): [True: 80, False: 20.2k]
  ------------------
  227|     80|        --search;
  228|     80|        foundCompletePsData = true;
  229|     80|      }
  230|   551k|    } else if (marker == com_ && comment_.empty()) {
  ------------------
  |  Branch (230:16): [True: 777, False: 550k]
  |  Branch (230:34): [True: 252, False: 525]
  ------------------
  231|       |      // JPEGs can have multiple comments, but for now only read
  232|       |      // the first one (most jpegs only have one anyway). Comments
  233|       |      // are simple single byte ISO-8859-1 strings.
  234|    252|      comment_.assign(buf.c_str(2), size - 2);
  235|  1.17k|      while (!comment_.empty() && comment_.back() == '\0') {
  ------------------
  |  Branch (235:14): [True: 994, False: 185]
  |  Branch (235:35): [True: 927, False: 67]
  ------------------
  236|    927|        comment_.pop_back();
  237|    927|      }
  238|    252|      --search;
  239|   550k|    } else if (marker == app2_ && size >= 13  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (239:16): [True: 18.1k, False: 532k]
  |  Branch (239:35): [True: 5.35k, False: 12.7k]
  ------------------
  240|  5.35k|               && buf.cmpBytes(2, iccId_, 11) == 0) {
  ------------------
  |  Branch (240:19): [True: 4.88k, False: 472]
  ------------------
  241|  4.88k|      if (size < 2 + 14 + 4) {
  ------------------
  |  Branch (241:11): [True: 53, False: 4.83k]
  ------------------
  242|     53|        rc = 8;
  243|     53|        break;
  244|     53|      }
  245|       |      // ICC profile
  246|  4.83k|      if (!foundIccData) {
  ------------------
  |  Branch (246:11): [True: 99, False: 4.73k]
  ------------------
  247|     99|        foundIccData = true;
  248|     99|        --search;
  249|     99|      }
  250|  4.83k|      auto chunk = static_cast<int>(buf.read_uint8(2 + 12));
  251|  4.83k|      auto chunks = static_cast<int>(buf.read_uint8(2 + 13));
  252|       |      // ICC1v43_2010-12.pdf header is 14 bytes
  253|       |      // header = "ICC_PROFILE\0" (12 bytes)
  254|       |      // chunk/chunks are a single byte
  255|       |      // Spec 7.2 Profile bytes 0-3 size
  256|  4.83k|      uint32_t s = buf.read_uint32(2 + 14, bigEndian);
  257|       |#ifdef EXIV2_DEBUG_MESSAGES
  258|       |      std::cerr << "Found ICC Profile chunk " << chunk << " of " << chunks << (chunk == 1 ? " size: " : "")
  259|       |                << (chunk == 1 ? s : 0) << '\n';
  260|       |#endif
  261|       |      // #1286 profile can be padded
  262|  4.83k|      size_t icc_size = size - 2 - 14;
  263|  4.83k|      if (chunk == 1 && chunks == 1) {
  ------------------
  |  Branch (263:11): [True: 346, False: 4.48k]
  |  Branch (263:25): [True: 167, False: 179]
  ------------------
  264|    167|        enforce(s <= static_cast<uint32_t>(icc_size), ErrorCode::kerInvalidIccProfile);
  265|    167|        icc_size = s;
  266|    167|      }
  267|       |
  268|  4.83k|      appendIccProfile(buf.c_data(2 + 14), icc_size, chunk == chunks);
  269|   546k|    } else if (pixelHeight_ == 0 && inRange2(marker, sof0_, sof3_, sof5_, sof15_)) {
  ------------------
  |  Branch (269:16): [True: 509k, False: 36.6k]
  |  Branch (269:37): [True: 442, False: 508k]
  ------------------
  270|       |      // We hit a SOFn (start-of-frame) marker
  271|    442|      if (size < 8) {
  ------------------
  |  Branch (271:11): [True: 62, False: 380]
  ------------------
  272|     62|        rc = 7;
  273|     62|        break;
  274|     62|      }
  275|    380|      pixelHeight_ = buf.read_uint16(3, bigEndian);
  276|    380|      pixelWidth_ = buf.read_uint16(5, bigEndian);
  277|    380|      if (pixelHeight_ != 0)
  ------------------
  |  Branch (277:11): [True: 126, False: 254]
  ------------------
  278|    126|        --search;
  279|    380|    }
  280|       |
  281|       |    // Read the beginning of the next segment
  282|   571k|    try {
  283|   571k|      marker = advanceToMarker(ErrorCode::kerFailedToReadImageData);
  284|   571k|    } catch (const Error&) {
  285|    521|      rc = 5;
  286|    521|      break;
  287|    521|    }
  288|   571k|  }  // while there are segments to process
  289|       |
  290|    959|  if (!psBlob.empty()) {
  ------------------
  |  Branch (290:7): [True: 190, False: 769]
  ------------------
  291|       |    // Find actual IPTC data within the psBlob
  292|    190|    Blob iptcBlob;
  293|    190|    const byte* record = nullptr;
  294|    190|    uint32_t sizeIptc = 0;
  295|    190|    uint32_t sizeHdr = 0;
  296|    190|    const byte* pCur = psBlob.data();
  297|    190|    const byte* pEnd = pCur + psBlob.size();
  298|  16.5k|    while (pCur < pEnd && 0 == Photoshop::locateIptcIrb(pCur, pEnd - pCur, &record, sizeHdr, sizeIptc)) {
  ------------------
  |  Branch (298:12): [True: 16.5k, False: 31]
  |  Branch (298:27): [True: 16.4k, False: 159]
  ------------------
  299|       |#ifdef EXIV2_DEBUG_MESSAGES
  300|       |      std::cerr << "Found IPTC IRB, size = " << sizeIptc << "\n";
  301|       |#endif
  302|  16.4k|      if (sizeIptc) {
  ------------------
  |  Branch (302:11): [True: 367, False: 16.0k]
  ------------------
  303|    367|        append(iptcBlob, record + sizeHdr, sizeIptc);
  304|    367|      }
  305|  16.4k|      pCur = record + sizeHdr + sizeIptc + (sizeIptc & 1);
  306|  16.4k|    }
  307|    190|    if (!iptcBlob.empty() && IptcParser::decode(iptcData_, iptcBlob.data(), iptcBlob.size())) {
  ------------------
  |  Branch (307:9): [True: 63, False: 127]
  |  Branch (307:30): [True: 22, False: 41]
  ------------------
  308|     22|#ifndef SUPPRESS_WARNINGS
  309|     22|      EXV_WARNING << "Failed to decode IPTC metadata.\n";
  ------------------
  |  |  138|     22|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 22]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     22|  LogMsg(LogMsg::warn).os()
  ------------------
  310|     22|#endif
  311|     22|      iptcData_.clear();
  312|     22|    }
  313|    190|  }
  314|       |
  315|    959|  if (rc != 0) {
  ------------------
  |  Branch (315:7): [True: 636, False: 323]
  ------------------
  316|    636|#ifndef SUPPRESS_WARNINGS
  317|    636|    EXV_WARNING << "JPEG format error, rc = " << rc << "\n";
  ------------------
  |  |  138|    636|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 636]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    636|  LogMsg(LogMsg::warn).os()
  ------------------
  318|    636|#endif
  319|    636|  }
  320|    959|}  // JpegBase::readMetadata
_ZN5Exiv28JpegBase13writeMetadataEv:
  578|    625|void JpegBase::writeMetadata() {
  579|    625|  if (io_->open() != 0) {
  ------------------
  |  Branch (579:7): [True: 0, False: 625]
  ------------------
  580|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  581|      0|  }
  582|    625|  IoCloser closer(*io_);
  583|    625|  MemIo tempIo;
  584|       |
  585|    625|  doWriteMetadata(tempIo);  // may throw
  586|    625|  io_->close();
  587|    625|  io_->transfer(tempIo);  // may throw
  588|    625|}
_ZN5Exiv28JpegBase15readNextSegmentEh:
  590|  2.99M|DataBuf JpegBase::readNextSegment(byte marker) {
  591|  2.99M|  const auto [sizebuf, size] = readSegmentSize(marker, *io_);
  592|       |
  593|       |  // Read the rest of the segment if not empty.
  594|  2.99M|  DataBuf buf(size);
  595|  2.99M|  if (size > 0) {
  ------------------
  |  Branch (595:7): [True: 116k, False: 2.87M]
  ------------------
  596|   116k|    std::copy(sizebuf.begin(), sizebuf.end(), buf.begin());
  597|   116k|    if (size > 2) {
  ------------------
  |  Branch (597:9): [True: 91.1k, False: 25.2k]
  ------------------
  598|  91.1k|      io_->readOrThrow(buf.data(2), size - 2, ErrorCode::kerFailedToReadImageData);
  599|  91.1k|    }
  600|   116k|  }
  601|  2.99M|  return buf;
  602|  2.99M|}
_ZN5Exiv28JpegBase15doWriteMetadataERNS_7BasicIoE:
  604|    625|void JpegBase::doWriteMetadata(BasicIo& outIo) {
  605|    625|  if (!io_->isopen())
  ------------------
  |  Branch (605:7): [True: 0, False: 625]
  ------------------
  606|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  607|    625|  if (!outIo.isopen())
  ------------------
  |  Branch (607:7): [True: 0, False: 625]
  ------------------
  608|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  609|       |
  610|       |  // Ensure that this is the correct image type
  611|    625|  if (!isThisType(*io_, true)) {
  ------------------
  |  Branch (611:7): [True: 0, False: 625]
  ------------------
  612|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (612:9): [True: 0, False: 0]
  |  Branch (612:25): [True: 0, False: 0]
  ------------------
  613|      0|      throw Error(ErrorCode::kerInputDataReadFailed);
  614|      0|    throw Error(ErrorCode::kerNoImageInInputData);
  615|      0|  }
  616|       |
  617|       |  // Used to initialize search variables such as skipCom.
  618|    625|  static const size_t notfound = std::numeric_limits<size_t>::max();
  619|       |
  620|    625|  const size_t seek = io_->tell();
  621|    625|  size_t count = 0;
  622|    625|  size_t search = 0;
  623|    625|  size_t insertPos = 0;
  624|    625|  size_t comPos = 0;
  625|    625|  size_t skipApp1Exif = notfound;
  626|    625|  size_t skipApp1Xmp = notfound;
  627|    625|  bool foundCompletePsData = false;
  628|    625|  bool foundIccData = false;
  629|    625|  std::vector<size_t> skipApp13Ps3;
  630|    625|  std::vector<size_t> skipApp2Icc;
  631|    625|  size_t skipCom = notfound;
  632|    625|  Blob psBlob;
  633|    625|  DataBuf rawExif;
  634|    625|  xmpData().usePacket(writeXmpFromPacket());
  635|       |
  636|       |  // Write image header
  637|    625|  if (writeHeader(outIo))
  ------------------
  |  Branch (637:7): [True: 0, False: 625]
  ------------------
  638|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  639|       |
  640|       |  // Read section marker
  641|    625|  byte marker = advanceToMarker(ErrorCode::kerNoImageInInputData);
  642|       |
  643|       |  // First find segments of interest. Normally app0 is first and we want
  644|       |  // to insert after it. But if app0 comes after com, app1 and app13 then
  645|       |  // don't bother.
  646|  1.82M|  while (marker != sos_ && marker != eoi_ && search < 6) {
  ------------------
  |  Branch (646:10): [True: 1.82M, False: 487]
  |  Branch (646:28): [True: 1.82M, False: 134]
  |  Branch (646:46): [True: 1.82M, False: 4]
  ------------------
  647|  1.82M|    DataBuf buf = readNextSegment(marker);
  648|       |
  649|  1.82M|    if (marker == app0_) {
  ------------------
  |  Branch (649:9): [True: 551, False: 1.82M]
  ------------------
  650|    551|      insertPos = count + 1;
  651|  1.82M|    } else if (skipApp1Exif == notfound && marker == app1_ &&
  ------------------
  |  Branch (651:16): [True: 1.82M, False: 5.04k]
  |  Branch (651:44): [True: 2.16k, False: 1.81M]
  ------------------
  652|  2.16k|               buf.size() >= 8 &&  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (652:16): [True: 1.68k, False: 484]
  ------------------
  653|  1.68k|               buf.cmpBytes(2, exifId_.data(), 6) == 0) {
  ------------------
  |  Branch (653:16): [True: 69, False: 1.61k]
  ------------------
  654|     69|      skipApp1Exif = count;
  655|     69|      ++search;
  656|     69|      if (buf.size() > 8) {
  ------------------
  |  Branch (656:11): [True: 61, False: 8]
  ------------------
  657|     61|        rawExif.alloc(buf.size() - 8);
  658|     61|        std::copy_n(buf.begin() + 8, rawExif.size(), rawExif.begin());
  659|     61|      }
  660|  1.82M|    } else if (skipApp1Xmp == notfound && marker == app1_ &&
  ------------------
  |  Branch (660:16): [True: 1.66M, False: 155k]
  |  Branch (660:43): [True: 2.74k, False: 1.66M]
  ------------------
  661|  2.74k|               buf.size() >= 31 &&  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (661:16): [True: 1.62k, False: 1.11k]
  ------------------
  662|  1.62k|               buf.cmpBytes(2, xmpId_.data(), 29) == 0) {
  ------------------
  |  Branch (662:16): [True: 33, False: 1.59k]
  ------------------
  663|     33|      skipApp1Xmp = count;
  664|     33|      ++search;
  665|  1.82M|    } else if (marker == app2_ && buf.size() >= 13 &&  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (665:16): [True: 23.7k, False: 1.80M]
  |  Branch (665:35): [True: 10.3k, False: 13.3k]
  ------------------
  666|  10.3k|               buf.cmpBytes(2, iccId_, 11) == 0) {
  ------------------
  |  Branch (666:16): [True: 6.14k, False: 4.20k]
  ------------------
  667|  6.14k|      skipApp2Icc.push_back(count);
  668|  6.14k|      if (!foundIccData) {
  ------------------
  |  Branch (668:11): [True: 88, False: 6.05k]
  ------------------
  669|     88|        ++search;
  670|     88|        foundIccData = true;
  671|     88|      }
  672|  1.81M|    } else if (!foundCompletePsData && marker == app13_ &&
  ------------------
  |  Branch (672:16): [True: 1.81M, False: 201]
  |  Branch (672:40): [True: 36.5k, False: 1.78M]
  ------------------
  673|  36.5k|               buf.size() >= 16 &&  // prevent out-of-bounds read in memcmp on next line
  ------------------
  |  Branch (673:16): [True: 36.2k, False: 271]
  ------------------
  674|  36.2k|               buf.cmpBytes(2, Photoshop::ps3Id_, 14) == 0) {
  ------------------
  |  Branch (674:16): [True: 18.6k, False: 17.5k]
  ------------------
  675|       |#ifdef EXIV2_DEBUG_MESSAGES
  676|       |      std::cerr << "Found APP13 Photoshop PS3 segment\n";
  677|       |#endif
  678|  18.6k|      skipApp13Ps3.push_back(count);
  679|       |      // Append to psBlob
  680|  18.6k|      append(psBlob, buf.c_data(16), buf.size() - 16);
  681|       |      // Check whether psBlob is complete
  682|  18.6k|      if (!psBlob.empty() && Photoshop::valid(psBlob.data(), psBlob.size())) {
  ------------------
  |  Branch (682:11): [True: 18.3k, False: 369]
  |  Branch (682:30): [True: 47, False: 18.2k]
  ------------------
  683|     47|        foundCompletePsData = true;
  684|     47|      }
  685|  1.80M|    } else if (marker == com_ && skipCom == notfound) {
  ------------------
  |  Branch (685:16): [True: 503, False: 1.80M]
  |  Branch (685:34): [True: 75, False: 428]
  ------------------
  686|       |      // Jpegs can have multiple comments, but for now only handle
  687|       |      // the first one (most jpegs only have one anyway).
  688|     75|      skipCom = count;
  689|     75|      ++search;
  690|     75|    }
  691|       |
  692|       |    // As in jpeg-6b/wrjpgcom.c:
  693|       |    // We will insert the new comment marker just before SOFn.
  694|       |    // This (a) causes the new comment to appear after, rather than before,
  695|       |    // existing comments; and (b) ensures that comments come after any JFIF
  696|       |    // or JFXX markers, as required by the JFIF specification.
  697|  1.82M|    if (comPos == 0 && inRange2(marker, sof0_, sof3_, sof5_, sof15_)) {
  ------------------
  |  Branch (697:9): [True: 540k, False: 1.28M]
  |  Branch (697:24): [True: 170, False: 540k]
  ------------------
  698|    170|      comPos = count;
  699|    170|      ++search;
  700|    170|    }
  701|  1.82M|    marker = advanceToMarker(ErrorCode::kerNoImageInInputData);
  702|  1.82M|    ++count;
  703|  1.82M|  }
  704|       |
  705|    625|  if (!foundCompletePsData && !psBlob.empty())
  ------------------
  |  Branch (705:7): [True: 188, False: 437]
  |  Branch (705:31): [True: 8, False: 180]
  ------------------
  706|      8|    throw Error(ErrorCode::kerNoImageInInputData);
  707|    617|  search += skipApp13Ps3.size() + skipApp2Icc.size();
  708|       |
  709|    617|  if (comPos == 0) {
  ------------------
  |  Branch (709:7): [True: 180, False: 437]
  ------------------
  710|    180|    if (marker == eoi_)
  ------------------
  |  Branch (710:9): [True: 98, False: 82]
  ------------------
  711|     98|      comPos = count;
  712|     82|    else
  713|     82|      comPos = insertPos;
  714|    180|    ++search;
  715|    180|  }
  716|    617|  if (!exifData_.empty())
  ------------------
  |  Branch (716:7): [True: 46, False: 571]
  ------------------
  717|     46|    ++search;
  718|    617|  if (!writeXmpFromPacket() && !xmpData_.empty())
  ------------------
  |  Branch (718:7): [True: 215, False: 402]
  |  Branch (718:32): [True: 7, False: 208]
  ------------------
  719|      7|    ++search;
  720|    617|  if (writeXmpFromPacket() && !xmpPacket_.empty())
  ------------------
  |  Branch (720:7): [True: 0, False: 617]
  |  Branch (720:31): [True: 0, False: 0]
  ------------------
  721|      0|    ++search;
  722|    617|  if (foundCompletePsData || !iptcData_.empty())
  ------------------
  |  Branch (722:7): [True: 437, False: 180]
  |  Branch (722:30): [True: 0, False: 180]
  ------------------
  723|     35|    ++search;
  724|    617|  if (!comment_.empty())
  ------------------
  |  Branch (724:7): [True: 15, False: 602]
  ------------------
  725|     15|    ++search;
  726|       |
  727|    617|  io_->seekOrThrow(seek, BasicIo::beg, ErrorCode::kerNoImageInInputData);
  728|    617|  count = 0;
  729|    617|  marker = advanceToMarker(ErrorCode::kerNoImageInInputData);
  730|       |
  731|       |  // To simplify this a bit, new segments are inserts at either the start
  732|       |  // or right after app0. This is standard in most jpegs, but has the
  733|       |  // potential to change segment ordering (which is allowed).
  734|       |  // Segments are erased if there is no assigned metadata.
  735|  1.16M|  while (marker != sos_ && search > 0) {
  ------------------
  |  Branch (735:10): [True: 1.16M, False: 456]
  |  Branch (735:28): [True: 1.16M, False: 49]
  ------------------
  736|  1.16M|    DataBuf buf = readNextSegment(marker);
  737|       |
  738|  1.16M|    if (insertPos == count) {
  ------------------
  |  Branch (738:9): [True: 209, False: 1.16M]
  ------------------
  739|       |      // Write Exif data first so that - if there is no app0 - we
  740|       |      // create "Exif images" according to the Exif standard.
  741|    209|      if (!exifData_.empty()) {
  ------------------
  |  Branch (741:11): [True: 46, False: 163]
  ------------------
  742|     46|        Blob blob;
  743|     46|        ByteOrder bo = byteOrder();
  744|     46|        if (bo == invalidByteOrder) {
  ------------------
  |  Branch (744:13): [True: 0, False: 46]
  ------------------
  745|      0|          bo = littleEndian;
  746|      0|          setByteOrder(bo);
  747|      0|        }
  748|     46|        const byte* pExifData = rawExif.c_data();
  749|     46|        size_t exifSize = rawExif.size();
  750|     46|        if (ExifParser::encode(blob, pExifData, exifSize, bo, exifData_) == wmIntrusive) {
  ------------------
  |  Branch (750:13): [True: 35, False: 11]
  ------------------
  751|     35|          pExifData = !blob.empty() ? blob.data() : nullptr;
  ------------------
  |  Branch (751:23): [True: 34, False: 1]
  ------------------
  752|     35|          exifSize = blob.size();
  753|     35|        }
  754|     46|        if (exifSize > 0) {
  ------------------
  |  Branch (754:13): [True: 43, False: 3]
  ------------------
  755|     43|          std::array<byte, 10> tmpBuf;
  756|       |          // Write APP1 marker, size of APP1 field, Exif id and Exif data
  757|     43|          tmpBuf[0] = 0xff;
  758|     43|          tmpBuf[1] = app1_;
  759|       |
  760|     43|          if (exifSize > 0xffff - 8)
  ------------------
  |  Branch (760:15): [True: 2, False: 41]
  ------------------
  761|      2|            throw Error(ErrorCode::kerTooLargeJpegSegment, "Exif");
  762|     41|          us2Data(tmpBuf.data() + 2, static_cast<uint16_t>(exifSize + 8), bigEndian);
  763|     41|          std::copy(exifId_.begin(), exifId_.end(), tmpBuf.begin() + 4);
  764|     41|          if (outIo.write(tmpBuf.data(), 10) != 10)
  ------------------
  |  Branch (764:15): [True: 0, False: 41]
  ------------------
  765|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  766|       |
  767|       |          // Write new Exif data buffer
  768|     41|          if (outIo.write(pExifData, exifSize) != exifSize)
  ------------------
  |  Branch (768:15): [True: 0, False: 41]
  ------------------
  769|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  770|     41|          if (outIo.error())
  ------------------
  |  Branch (770:15): [True: 0, False: 41]
  ------------------
  771|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  772|     41|          --search;
  773|     41|        }
  774|     46|      }
  775|    207|      if (!writeXmpFromPacket() &&
  ------------------
  |  Branch (775:11): [True: 205, False: 2]
  ------------------
  776|    205|          XmpParser::encode(xmpPacket_, xmpData_, XmpParser::useCompactFormat | XmpParser::omitAllFormatting) > 1) {
  ------------------
  |  Branch (776:11): [True: 0, False: 205]
  ------------------
  777|      0|#ifndef SUPPRESS_WARNINGS
  778|      0|        EXV_ERROR << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  779|      0|#endif
  780|      0|      }
  781|    207|      if (!xmpPacket_.empty()) {
  ------------------
  |  Branch (781:11): [True: 7, False: 200]
  ------------------
  782|      7|        std::array<byte, 33> tmpBuf;
  783|       |        // Write APP1 marker, size of APP1 field, XMP id and XMP packet
  784|      7|        tmpBuf[0] = 0xff;
  785|      7|        tmpBuf[1] = app1_;
  786|       |
  787|      7|        if (xmpPacket_.size() > 0xffff - 31)
  ------------------
  |  Branch (787:13): [True: 0, False: 7]
  ------------------
  788|      0|          throw Error(ErrorCode::kerTooLargeJpegSegment, "XMP");
  789|      7|        us2Data(tmpBuf.data() + 2, static_cast<uint16_t>(xmpPacket_.size() + 31), bigEndian);
  790|      7|        std::copy(xmpId_.begin(), xmpId_.end(), tmpBuf.begin() + 4);
  791|      7|        if (outIo.write(tmpBuf.data(), 33) != 33)
  ------------------
  |  Branch (791:13): [True: 0, False: 7]
  ------------------
  792|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  793|       |
  794|       |        // Write new XMP packet
  795|      7|        if (outIo.write(reinterpret_cast<const byte*>(xmpPacket_.data()), xmpPacket_.size()) != xmpPacket_.size())
  ------------------
  |  Branch (795:13): [True: 0, False: 7]
  ------------------
  796|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  797|      7|        if (outIo.error())
  ------------------
  |  Branch (797:13): [True: 0, False: 7]
  ------------------
  798|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  799|      7|        --search;
  800|      7|      }
  801|       |
  802|    207|      if (iccProfileDefined()) {
  ------------------
  |  Branch (802:11): [True: 19, False: 188]
  ------------------
  803|     19|        std::array<byte, 4> tmpBuf;
  804|       |        // Write APP2 marker, size of APP2 field, and IccProfile
  805|       |        // See comments in readMetadata() about the ICC embedding specification
  806|     19|        tmpBuf[0] = 0xff;
  807|     19|        tmpBuf[1] = app2_;
  808|       |
  809|     19|        const size_t chunk_size = (256 * 256) - 40;  // leave bytes for marker, header and padding
  810|     19|        size_t size = iccProfile_.size();
  811|     19|        if (size >= 255 * chunk_size)
  ------------------
  |  Branch (811:13): [True: 0, False: 19]
  ------------------
  812|      0|          throw Error(ErrorCode::kerTooLargeJpegSegment, "IccProfile");
  813|     19|        const size_t chunks = 1 + ((size - 1) / chunk_size);
  814|     66|        for (size_t chunk = 0; chunk < chunks; chunk++) {
  ------------------
  |  Branch (814:32): [True: 47, False: 19]
  ------------------
  815|     47|          auto bytes = std::min<size_t>(size, chunk_size);  // bytes to write
  816|     47|          size -= bytes;
  817|       |
  818|       |          // write JPEG marker (2 bytes)
  819|     47|          if (outIo.write(tmpBuf.data(), 2) != 2)
  ------------------
  |  Branch (819:15): [True: 0, False: 47]
  ------------------
  820|      0|            throw Error(ErrorCode::kerImageWriteFailed);  // JPEG Marker
  821|       |          // write length (2 bytes).  length includes the 2 bytes for the length
  822|     47|          us2Data(tmpBuf.data() + 2, static_cast<uint16_t>(2 + 14 + bytes), bigEndian);
  823|     47|          if (outIo.write(tmpBuf.data() + 2, 2) != 2)
  ------------------
  |  Branch (823:15): [True: 0, False: 47]
  ------------------
  824|      0|            throw Error(ErrorCode::kerImageWriteFailed);  // JPEG Length
  825|       |
  826|       |          // write the ICC_PROFILE header (14 bytes)
  827|     47|          uint8_t pad[2];
  828|     47|          pad[0] = static_cast<uint8_t>(chunk + 1);
  829|     47|          pad[1] = static_cast<uint8_t>(chunks);
  830|     47|          outIo.write(reinterpret_cast<const byte*>(iccId_), 12);
  831|     47|          outIo.write(reinterpret_cast<const byte*>(pad), 2);
  832|     47|          if (outIo.write(iccProfile_.c_data(chunk * chunk_size), bytes) != bytes)
  ------------------
  |  Branch (832:15): [True: 0, False: 47]
  ------------------
  833|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  834|     47|          if (outIo.error())
  ------------------
  |  Branch (834:15): [True: 0, False: 47]
  ------------------
  835|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  836|     47|        }
  837|     19|        --search;
  838|     19|      }
  839|       |
  840|    207|      if (foundCompletePsData || !iptcData_.empty()) {
  ------------------
  |  Branch (840:11): [True: 37, False: 170]
  |  Branch (840:34): [True: 0, False: 170]
  ------------------
  841|       |        // Set the new IPTC IRB, keeps existing IRBs but removes the
  842|       |        // IPTC block if there is no new IPTC data to write
  843|     35|        DataBuf newPsData = Photoshop::setIptcIrb(psBlob.data(), psBlob.size(), iptcData_);
  844|     35|        const size_t maxChunkSize = 0xffff - 16;
  845|     35|        const byte* chunkStart = newPsData.empty() ? nullptr : newPsData.c_data();
  ------------------
  |  Branch (845:34): [True: 3, False: 32]
  ------------------
  846|     35|        const byte* chunkEnd = newPsData.empty() ? nullptr : newPsData.c_data(newPsData.size() - 1);
  ------------------
  |  Branch (846:32): [True: 3, False: 32]
  ------------------
  847|     80|        while (chunkStart < chunkEnd) {
  ------------------
  |  Branch (847:16): [True: 45, False: 35]
  ------------------
  848|       |          // Determine size of next chunk
  849|     45|          size_t chunkSize = (chunkEnd + 1 - chunkStart);
  850|     45|          if (chunkSize > maxChunkSize) {
  ------------------
  |  Branch (850:15): [True: 16, False: 29]
  ------------------
  851|     16|            chunkSize = maxChunkSize;
  852|       |            // Don't break at a valid IRB boundary
  853|     16|            const auto writtenSize = chunkStart - newPsData.c_data();
  854|     16|            if (Photoshop::valid(newPsData.c_data(), writtenSize + chunkSize)) {
  ------------------
  |  Branch (854:17): [True: 0, False: 16]
  ------------------
  855|       |              // Since an IRB has minimum size 12,
  856|       |              // (chunkSize - 8) can't be also a IRB boundary
  857|      0|              chunkSize -= 8;
  858|      0|            }
  859|     16|          }
  860|       |
  861|       |          // Write APP13 marker, chunk size, and ps3Id
  862|     45|          std::array<byte, 18> tmpBuf;
  863|     45|          tmpBuf[0] = 0xff;
  864|     45|          tmpBuf[1] = app13_;
  865|     45|          us2Data(tmpBuf.data() + 2, static_cast<uint16_t>(chunkSize + 16), bigEndian);
  866|     45|          std::copy_n(Photoshop::ps3Id_, 14, tmpBuf.begin() + 4);
  867|     45|          if (outIo.write(tmpBuf.data(), 18) != 18)
  ------------------
  |  Branch (867:15): [True: 0, False: 45]
  ------------------
  868|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  869|     45|          if (outIo.error())
  ------------------
  |  Branch (869:15): [True: 0, False: 45]
  ------------------
  870|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  871|       |
  872|       |          // Write next chunk of the Photoshop IRB data buffer
  873|     45|          if (outIo.write(chunkStart, chunkSize) != chunkSize)
  ------------------
  |  Branch (873:15): [True: 0, False: 45]
  ------------------
  874|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  875|     45|          if (outIo.error())
  ------------------
  |  Branch (875:15): [True: 0, False: 45]
  ------------------
  876|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  877|       |
  878|     45|          chunkStart += chunkSize;
  879|     45|        }
  880|     35|        --search;
  881|     35|      }
  882|    207|    }
  883|  1.16M|    if (comPos == count) {
  ------------------
  |  Branch (883:9): [True: 203, False: 1.16M]
  ------------------
  884|    203|      if (!comment_.empty()) {
  ------------------
  |  Branch (884:11): [True: 15, False: 188]
  ------------------
  885|     15|        std::array<byte, 4> tmpBuf;
  886|       |        // Write COM marker, size of comment, and string
  887|     15|        tmpBuf[0] = 0xff;
  888|     15|        tmpBuf[1] = com_;
  889|       |
  890|     15|        if (comment_.length() > 0xffff - 3)
  ------------------
  |  Branch (890:13): [True: 2, False: 13]
  ------------------
  891|      2|          throw Error(ErrorCode::kerTooLargeJpegSegment, "JPEG comment");
  892|     13|        us2Data(tmpBuf.data() + 2, static_cast<uint16_t>(comment_.length() + 3), bigEndian);
  893|       |
  894|     13|        if (outIo.write(tmpBuf.data(), 4) != 4)
  ------------------
  |  Branch (894:13): [True: 0, False: 13]
  ------------------
  895|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  896|     13|        if (outIo.write(reinterpret_cast<byte*>(comment_.data()), comment_.length()) != comment_.length())
  ------------------
  |  Branch (896:13): [True: 0, False: 13]
  ------------------
  897|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  898|     13|        if (outIo.putb(0) == EOF)
  ------------------
  |  Branch (898:13): [True: 0, False: 13]
  ------------------
  899|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  900|     13|        if (outIo.error())
  ------------------
  |  Branch (900:13): [True: 0, False: 13]
  ------------------
  901|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  902|     13|        --search;
  903|     13|      }
  904|    201|      --search;
  905|    201|    }
  906|  1.16M|    if (marker == eoi_) {
  ------------------
  |  Branch (906:9): [True: 108, False: 1.16M]
  ------------------
  907|    108|      break;
  908|    108|    }
  909|  1.16M|    if (skipApp1Exif == count || skipApp1Xmp == count ||
  ------------------
  |  Branch (909:9): [True: 57, False: 1.16M]
  |  Branch (909:9): [True: 18.6k, False: 1.14M]
  |  Branch (909:34): [True: 20, False: 1.16M]
  ------------------
  910|  1.16M|        std::find(skipApp13Ps3.begin(), skipApp13Ps3.end(), count) != skipApp13Ps3.end() ||
  ------------------
  |  Branch (910:9): [True: 15.2k, False: 1.15M]
  ------------------
  911|  1.15M|        std::find(skipApp2Icc.begin(), skipApp2Icc.end(), count) != skipApp2Icc.end() || skipCom == count) {
  ------------------
  |  Branch (911:9): [True: 3.30k, False: 1.14M]
  |  Branch (911:90): [True: 33, False: 1.14M]
  ------------------
  912|  18.6k|      --search;
  913|  1.14M|    } else {
  914|  1.14M|      std::array<byte, 2> tmpBuf;
  915|       |      // Write marker and a copy of the segment.
  916|  1.14M|      tmpBuf[0] = 0xff;
  917|  1.14M|      tmpBuf[1] = marker;
  918|  1.14M|      if (outIo.write(tmpBuf.data(), 2) != 2)
  ------------------
  |  Branch (918:11): [True: 0, False: 1.14M]
  ------------------
  919|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  920|  1.14M|      if (outIo.write(buf.c_data(), buf.size()) != buf.size())
  ------------------
  |  Branch (920:11): [True: 0, False: 1.14M]
  ------------------
  921|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  922|  1.14M|      if (outIo.error())
  ------------------
  |  Branch (922:11): [True: 0, False: 1.14M]
  ------------------
  923|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  924|  1.14M|    }
  925|       |
  926|       |    // Next marker
  927|  1.16M|    marker = advanceToMarker(ErrorCode::kerNoImageInInputData);
  928|  1.16M|    ++count;
  929|  1.16M|  }
  930|       |
  931|       |  // Populate the fake data, only make sense for remoteio, httpio and sshio.
  932|       |  // it avoids allocating memory for parts of the file that contain image-date.
  933|    613|  io_->populateFakeData();
  934|       |
  935|       |  // Write the final marker, then copy rest of the Io.
  936|    613|  byte tmpBuf[2];
  937|    613|  tmpBuf[0] = 0xff;
  938|    613|  tmpBuf[1] = marker;
  939|    613|  if (outIo.write(tmpBuf, 2) != 2)
  ------------------
  |  Branch (939:7): [True: 0, False: 613]
  ------------------
  940|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  941|       |
  942|    613|  DataBuf buf(4096);
  943|    613|  size_t readSize = io_->read(buf.data(), buf.size());
  944|    983|  while (readSize != 0) {
  ------------------
  |  Branch (944:10): [True: 370, False: 613]
  ------------------
  945|    370|    if (outIo.write(buf.c_data(), readSize) != readSize)
  ------------------
  |  Branch (945:9): [True: 0, False: 370]
  ------------------
  946|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  947|    370|    readSize = io_->read(buf.data(), buf.size());
  948|    370|  }
  949|    613|  if (outIo.error())
  ------------------
  |  Branch (949:7): [True: 0, False: 613]
  ------------------
  950|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  951|       |
  952|    613|}  // JpegBase::doWriteMetadata
_ZN5Exiv29JpegImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  971|  1.28k|    JpegBase(ImageType::jpeg, std::move(io), params, blank_, sizeof(blank_)) {
  972|  1.28k|}
_ZNK5Exiv29JpegImage11writeHeaderERNS_7BasicIoE:
  978|    615|int JpegImage::writeHeader(BasicIo& outIo) const {
  979|       |  // Jpeg header
  980|    615|  byte tmpBuf[2];
  981|    615|  tmpBuf[0] = 0xff;
  982|    615|  tmpBuf[1] = soi_;
  983|    615|  if (outIo.write(tmpBuf, 2) != 2)
  ------------------
  |  Branch (983:7): [True: 0, False: 615]
  ------------------
  984|      0|    return 4;
  985|    615|  if (outIo.error())
  ------------------
  |  Branch (985:7): [True: 0, False: 615]
  ------------------
  986|      0|    return 4;
  987|    615|  return 0;
  988|    615|}
_ZNK5Exiv29JpegImage10isThisTypeERNS_7BasicIoEb:
  990|  1.90k|bool JpegImage::isThisType(BasicIo& iIo, bool advance) const {
  991|  1.90k|  return isJpegType(iIo, advance);
  992|  1.90k|}
_ZN5Exiv215newJpegInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  994|  1.15k|Image::UniquePtr newJpegInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  995|  1.15k|  auto image = std::make_unique<JpegImage>(std::move(io), params);
  996|  1.15k|  if (!image->good()) {
  ------------------
  |  Branch (996:7): [True: 0, False: 1.15k]
  ------------------
  997|      0|    return nullptr;
  998|      0|  }
  999|  1.15k|  return image;
 1000|  1.15k|}
_ZN5Exiv210isJpegTypeERNS_7BasicIoEb:
 1002|  36.0k|bool isJpegType(BasicIo& iIo, bool advance) {
 1003|  36.0k|  bool result = true;
 1004|  36.0k|  byte tmpBuf[2];
 1005|  36.0k|  iIo.read(tmpBuf, 2);
 1006|  36.0k|  if (iIo.error() || iIo.eof())
  ------------------
  |  Branch (1006:7): [True: 0, False: 36.0k]
  |  Branch (1006:22): [True: 57, False: 36.0k]
  ------------------
 1007|     57|    return false;
 1008|       |
 1009|  36.0k|  if (0xff != tmpBuf[0] || soi_ != tmpBuf[1]) {
  ------------------
  |  Branch (1009:7): [True: 31.7k, False: 4.28k]
  |  Branch (1009:28): [True: 164, False: 4.11k]
  ------------------
 1010|  31.8k|    result = false;
 1011|  31.8k|  }
 1012|  36.0k|  if (!advance || !result)
  ------------------
  |  Branch (1012:7): [True: 34.1k, False: 1.90k]
  |  Branch (1012:19): [True: 99, False: 1.80k]
  ------------------
 1013|  34.2k|    iIo.seek(-2, BasicIo::cur);
 1014|  36.0k|  return result;
 1015|  36.0k|}
_ZN5Exiv28ExvImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
 1018|     26|    JpegBase(ImageType::exv, std::move(io), params, blank_, sizeof(blank_)) {
 1019|     26|}
_ZNK5Exiv28ExvImage11writeHeaderERNS_7BasicIoE:
 1025|     10|int ExvImage::writeHeader(BasicIo& outIo) const {
 1026|       |  // Exv header
 1027|     10|  auto tmpBuf = std::array<byte, 7>{0xff, 0x01};
 1028|     10|  std::copy_n(exiv2Id_, 5, tmpBuf.begin() + 2);
 1029|     10|  if (outIo.write(tmpBuf.data(), 7) != 7)
  ------------------
  |  Branch (1029:7): [True: 0, False: 10]
  ------------------
 1030|      0|    return 4;
 1031|     10|  if (outIo.error())
  ------------------
  |  Branch (1031:7): [True: 0, False: 10]
  ------------------
 1032|      0|    return 4;
 1033|     10|  return 0;
 1034|     10|}
_ZNK5Exiv28ExvImage10isThisTypeERNS_7BasicIoEb:
 1036|     36|bool ExvImage::isThisType(BasicIo& iIo, bool advance) const {
 1037|     36|  return isExvType(iIo, advance);
 1038|     36|}
_ZN5Exiv214newExvInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
 1040|     26|Image::UniquePtr newExvInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
 1041|     26|  auto image = std::make_unique<ExvImage>(std::move(io), params);
 1042|     26|  if (!image->good())
  ------------------
  |  Branch (1042:7): [True: 0, False: 26]
  ------------------
 1043|      0|    return nullptr;
 1044|     26|  return image;
 1045|     26|}
_ZN5Exiv29isExvTypeERNS_7BasicIoEb:
 1047|  31.9k|bool isExvType(BasicIo& iIo, bool advance) {
 1048|  31.9k|  bool result = true;
 1049|  31.9k|  byte tmpBuf[7];
 1050|  31.9k|  iIo.read(tmpBuf, 7);
 1051|  31.9k|  if (iIo.error() || iIo.eof())
  ------------------
  |  Branch (1051:7): [True: 0, False: 31.9k]
  |  Branch (1051:22): [True: 87, False: 31.8k]
  ------------------
 1052|     87|    return false;
 1053|       |
 1054|  31.8k|  if (0xff != tmpBuf[0] || 0x01 != tmpBuf[1] || memcmp(tmpBuf + 2, ExvImage::exiv2Id_, 5) != 0) {
  ------------------
  |  Branch (1054:7): [True: 31.6k, False: 179]
  |  Branch (1054:28): [True: 80, False: 99]
  |  Branch (1054:49): [True: 11, False: 88]
  ------------------
 1055|  31.7k|    result = false;
 1056|  31.7k|  }
 1057|  31.8k|  if (!advance || !result)
  ------------------
  |  Branch (1057:7): [True: 31.7k, False: 36]
  |  Branch (1057:19): [True: 0, False: 36]
  ------------------
 1058|  31.7k|    iIo.seek(-7, BasicIo::cur);
 1059|  31.8k|  return result;
 1060|  31.9k|}
jpgimage.cpp:_ZN5Exiv212_GLOBAL__N_115readSegmentSizeEhRNS_7BasicIoE:
  103|  3.56M|std::pair<std::array<byte, 2>, uint16_t> readSegmentSize(const byte marker, BasicIo& io) {
  104|  3.56M|  std::array<byte, 2> buf{0, 0};  // 2-byte buffer for reading the size.
  105|  3.56M|  uint16_t size{0};               // Size of the segment, including the 2-byte size field
  106|  3.56M|  if (markerHasLength(marker)) {
  ------------------
  |  Branch (106:7): [True: 186k, False: 3.37M]
  ------------------
  107|   186k|    io.readOrThrow(buf.data(), buf.size(), ErrorCode::kerFailedToReadImageData);
  108|   186k|    size = getUShort(buf.data(), bigEndian);
  109|   186k|    enforce(size >= 2, ErrorCode::kerFailedToReadImageData);
  110|   186k|  }
  111|  3.56M|  return {buf, size};
  112|  3.56M|}
jpgimage.cpp:_ZN5Exiv212_GLOBAL__N_18inRange2Eiiiii:
   91|  1.05M|constexpr bool inRange2(int value, int lo1, int hi1, int lo2, int hi2) {
   92|  1.05M|  return inRange(lo1, value, hi1) || inRange(lo2, value, hi2);
  ------------------
  |  Branch (92:10): [True: 308, False: 1.04M]
  |  Branch (92:38): [True: 304, False: 1.04M]
  ------------------
   93|  1.05M|}
jpgimage.cpp:_ZN5Exiv212_GLOBAL__N_17inRangeEiii:
   87|  2.10M|constexpr bool inRange(int lo, int value, int hi) {
   88|  2.10M|  return lo <= value && value <= hi;
  ------------------
  |  Branch (88:10): [True: 2.09M, False: 4.91k]
  |  Branch (88:25): [True: 612, False: 2.09M]
  ------------------
   89|  2.10M|}
jpgimage.cpp:_ZN5Exiv212_GLOBAL__N_115markerHasLengthEh:
   98|  3.56M|bool markerHasLength(byte m) {
   99|  3.56M|  bool markerWithoutLength = m >= rst1_ && m <= eoi_;
  ------------------
  |  Branch (99:30): [True: 3.55M, False: 13.9k]
  |  Branch (99:44): [True: 3.37M, False: 172k]
  ------------------
  100|  3.56M|  return !markerWithoutLength;
  101|  3.56M|}

_ZNK5Exiv28Internal14TiffMnRegistryeqENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  133|   193k|bool TiffMnRegistry::operator==(std::string_view key) const {
  134|   193k|  if (!key.empty() && key.front() == '-')
  ------------------
  |  Branch (134:7): [True: 150k, False: 42.6k]
  |  Branch (134:23): [True: 7.72k, False: 143k]
  ------------------
  135|  7.72k|    return false;
  136|   185k|  return key.starts_with(make_);
  137|   193k|}
_ZNK5Exiv28Internal14TiffMnRegistryeqENS_5IfdIdE:
  139|  67.1k|bool TiffMnRegistry::operator==(IfdId key) const {
  140|  67.1k|  return mnGroup_ == key;
  141|  67.1k|}
_ZN5Exiv28Internal13TiffMnCreator6createEtNS_5IfdIdENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEPKhmNS_9ByteOrderE:
  144|  14.2k|                                                        const byte* pData, size_t size, ByteOrder byteOrder) {
  145|  14.2k|  if (auto tmr = Exiv2::find(registry_, make))
  ------------------
  |  Branch (145:12): [True: 9.58k, False: 4.68k]
  ------------------
  146|  9.58k|    return tmr->newMnFct_(tag, group, tmr->mnGroup_, pData, size, byteOrder);
  147|  4.68k|  return nullptr;
  148|  14.2k|}  // TiffMnCreator::create
_ZN5Exiv28Internal13TiffMnCreator6createEtNS_5IfdIdES2_:
  150|  5.94k|std::unique_ptr<TiffIfdMakernote> TiffMnCreator::create(uint16_t tag, IfdId group, IfdId mnGroup) {
  151|  5.94k|  if (auto tmr = Exiv2::find(registry_, mnGroup)) {
  ------------------
  |  Branch (151:12): [True: 5.94k, False: 0]
  ------------------
  152|  5.94k|    if (tmr->newMnFct2_) {
  ------------------
  |  Branch (152:9): [True: 5.94k, False: 0]
  ------------------
  153|  5.94k|      return tmr->newMnFct2_(tag, group, mnGroup);
  154|  5.94k|    }
  155|      0|    std::cout << "mnGroup = " << mnGroup << "\n";
  156|      0|  }
  157|      0|  return nullptr;
  158|  5.94k|}  // TiffMnCreator::create
_ZN5Exiv28Internal8MnHeader12setByteOrderENS_9ByteOrderE:
  160|  4.18k|void MnHeader::setByteOrder(ByteOrder) {
  161|  4.18k|}
_ZNK5Exiv28Internal8MnHeader9ifdOffsetEv:
  163|    161|size_t MnHeader::ifdOffset() const {
  164|    161|  return 0;
  165|    161|}
_ZNK5Exiv28Internal8MnHeader9byteOrderEv:
  167|  13.6k|ByteOrder MnHeader::byteOrder() const {
  168|  13.6k|  return invalidByteOrder;
  169|  13.6k|}
_ZNK5Exiv28Internal8MnHeader10baseOffsetEm:
  171|  1.19k|size_t MnHeader::baseOffset(size_t /*mnOffset*/) const {
  172|  1.19k|  return 0;
  173|  1.19k|}
_ZN5Exiv28Internal15OlympusMnHeader15sizeOfSignatureEv:
  177|  4.18k|size_t OlympusMnHeader::sizeOfSignature() {
  178|  4.18k|  return sizeof(signature_);
  179|  4.18k|}
_ZN5Exiv28Internal15OlympusMnHeaderC2Ev:
  181|    450|OlympusMnHeader::OlympusMnHeader() {
  182|    450|  read(signature_, sizeOfSignature(), invalidByteOrder);
  183|    450|}
_ZNK5Exiv28Internal15OlympusMnHeader4sizeEv:
  185|    222|size_t OlympusMnHeader::size() const {
  186|    222|  return header_.size();
  187|    222|}
_ZNK5Exiv28Internal15OlympusMnHeader9ifdOffsetEv:
  189|    106|size_t OlympusMnHeader::ifdOffset() const {
  190|    106|  return sizeOfSignature();
  191|    106|}
_ZN5Exiv28Internal15OlympusMnHeader4readEPKhmNS_9ByteOrderE:
  193|    874|bool OlympusMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  194|    874|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (194:7): [True: 0, False: 874]
  |  Branch (194:17): [True: 0, False: 874]
  ------------------
  195|      0|    return false;
  196|    874|  header_.alloc(sizeOfSignature());
  197|    874|  std::copy_n(pData, header_.size(), header_.begin());
  198|    874|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 6);
  ------------------
  |  Branch (198:10): [True: 874, False: 0]
  |  Branch (198:49): [True: 556, False: 318]
  ------------------
  199|    874|}
_ZNK5Exiv28Internal15OlympusMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  201|     24|size_t OlympusMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  202|     24|  ioWrapper.write(signature_, sizeOfSignature());
  203|     24|  return sizeOfSignature();
  204|     24|}  // OlympusMnHeader::write
_ZN5Exiv28Internal16Olympus2MnHeader15sizeOfSignatureEv:
  208|  6.81k|size_t Olympus2MnHeader::sizeOfSignature() {
  209|  6.81k|  return sizeof(signature_);
  210|  6.81k|}
_ZN5Exiv28Internal16Olympus2MnHeaderC2Ev:
  212|    750|Olympus2MnHeader::Olympus2MnHeader() {
  213|    750|  read(signature_, sizeOfSignature(), invalidByteOrder);
  214|    750|}
_ZNK5Exiv28Internal16Olympus2MnHeader4sizeEv:
  216|      8|size_t Olympus2MnHeader::size() const {
  217|      8|  return header_.size();
  218|      8|}
_ZNK5Exiv28Internal16Olympus2MnHeader9ifdOffsetEv:
  220|    750|size_t Olympus2MnHeader::ifdOffset() const {
  221|    750|  return sizeOfSignature();
  222|    750|}
_ZNK5Exiv28Internal16Olympus2MnHeader10baseOffsetEm:
  224|    750|size_t Olympus2MnHeader::baseOffset(size_t mnOffset) const {
  225|    750|  return mnOffset;
  226|    750|}
_ZN5Exiv28Internal16Olympus2MnHeader4readEPKhmNS_9ByteOrderE:
  228|  1.50k|bool Olympus2MnHeader::read(const byte* pData, size_t size, ByteOrder) {
  229|  1.50k|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (229:7): [True: 0, False: 1.50k]
  |  Branch (229:17): [True: 0, False: 1.50k]
  ------------------
  230|      0|    return false;
  231|  1.50k|  header_.alloc(sizeOfSignature());
  232|  1.50k|  std::copy_n(pData, header_.size(), header_.begin());
  233|  1.50k|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 10);
  ------------------
  |  Branch (233:10): [True: 1.50k, False: 0]
  |  Branch (233:49): [True: 1.50k, False: 0]
  ------------------
  234|  1.50k|}
_ZN5Exiv28Internal16OMSystemMnHeader15sizeOfSignatureEv:
  244|  30.6k|size_t OMSystemMnHeader::sizeOfSignature() {
  245|  30.6k|  return sizeof(signature_);
  246|  30.6k|}
_ZN5Exiv28Internal16OMSystemMnHeaderC2Ev:
  248|  4.20k|OMSystemMnHeader::OMSystemMnHeader() {
  249|  4.20k|  read(signature_, sizeOfSignature(), invalidByteOrder);
  250|  4.20k|}
_ZNK5Exiv28Internal16OMSystemMnHeader4sizeEv:
  252|  35.2k|size_t OMSystemMnHeader::size() const {
  253|  35.2k|  return header_.size();
  254|  35.2k|}
_ZNK5Exiv28Internal16OMSystemMnHeader9ifdOffsetEv:
  256|    191|size_t OMSystemMnHeader::ifdOffset() const {
  257|    191|  return sizeOfSignature();
  258|    191|}
_ZNK5Exiv28Internal16OMSystemMnHeader10baseOffsetEm:
  260|  4.10k|size_t OMSystemMnHeader::baseOffset(size_t mnOffset) const {
  261|  4.10k|  return mnOffset;
  262|  4.10k|}
_ZN5Exiv28Internal16OMSystemMnHeader4readEPKhmNS_9ByteOrderE:
  264|  4.48k|bool OMSystemMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  265|  4.48k|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (265:7): [True: 0, False: 4.48k]
  |  Branch (265:17): [True: 0, False: 4.48k]
  ------------------
  266|      0|    return false;
  267|  4.48k|  header_.alloc(sizeOfSignature());
  268|  4.48k|  std::copy_n(pData, header_.size(), header_.begin());
  269|  4.48k|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, sizeOfSignature() - 2);
  ------------------
  |  Branch (269:10): [True: 4.48k, False: 0]
  |  Branch (269:49): [True: 4.39k, False: 93]
  ------------------
  270|  4.48k|}
_ZNK5Exiv28Internal16OMSystemMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  272|  3.91k|size_t OMSystemMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  273|  3.91k|  ioWrapper.write(signature_, sizeOfSignature());
  274|  3.91k|  return sizeOfSignature();
  275|  3.91k|}  // OMSystemMnHeader::write
_ZN5Exiv28Internal12FujiMnHeader15sizeOfSignatureEv:
  280|  1.33k|size_t FujiMnHeader::sizeOfSignature() {
  281|  1.33k|  return sizeof(signature_);
  282|  1.33k|}
_ZN5Exiv28Internal12FujiMnHeaderC2Ev:
  284|    167|FujiMnHeader::FujiMnHeader() {
  285|    167|  read(signature_, sizeOfSignature(), byteOrder_);
  286|    167|}
_ZNK5Exiv28Internal12FujiMnHeader4sizeEv:
  288|    265|size_t FujiMnHeader::size() const {
  289|    265|  return header_.size();
  290|    265|}
_ZNK5Exiv28Internal12FujiMnHeader9ifdOffsetEv:
  292|     99|size_t FujiMnHeader::ifdOffset() const {
  293|     99|  return start_;
  294|     99|}
_ZNK5Exiv28Internal12FujiMnHeader9byteOrderEv:
  296|    404|ByteOrder FujiMnHeader::byteOrder() const {
  297|    404|  return byteOrder_;
  298|    404|}
_ZNK5Exiv28Internal12FujiMnHeader10baseOffsetEm:
  300|    125|size_t FujiMnHeader::baseOffset(size_t mnOffset) const {
  301|    125|  return mnOffset;
  302|    125|}
_ZN5Exiv28Internal12FujiMnHeader4readEPKhmNS_9ByteOrderE:
  304|    303|bool FujiMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  305|    303|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (305:7): [True: 0, False: 303]
  |  Branch (305:17): [True: 0, False: 303]
  ------------------
  306|      0|    return false;
  307|    303|  header_.alloc(sizeOfSignature());
  308|    303|  std::copy_n(pData, header_.size(), header_.begin());
  309|       |  // Read offset to the IFD relative to the start of the makernote
  310|       |  // from the header. Note that we ignore the byteOrder argument
  311|    303|  start_ = header_.read_uint32(8, byteOrder_);
  312|    303|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 8);
  ------------------
  |  Branch (312:10): [True: 303, False: 0]
  |  Branch (312:49): [True: 266, False: 37]
  ------------------
  313|    303|}
_ZNK5Exiv28Internal12FujiMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  315|     29|size_t FujiMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  316|     29|  ioWrapper.write(signature_, sizeOfSignature());
  317|     29|  return sizeOfSignature();
  318|     29|}  // FujiMnHeader::write
_ZN5Exiv28Internal14Nikon2MnHeader15sizeOfSignatureEv:
  322|  1.14k|size_t Nikon2MnHeader::sizeOfSignature() {
  323|  1.14k|  return sizeof(signature_);
  324|  1.14k|}
_ZN5Exiv28Internal14Nikon2MnHeaderC2Ev:
  326|    110|Nikon2MnHeader::Nikon2MnHeader() {
  327|    110|  read(signature_, sizeOfSignature(), invalidByteOrder);
  328|    110|}
_ZNK5Exiv28Internal14Nikon2MnHeader4sizeEv:
  330|    239|size_t Nikon2MnHeader::size() const {
  331|    239|  return sizeOfSignature();
  332|    239|}
_ZNK5Exiv28Internal14Nikon2MnHeader9ifdOffsetEv:
  334|     83|size_t Nikon2MnHeader::ifdOffset() const {
  335|     83|  return start_;
  336|     83|}
_ZN5Exiv28Internal14Nikon2MnHeader4readEPKhmNS_9ByteOrderE:
  338|    193|bool Nikon2MnHeader::read(const byte* pData, size_t size, ByteOrder) {
  339|    193|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (339:7): [True: 0, False: 193]
  |  Branch (339:17): [True: 0, False: 193]
  ------------------
  340|      0|    return false;
  341|    193|  if (0 != memcmp(pData, signature_, 6))
  ------------------
  |  Branch (341:7): [True: 0, False: 193]
  ------------------
  342|      0|    return false;
  343|    193|  buf_.alloc(sizeOfSignature());
  344|    193|  std::copy_n(pData, buf_.size(), buf_.begin());
  345|    193|  start_ = sizeOfSignature();
  346|    193|  return true;
  347|    193|}  // Nikon2MnHeader::read
_ZNK5Exiv28Internal14Nikon2MnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  349|     26|size_t Nikon2MnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  350|     26|  ioWrapper.write(signature_, sizeOfSignature());
  351|     26|  return sizeOfSignature();
  352|     26|}  // Nikon2MnHeader::write
_ZN5Exiv28Internal14Nikon3MnHeader15sizeOfSignatureEv:
  357|  6.48k|size_t Nikon3MnHeader::sizeOfSignature() {
  358|  6.48k|  return sizeof(signature_);
  359|  6.48k|}
_ZN5Exiv28Internal14Nikon3MnHeaderC2Ev:
  361|    905|Nikon3MnHeader::Nikon3MnHeader() : start_(sizeOfSignature()) {
  362|    905|  buf_.alloc(sizeOfSignature());
  363|    905|  std::copy_n(signature_, buf_.size(), buf_.begin());
  364|    905|}
_ZNK5Exiv28Internal14Nikon3MnHeader4sizeEv:
  366|  2.87k|size_t Nikon3MnHeader::size() const {
  367|  2.87k|  return sizeOfSignature();
  368|  2.87k|}
_ZNK5Exiv28Internal14Nikon3MnHeader9ifdOffsetEv:
  370|    579|size_t Nikon3MnHeader::ifdOffset() const {
  371|    579|  return start_;
  372|    579|}
_ZNK5Exiv28Internal14Nikon3MnHeader9byteOrderEv:
  374|  3.15k|ByteOrder Nikon3MnHeader::byteOrder() const {
  375|  3.15k|  return byteOrder_;
  376|  3.15k|}
_ZNK5Exiv28Internal14Nikon3MnHeader10baseOffsetEm:
  378|    885|size_t Nikon3MnHeader::baseOffset(size_t mnOffset) const {
  379|    885|  return Safe::add<size_t>(mnOffset, 10);
  380|    885|}
_ZN5Exiv28Internal14Nikon3MnHeader4readEPKhmNS_9ByteOrderE:
  382|    579|bool Nikon3MnHeader::read(const byte* pData, size_t size, ByteOrder) {
  383|    579|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (383:7): [True: 0, False: 579]
  |  Branch (383:17): [True: 0, False: 579]
  ------------------
  384|      0|    return false;
  385|    579|  if (0 != memcmp(pData, signature_, 6))
  ------------------
  |  Branch (385:7): [True: 0, False: 579]
  ------------------
  386|      0|    return false;
  387|    579|  buf_.alloc(sizeOfSignature());
  388|    579|  std::copy_n(pData, buf_.size(), buf_.begin());
  389|    579|  TiffHeader th;
  390|    579|  if (!th.read(buf_.data(10), 8))
  ------------------
  |  Branch (390:7): [True: 0, False: 579]
  ------------------
  391|      0|    return false;
  392|    579|  byteOrder_ = th.byteOrder();
  393|    579|  start_ = 10 + th.offset();
  394|    579|  return true;
  395|    579|}  // Nikon3MnHeader::read
_ZNK5Exiv28Internal14Nikon3MnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  397|    314|size_t Nikon3MnHeader::write(IoWrapper& ioWrapper, ByteOrder byteOrder) const {
  398|    314|  ioWrapper.write(buf_.c_data(), 10);
  399|       |  /// \todo: This removes any gap between the header and makernote IFD. The gap should be copied too.
  400|    314|  TiffHeader th(byteOrder);
  401|    314|  DataBuf buf = th.write();
  402|    314|  ioWrapper.write(buf.c_data(), buf.size());
  403|    314|  return 10 + buf.size();
  404|    314|}
_ZN5Exiv28Internal14Nikon3MnHeader12setByteOrderENS_9ByteOrderE:
  406|    326|void Nikon3MnHeader::setByteOrder(ByteOrder byteOrder) {
  407|    326|  byteOrder_ = byteOrder;
  408|    326|}
_ZN5Exiv28Internal17PanasonicMnHeader15sizeOfSignatureEv:
  412|  2.13k|size_t PanasonicMnHeader::sizeOfSignature() {
  413|  2.13k|  return sizeof(signature_);
  414|  2.13k|}
_ZN5Exiv28Internal17PanasonicMnHeaderC2Ev:
  416|    279|PanasonicMnHeader::PanasonicMnHeader() {
  417|    279|  read(signature_, sizeOfSignature(), invalidByteOrder);
  418|    279|}
_ZNK5Exiv28Internal17PanasonicMnHeader4sizeEv:
  420|     31|size_t PanasonicMnHeader::size() const {
  421|     31|  return sizeOfSignature();
  422|     31|}
_ZNK5Exiv28Internal17PanasonicMnHeader9ifdOffsetEv:
  424|     50|size_t PanasonicMnHeader::ifdOffset() const {
  425|     50|  return start_;
  426|     50|}
_ZN5Exiv28Internal17PanasonicMnHeader4readEPKhmNS_9ByteOrderE:
  428|    553|bool PanasonicMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  429|    553|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (429:7): [True: 0, False: 553]
  |  Branch (429:17): [True: 0, False: 553]
  ------------------
  430|      0|    return false;
  431|    553|  if (0 != memcmp(pData, signature_, 9))
  ------------------
  |  Branch (431:7): [True: 224, False: 329]
  ------------------
  432|    224|    return false;
  433|    329|  buf_.alloc(sizeOfSignature());
  434|    329|  std::copy_n(pData, buf_.size(), buf_.begin());
  435|    329|  start_ = sizeOfSignature();
  436|    329|  return true;
  437|    553|}  // PanasonicMnHeader::read
_ZNK5Exiv28Internal17PanasonicMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  439|      3|size_t PanasonicMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  440|      3|  ioWrapper.write(signature_, sizeOfSignature());
  441|      3|  return sizeOfSignature();
  442|      3|}  // PanasonicMnHeader::write
_ZN5Exiv28Internal17PentaxDngMnHeader15sizeOfSignatureEv:
  446|  5.98k|size_t PentaxDngMnHeader::sizeOfSignature() {
  447|  5.98k|  return sizeof(signature_);
  448|  5.98k|}
_ZN5Exiv28Internal17PentaxDngMnHeaderC2Ev:
  450|    972|PentaxDngMnHeader::PentaxDngMnHeader() {
  451|    972|  read(signature_, sizeOfSignature(), invalidByteOrder);
  452|    972|}
_ZNK5Exiv28Internal17PentaxDngMnHeader4sizeEv:
  454|  4.63k|size_t PentaxDngMnHeader::size() const {
  455|  4.63k|  return header_.size();
  456|  4.63k|}
_ZNK5Exiv28Internal17PentaxDngMnHeader10baseOffsetEm:
  458|    971|size_t PentaxDngMnHeader::baseOffset(size_t mnOffset) const {
  459|    971|  return mnOffset;
  460|    971|}
_ZNK5Exiv28Internal17PentaxDngMnHeader9ifdOffsetEv:
  462|     44|size_t PentaxDngMnHeader::ifdOffset() const {
  463|     44|  return sizeOfSignature();
  464|     44|}
_ZN5Exiv28Internal17PentaxDngMnHeader4readEPKhmNS_9ByteOrderE:
  466|  1.01k|bool PentaxDngMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  467|  1.01k|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (467:7): [True: 0, False: 1.01k]
  |  Branch (467:17): [True: 0, False: 1.01k]
  ------------------
  468|      0|    return false;
  469|  1.01k|  header_.alloc(sizeOfSignature());
  470|  1.01k|  std::copy_n(pData, header_.size(), header_.begin());
  471|  1.01k|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 7);
  ------------------
  |  Branch (471:10): [True: 1.01k, False: 0]
  |  Branch (471:49): [True: 1.01k, False: 0]
  ------------------
  472|  1.01k|}
_ZNK5Exiv28Internal17PentaxDngMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  474|    927|size_t PentaxDngMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  475|    927|  ioWrapper.write(signature_, sizeOfSignature());
  476|    927|  return sizeOfSignature();
  477|    927|}  // PentaxDngMnHeader::write
_ZN5Exiv28Internal14PentaxMnHeader15sizeOfSignatureEv:
  481|    861|size_t PentaxMnHeader::sizeOfSignature() {
  482|    861|  return sizeof(signature_);
  483|    861|}
_ZN5Exiv28Internal14PentaxMnHeaderC2Ev:
  485|     99|PentaxMnHeader::PentaxMnHeader() {
  486|     99|  read(signature_, sizeOfSignature(), invalidByteOrder);
  487|     99|}
_ZNK5Exiv28Internal14PentaxMnHeader4sizeEv:
  489|    157|size_t PentaxMnHeader::size() const {
  490|    157|  return header_.size();
  491|    157|}
_ZNK5Exiv28Internal14PentaxMnHeader9ifdOffsetEv:
  493|     80|size_t PentaxMnHeader::ifdOffset() const {
  494|     80|  return sizeOfSignature();
  495|     80|}
_ZN5Exiv28Internal14PentaxMnHeader4readEPKhmNS_9ByteOrderE:
  497|    179|bool PentaxMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  498|    179|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (498:7): [True: 0, False: 179]
  |  Branch (498:17): [True: 0, False: 179]
  ------------------
  499|      0|    return false;
  500|    179|  header_.alloc(sizeOfSignature());
  501|    179|  std::copy_n(pData, header_.size(), header_.begin());
  502|    179|  return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 3);
  ------------------
  |  Branch (502:10): [True: 179, False: 0]
  |  Branch (502:49): [True: 179, False: 0]
  ------------------
  503|    179|}
_ZNK5Exiv28Internal14PentaxMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  505|     17|size_t PentaxMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  506|     17|  ioWrapper.write(signature_, sizeOfSignature());
  507|     17|  return sizeOfSignature();
  508|     17|}
_ZN5Exiv28Internal15SamsungMnHeaderC2Ev:
  510|    185|SamsungMnHeader::SamsungMnHeader() {
  511|    185|  read(nullptr, 0, invalidByteOrder);
  512|    185|}
_ZNK5Exiv28Internal15SamsungMnHeader4sizeEv:
  514|    239|size_t SamsungMnHeader::size() const {
  515|    239|  return 0;
  516|    239|}
_ZNK5Exiv28Internal15SamsungMnHeader10baseOffsetEm:
  518|    183|size_t SamsungMnHeader::baseOffset(size_t mnOffset) const {
  519|    183|  return mnOffset;
  520|    183|}
_ZN5Exiv28Internal15SamsungMnHeader4readEPKhmNS_9ByteOrderE:
  522|    346|bool SamsungMnHeader::read(const byte* /*pData*/, size_t /*size*/, ByteOrder) {
  523|    346|  return true;
  524|    346|}  // SamsungMnHeader::read
_ZNK5Exiv28Internal15SamsungMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  526|     22|size_t SamsungMnHeader::write(IoWrapper& /*ioWrapper*/, ByteOrder) const {
  527|     22|  return 0;
  528|     22|}  // SamsungMnHeader::write
_ZN5Exiv28Internal13SigmaMnHeader15sizeOfSignatureEv:
  533|  2.43k|size_t SigmaMnHeader::sizeOfSignature() {
  534|  2.43k|  return sizeof(signature1_);
  535|  2.43k|}
_ZN5Exiv28Internal13SigmaMnHeaderC2Ev:
  537|    277|SigmaMnHeader::SigmaMnHeader() {
  538|    277|  read(signature1_, sizeOfSignature(), invalidByteOrder);
  539|    277|}
_ZNK5Exiv28Internal13SigmaMnHeader4sizeEv:
  541|    112|size_t SigmaMnHeader::size() const {
  542|    112|  return sizeOfSignature();
  543|    112|}
_ZNK5Exiv28Internal13SigmaMnHeader9ifdOffsetEv:
  545|    169|size_t SigmaMnHeader::ifdOffset() const {
  546|    169|  return start_;
  547|    169|}
_ZN5Exiv28Internal13SigmaMnHeader4readEPKhmNS_9ByteOrderE:
  549|    540|bool SigmaMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  550|    540|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (550:7): [True: 0, False: 540]
  |  Branch (550:17): [True: 0, False: 540]
  ------------------
  551|      0|    return false;
  552|    540|  if (0 != memcmp(pData, signature1_, 8) && 0 != memcmp(pData, signature2_, 8))
  ------------------
  |  Branch (552:7): [True: 163, False: 377]
  |  Branch (552:45): [True: 94, False: 69]
  ------------------
  553|     94|    return false;
  554|    446|  buf_.alloc(sizeOfSignature());
  555|    446|  std::copy_n(pData, buf_.size(), buf_.begin());
  556|    446|  start_ = sizeOfSignature();
  557|    446|  return true;
  558|    540|}  // SigmaMnHeader::read
_ZNK5Exiv28Internal13SigmaMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  560|     12|size_t SigmaMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  561|     12|  ioWrapper.write(signature1_, sizeOfSignature());
  562|     12|  return sizeOfSignature();
  563|     12|}  // SigmaMnHeader::write
_ZN5Exiv28Internal12SonyMnHeader15sizeOfSignatureEv:
  567|  6.76k|size_t SonyMnHeader::sizeOfSignature() {
  568|  6.76k|  return sizeof(signature_);
  569|  6.76k|}
_ZN5Exiv28Internal12SonyMnHeaderC2Ev:
  571|    597|SonyMnHeader::SonyMnHeader() {
  572|    597|  read(signature_, sizeOfSignature(), invalidByteOrder);
  573|    597|}
_ZNK5Exiv28Internal12SonyMnHeader4sizeEv:
  575|  1.17k|size_t SonyMnHeader::size() const {
  576|  1.17k|  return sizeOfSignature();
  577|  1.17k|}
_ZNK5Exiv28Internal12SonyMnHeader9ifdOffsetEv:
  579|    465|size_t SonyMnHeader::ifdOffset() const {
  580|    465|  return start_;
  581|    465|}
_ZN5Exiv28Internal12SonyMnHeader4readEPKhmNS_9ByteOrderE:
  583|  1.06k|bool SonyMnHeader::read(const byte* pData, size_t size, ByteOrder) {
  584|  1.06k|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (584:7): [True: 0, False: 1.06k]
  |  Branch (584:17): [True: 0, False: 1.06k]
  ------------------
  585|      0|    return false;
  586|  1.06k|  if (0 != memcmp(pData, signature_, sizeOfSignature()))
  ------------------
  |  Branch (586:7): [True: 0, False: 1.06k]
  ------------------
  587|      0|    return false;
  588|  1.06k|  buf_.alloc(sizeOfSignature());
  589|  1.06k|  std::copy_n(pData, buf_.size(), buf_.begin());
  590|  1.06k|  start_ = sizeOfSignature();
  591|  1.06k|  return true;
  592|  1.06k|}  // SonyMnHeader::read
_ZNK5Exiv28Internal12SonyMnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  594|    130|size_t SonyMnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  595|    130|  ioWrapper.write(signature_, sizeOfSignature());
  596|    130|  return sizeOfSignature();
  597|    130|}  // SonyMnHeader::write
_ZN5Exiv28Internal14Casio2MnHeader15sizeOfSignatureEv:
  602|    307|size_t Casio2MnHeader::sizeOfSignature() {
  603|    307|  return sizeof(signature_);
  604|    307|}
_ZN5Exiv28Internal14Casio2MnHeaderC2Ev:
  606|     31|Casio2MnHeader::Casio2MnHeader() {
  607|     31|  read(signature_, sizeOfSignature(), invalidByteOrder);
  608|     31|}
_ZNK5Exiv28Internal14Casio2MnHeader4sizeEv:
  610|     36|size_t Casio2MnHeader::size() const {
  611|     36|  return sizeOfSignature();
  612|     36|}
_ZNK5Exiv28Internal14Casio2MnHeader9ifdOffsetEv:
  614|     27|size_t Casio2MnHeader::ifdOffset() const {
  615|     27|  return start_;
  616|     27|}
_ZNK5Exiv28Internal14Casio2MnHeader9byteOrderEv:
  618|    100|ByteOrder Casio2MnHeader::byteOrder() const {
  619|    100|  return byteOrder_;
  620|    100|}
_ZN5Exiv28Internal14Casio2MnHeader4readEPKhmNS_9ByteOrderE:
  622|     58|bool Casio2MnHeader::read(const byte* pData, size_t size, ByteOrder) {
  623|     58|  if (!pData || size < sizeOfSignature())
  ------------------
  |  Branch (623:7): [True: 0, False: 58]
  |  Branch (623:17): [True: 0, False: 58]
  ------------------
  624|      0|    return false;
  625|     58|  if (0 != memcmp(pData, signature_, sizeOfSignature()))
  ------------------
  |  Branch (625:7): [True: 0, False: 58]
  ------------------
  626|      0|    return false;
  627|     58|  buf_.alloc(sizeOfSignature());
  628|     58|  std::copy_n(pData, buf_.size(), buf_.begin());
  629|     58|  start_ = sizeOfSignature();
  630|     58|  return true;
  631|     58|}  // Casio2MnHeader::read
_ZNK5Exiv28Internal14Casio2MnHeader5writeERNS0_9IoWrapperENS_9ByteOrderE:
  633|      4|size_t Casio2MnHeader::write(IoWrapper& ioWrapper, ByteOrder) const {
  634|      4|  ioWrapper.write(signature_, sizeOfSignature());
  635|      4|  return sizeOfSignature();
  636|      4|}  // Casio2MnHeader::write
_ZN5Exiv28Internal8newIfdMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  642|  1.73k|                                           ByteOrder) {
  643|       |  // Require at least an IFD with 1 entry, but not necessarily a next pointer
  644|  1.73k|  if (size < 14)
  ------------------
  |  Branch (644:7): [True: 746, False: 988]
  ------------------
  645|    746|    return nullptr;
  646|    988|  return newIfdMn2(tag, group, mnGroup);
  647|  1.73k|}
_ZN5Exiv28Internal9newIfdMn2EtNS_5IfdIdES1_:
  649|  1.95k|std::unique_ptr<TiffIfdMakernote> newIfdMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  650|  1.95k|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, nullptr);
  651|  1.95k|}
_ZN5Exiv28Internal12newOlympusMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  654|  1.95k|                                               ByteOrder) {
  655|       |  // FIXME: workaround for overwritten OM System header in Olympus files (https://github.com/Exiv2/exiv2/issues/2542)
  656|  1.95k|  if (size >= 14 && std::string(reinterpret_cast<const char*>(pData), 14) == std::string("OM SYSTEM\0\0\0II", 14)) {
  ------------------
  |  Branch (656:7): [True: 1.37k, False: 585]
  |  Branch (656:7): [True: 185, False: 1.77k]
  |  Branch (656:21): [True: 185, False: 1.18k]
  ------------------
  657|       |    // Require at least the header and an IFD with 1 entry
  658|    185|    if (size < OMSystemMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (658:9): [True: 14, False: 171]
  ------------------
  659|     14|      return nullptr;
  660|    171|    return newOMSystemMn2(tag, group, IfdId::olympus2Id);
  661|    185|  }
  662|  1.77k|  if (size < 10 || std::string(reinterpret_cast<const char*>(pData), 10) != std::string("OLYMPUS\0II", 10)) {
  ------------------
  |  Branch (662:7): [True: 326, False: 1.44k]
  |  Branch (662:7): [True: 954, False: 816]
  |  Branch (662:20): [True: 628, False: 816]
  ------------------
  663|       |    // Require at least the header and an IFD with 1 entry
  664|    954|    if (size < OlympusMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (664:9): [True: 530, False: 424]
  ------------------
  665|    530|      return nullptr;
  666|    424|    return newOlympusMn2(tag, group, IfdId::olympusId);
  667|    954|  }
  668|       |  // Require at least the header and an IFD with 1 entry
  669|    816|  if (size < Olympus2MnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (669:7): [True: 66, False: 750]
  ------------------
  670|     66|    return nullptr;
  671|    750|  return newOlympus2Mn2(tag, group, IfdId::olympus2Id);
  672|    816|}
_ZN5Exiv28Internal13newOlympusMn2EtNS_5IfdIdES1_:
  674|    450|std::unique_ptr<TiffIfdMakernote> newOlympusMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  675|    450|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<OlympusMnHeader>());
  676|    450|}
_ZN5Exiv28Internal14newOlympus2Mn2EtNS_5IfdIdES1_:
  678|    750|std::unique_ptr<TiffIfdMakernote> newOlympus2Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  679|    750|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<Olympus2MnHeader>());
  680|    750|}
_ZN5Exiv28Internal13newOMSystemMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  683|    335|                                                ByteOrder) {
  684|       |  // Require at least the header and an IFD with 1 entry
  685|    335|  if (size < OMSystemMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (685:7): [True: 222, False: 113]
  ------------------
  686|    222|    return nullptr;
  687|    113|  return newOMSystemMn2(tag, group, mnGroup);
  688|    335|}
_ZN5Exiv28Internal14newOMSystemMn2EtNS_5IfdIdES1_:
  690|  4.20k|std::unique_ptr<TiffIfdMakernote> newOMSystemMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  691|  4.20k|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<OMSystemMnHeader>());
  692|  4.20k|}
_ZN5Exiv28Internal9newFujiMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  695|    204|                                            ByteOrder) {
  696|       |  // Require at least the header and an IFD with 1 entry
  697|    204|  if (size < FujiMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (697:7): [True: 68, False: 136]
  ------------------
  698|     68|    return nullptr;
  699|    136|  return newFujiMn2(tag, group, mnGroup);
  700|    204|}
_ZN5Exiv28Internal10newFujiMn2EtNS_5IfdIdES1_:
  702|    167|std::unique_ptr<TiffIfdMakernote> newFujiMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  703|    167|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<FujiMnHeader>());
  704|    167|}
_ZN5Exiv28Internal10newNikonMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  707|  1.59k|                                             ByteOrder) {
  708|       |  // If there is no "Nikon" string it must be Nikon1 format
  709|  1.59k|  if (size < 6 || std::string(reinterpret_cast<const char*>(pData), 6) != std::string("Nikon\0", 6)) {
  ------------------
  |  Branch (709:7): [True: 267, False: 1.32k]
  |  Branch (709:7): [True: 789, False: 804]
  |  Branch (709:19): [True: 522, False: 804]
  ------------------
  710|       |    // Require at least an IFD with 1 entry
  711|    789|    if (size < 18)
  ------------------
  |  Branch (711:9): [True: 312, False: 477]
  ------------------
  712|    312|      return nullptr;
  713|    477|    return newIfdMn2(tag, group, IfdId::nikon1Id);
  714|    789|  }
  715|       |  // If the "Nikon" string is not followed by a TIFF header, we assume
  716|       |  // Nikon2 format
  717|    804|  TiffHeader tiffHeader;
  718|    804|  if (size < 18 || !tiffHeader.read(pData + 10, size - 10) || tiffHeader.tag() != 0x002a) {
  ------------------
  |  Branch (718:7): [True: 45, False: 759]
  |  Branch (718:20): [True: 85, False: 674]
  |  Branch (718:63): [True: 31, False: 643]
  ------------------
  719|       |    // Require at least the header and an IFD with 1 entry
  720|    161|    if (size < Nikon2MnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (720:9): [True: 78, False: 83]
  ------------------
  721|     78|      return nullptr;
  722|     83|    return newNikon2Mn2(tag, group, IfdId::nikon2Id);
  723|    161|  }
  724|       |  // Else we have a Nikon3 makernote
  725|       |  // Require at least the header and an IFD with 1 entry
  726|    643|  if (size < Nikon3MnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (726:7): [True: 64, False: 579]
  ------------------
  727|     64|    return nullptr;
  728|    579|  return newNikon3Mn2(tag, group, IfdId::nikon3Id);
  729|    643|}
_ZN5Exiv28Internal12newNikon2Mn2EtNS_5IfdIdES1_:
  731|    110|std::unique_ptr<TiffIfdMakernote> newNikon2Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  732|    110|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<Nikon2MnHeader>());
  733|    110|}
_ZN5Exiv28Internal12newNikon3Mn2EtNS_5IfdIdES1_:
  735|    905|std::unique_ptr<TiffIfdMakernote> newNikon3Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  736|    905|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<Nikon3MnHeader>());
  737|    905|}
_ZN5Exiv28Internal14newPanasonicMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  740|    603|                                                 ByteOrder) {
  741|       |  // Require at least the header and an IFD with 1 entry, but without a next pointer
  742|    603|  if (size < PanasonicMnHeader::sizeOfSignature() + 14)
  ------------------
  |  Branch (742:7): [True: 329, False: 274]
  ------------------
  743|    329|    return nullptr;
  744|    274|  return newPanasonicMn2(tag, group, mnGroup);
  745|    603|}
_ZN5Exiv28Internal15newPanasonicMn2EtNS_5IfdIdES1_:
  747|    279|std::unique_ptr<TiffIfdMakernote> newPanasonicMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  748|    279|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<PanasonicMnHeader>(), false);
  749|    279|}
_ZN5Exiv28Internal11newPentaxMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  752|    419|                                              ByteOrder) {
  753|    419|  if (size > 8 && std::string(reinterpret_cast<const char*>(pData), 8) == std::string("PENTAX \0", 8)) {
  ------------------
  |  Branch (753:7): [True: 229, False: 190]
  |  Branch (753:7): [True: 66, False: 353]
  |  Branch (753:19): [True: 66, False: 163]
  ------------------
  754|       |    // Require at least the header and an IFD with 1 entry
  755|     66|    if (size < PentaxDngMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (755:9): [True: 22, False: 44]
  ------------------
  756|     22|      return nullptr;
  757|     44|    return newPentaxDngMn2(tag, group, (tag == 0xc634 ? IfdId::pentaxDngId : IfdId::pentaxId));
  ------------------
  |  Branch (757:41): [True: 44, False: 0]
  ------------------
  758|     66|  }
  759|    353|  if (size > 4 && std::string(reinterpret_cast<const char*>(pData), 4) == std::string("AOC\0", 4)) {
  ------------------
  |  Branch (759:7): [True: 184, False: 169]
  |  Branch (759:7): [True: 73, False: 280]
  |  Branch (759:19): [True: 73, False: 111]
  ------------------
  760|       |    // Require at least the header and an IFD with 1 entry
  761|     73|    if (size < PentaxMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (761:9): [True: 24, False: 49]
  ------------------
  762|     24|      return nullptr;
  763|     49|    return newPentaxMn2(tag, group, IfdId::pentaxId);
  764|     73|  }
  765|    280|  return nullptr;
  766|    353|}
_ZN5Exiv28Internal12newPentaxMn2EtNS_5IfdIdES1_:
  768|     99|std::unique_ptr<TiffIfdMakernote> newPentaxMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  769|     99|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<PentaxMnHeader>());
  770|     99|}
_ZN5Exiv28Internal15newPentaxDngMn2EtNS_5IfdIdES1_:
  772|    972|std::unique_ptr<TiffIfdMakernote> newPentaxDngMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  773|    972|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<PentaxDngMnHeader>());
  774|    972|}
_ZN5Exiv28Internal12newSamsungMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  777|    348|                                               ByteOrder) {
  778|    348|  if (size > 4 && std::string(reinterpret_cast<const char*>(pData), 4) == std::string("AOC\0", 4)) {
  ------------------
  |  Branch (778:7): [True: 257, False: 91]
  |  Branch (778:7): [True: 38, False: 310]
  |  Branch (778:19): [True: 38, False: 219]
  ------------------
  779|       |    // Samsung branded Pentax camera:
  780|       |    // Require at least the header and an IFD with 1 entry
  781|     38|    if (size < PentaxMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (781:9): [True: 7, False: 31]
  ------------------
  782|      7|      return nullptr;
  783|     31|    return newPentaxMn2(tag, group, IfdId::pentaxId);
  784|     38|  }
  785|       |  // Genuine Samsung camera:
  786|       |  // Require at least an IFD with 1 entry
  787|    310|  if (size < 18)
  ------------------
  |  Branch (787:7): [True: 149, False: 161]
  ------------------
  788|    149|    return nullptr;
  789|    161|  return newSamsungMn2(tag, group, mnGroup);
  790|    310|}
_ZN5Exiv28Internal13newSamsungMn2EtNS_5IfdIdES1_:
  792|    185|std::unique_ptr<TiffIfdMakernote> newSamsungMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  793|    185|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<SamsungMnHeader>());
  794|    185|}
_ZN5Exiv28Internal10newSigmaMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  797|    586|                                             ByteOrder) {
  798|       |  // Require at least the header and an IFD with 1 entry
  799|    586|  if (size < SigmaMnHeader::sizeOfSignature() + 18)
  ------------------
  |  Branch (799:7): [True: 323, False: 263]
  ------------------
  800|    323|    return nullptr;
  801|    263|  return newSigmaMn2(tag, group, mnGroup);
  802|    586|}
_ZN5Exiv28Internal11newSigmaMn2EtNS_5IfdIdES1_:
  804|    277|std::unique_ptr<TiffIfdMakernote> newSigmaMn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  805|    277|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<SigmaMnHeader>());
  806|    277|}
_ZN5Exiv28Internal9newSonyMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  809|  1.46k|                                            ByteOrder) {
  810|       |  // If there is no "SONY DSC " string we assume it's a simple IFD Makernote
  811|  1.46k|  if (size < 12 || std::string(reinterpret_cast<const char*>(pData), 12) != std::string("SONY DSC \0\0\0", 12)) {
  ------------------
  |  Branch (811:7): [True: 272, False: 1.18k]
  |  Branch (811:7): [True: 977, False: 484]
  |  Branch (811:20): [True: 705, False: 484]
  ------------------
  812|       |    // Require at least an IFD with 1 entry
  813|    977|    if (size < 18)
  ------------------
  |  Branch (813:9): [True: 338, False: 639]
  ------------------
  814|    338|      return nullptr;
  815|    639|    return newSony2Mn2(tag, group, IfdId::sony2Id);
  816|    977|  }
  817|       |  // Require at least the header and an IFD with 1 entry, but without a next pointer
  818|    484|  if (size < SonyMnHeader::sizeOfSignature() + 14)
  ------------------
  |  Branch (818:7): [True: 19, False: 465]
  ------------------
  819|     19|    return nullptr;
  820|    465|  return newSony1Mn2(tag, group, IfdId::sony1Id);
  821|    484|}
_ZN5Exiv28Internal11newSony1Mn2EtNS_5IfdIdES1_:
  823|    597|std::unique_ptr<TiffIfdMakernote> newSony1Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  824|    597|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<SonyMnHeader>(), false);
  825|    597|}
_ZN5Exiv28Internal11newSony2Mn2EtNS_5IfdIdES1_:
  827|    711|std::unique_ptr<TiffIfdMakernote> newSony2Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  828|    711|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, nullptr, true);
  829|    711|}
_ZN5Exiv28Internal10newCasioMnEtNS_5IfdIdES1_PKhmNS_9ByteOrderE:
  832|    349|                                             ByteOrder) {
  833|    349|  if (size > 6 && std::string(reinterpret_cast<const char*>(pData), 6) == std::string("QVC\0\0\0", 6))
  ------------------
  |  Branch (833:7): [True: 139, False: 210]
  |  Branch (833:7): [True: 27, False: 322]
  |  Branch (833:19): [True: 27, False: 112]
  ------------------
  834|     27|    return newCasio2Mn2(tag, group, IfdId::casio2Id);
  835|       |  // Require at least an IFD with 1 entry, but not necessarily a next pointer
  836|    322|  if (size < 14)
  ------------------
  |  Branch (836:7): [True: 247, False: 75]
  ------------------
  837|    247|    return nullptr;
  838|     75|  return newIfdMn2(tag, group, IfdId::casioId);
  839|    322|}
_ZN5Exiv28Internal12newCasio2Mn2EtNS_5IfdIdES1_:
  841|     31|std::unique_ptr<TiffIfdMakernote> newCasio2Mn2(uint16_t tag, IfdId group, IfdId mnGroup) {
  842|     31|  return std::make_unique<TiffIfdMakernote>(tag, group, mnGroup, std::make_unique<Casio2MnHeader>());
  843|     31|}
_ZN5Exiv28Internal13nikonSelectorEtPKhmPNS0_13TiffComponentE:
  910|    565|int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* /*pRoot*/) {
  911|    565|  if (size < 4)
  ------------------
  |  Branch (911:7): [True: 8, False: 557]
  ------------------
  912|      8|    return -1;
  913|       |
  914|    557|  auto ix = NikonArrayIdx::Key{tag, reinterpret_cast<const char*>(pData), size};
  915|    557|  if (auto it = Exiv2::find(nikonArrayIdx, ix))
  ------------------
  |  Branch (915:12): [True: 373, False: 184]
  ------------------
  916|    373|    return it->idx_;
  917|    184|  return -1;
  918|    557|}
_ZN5Exiv28Internal10nikonCryptEtPKhmPNS0_13TiffComponentE:
  920|    398|DataBuf nikonCrypt(uint16_t tag, const byte* pData, size_t size, TiffComponent* pRoot) {
  921|    398|  DataBuf buf;
  922|       |
  923|    398|  if (size < 4)
  ------------------
  |  Branch (923:7): [True: 0, False: 398]
  ------------------
  924|      0|    return buf;
  925|    398|  auto nci = Exiv2::find(nikonArrayIdx, NikonArrayIdx::Key{tag, reinterpret_cast<const char*>(pData), size});
  926|    398|  if (!nci || nci->start_ == NA || size <= nci->start_)
  ------------------
  |  |  865|    796|#define NA std::numeric_limits<uint32_t>::max()
  ------------------
  |  Branch (926:7): [True: 0, False: 398]
  |  Branch (926:15): [True: 16, False: 382]
  |  Branch (926:36): [True: 59, False: 323]
  ------------------
  927|     75|    return buf;
  928|       |
  929|       |  // Find Exif.Nikon3.ShutterCount
  930|    323|  TiffFinder finder(0x00a7, IfdId::nikon3Id);
  931|    323|  pRoot->accept(finder);
  932|    323|  auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
  933|    323|  if (!te || !te->pValue() || te->pValue()->count() == 0)
  ------------------
  |  Branch (933:7): [True: 71, False: 252]
  |  Branch (933:14): [True: 10, False: 242]
  |  Branch (933:31): [True: 13, False: 229]
  ------------------
  934|     94|    return buf;
  935|    229|  auto count = te->pValue()->toUint32();
  936|       |
  937|       |  // Find Exif.Nikon3.SerialNumber
  938|    229|  finder.init(0x001d, IfdId::nikon3Id);
  939|    229|  pRoot->accept(finder);
  940|    229|  te = dynamic_cast<const TiffEntryBase*>(finder.result());
  941|    229|  if (!te || !te->pValue() || te->pValue()->count() == 0)
  ------------------
  |  Branch (941:7): [True: 26, False: 203]
  |  Branch (941:14): [True: 4, False: 199]
  |  Branch (941:31): [True: 53, False: 146]
  ------------------
  942|     83|    return buf;
  943|    146|  bool ok(false);
  944|    146|  auto serial = stringTo<uint32_t>(te->pValue()->toString(), ok);
  945|    146|  if (!ok) {
  ------------------
  |  Branch (945:7): [True: 102, False: 44]
  ------------------
  946|    102|    std::string model = getExifModel(pRoot);
  947|    102|    if (model.empty())
  ------------------
  |  Branch (947:9): [True: 63, False: 39]
  ------------------
  948|     63|      return buf;
  949|     39|    if (Internal::contains(model, "D50")) {
  ------------------
  |  Branch (949:9): [True: 4, False: 35]
  ------------------
  950|      4|      serial = 0x22;
  951|     35|    } else {
  952|     35|      serial = 0x60;
  953|     35|    }
  954|     39|  }
  955|     83|  buf.alloc(size);
  956|     83|  std::copy_n(pData, buf.size(), buf.begin());
  957|     83|  ncrypt(buf.data(nci->start_), static_cast<uint32_t>(buf.size()) - nci->start_, count, serial);
  958|     83|  return buf;
  959|    146|}
_ZN5Exiv28Internal14sonyCsSelectorEtPKhmPNS0_13TiffComponentE:
  961|    204|int sonyCsSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
  962|    204|  std::string model = getExifModel(pRoot);
  963|    204|  if (model.empty())
  ------------------
  |  Branch (963:7): [True: 111, False: 93]
  ------------------
  964|    111|    return -1;
  965|     93|  int idx = 0;
  966|     93|  if (Internal::contains(model, "DSLR-A330") || Internal::contains(model, "DSLR-A380")) {
  ------------------
  |  Branch (966:7): [True: 8, False: 85]
  |  Branch (966:49): [True: 12, False: 73]
  ------------------
  967|     20|    idx = 1;
  968|     20|  }
  969|     93|  return idx;
  970|    204|}
_ZN5Exiv28Internal17sony2010eSelectorEtPKhmPNS0_13TiffComponentE:
  971|     98|int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
  972|     98|  static constexpr const char* models[] = {
  973|     98|      "SLT-A58",   "SLT-A99",  "ILCE-3000", "ILCE-3500", "NEX-3N",    "NEX-5R",   "NEX-5T",
  974|     98|      "NEX-6",     "VG30E",    "VG900",     "DSC-RX100", "DSC-RX1",   "DSC-RX1R", "DSC-HX300",
  975|     98|      "DSC-HX50V", "DSC-TX30", "DSC-WX60",  "DSC-WX200", "DSC-WX300",
  976|     98|  };
  977|     98|  return Exiv2::find(models, getExifModel(pRoot)) ? 0 : -1;
  ------------------
  |  Branch (977:10): [True: 0, False: 98]
  ------------------
  978|     98|}
_ZN5Exiv28Internal15sony2FpSelectorEtPKhmPNS0_13TiffComponentE:
  980|    298|int sony2FpSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
  981|       |  // Not valid for models beginning
  982|    298|  std::string model = getExifModel(pRoot);
  983|    298|  for (auto str : {"SLT-", "HV", "ILCA-"})
  ------------------
  |  Branch (983:17): [True: 877, False: 281]
  ------------------
  984|    877|    if (model.starts_with(str))
  ------------------
  |  Branch (984:9): [True: 17, False: 860]
  ------------------
  985|     17|      return -1;
  986|    281|  return 0;
  987|    298|}
_ZN5Exiv28Internal18sonyMisc2bSelectorEtPKhmPNS0_13TiffComponentE:
  989|     83|int sonyMisc2bSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
  990|       |  // From Exiftool: https://github.com/exiftool/exiftool/blob/master/lib/Image/ExifTool/Sony.pm
  991|       |  // >  First byte must be 9 or 12 or 13 or 15 or 16 and 4th byte must be 2 (deciphered)
  992|       |
  993|       |  // Get the value from the image format that is being used
  994|     83|  auto value = getExifValue(pRoot, 0x9404, Exiv2::IfdId::sony1Id);
  995|     83|  if (!value) {
  ------------------
  |  Branch (995:7): [True: 32, False: 51]
  ------------------
  996|     32|    value = getExifValue(pRoot, 0x9404, Exiv2::IfdId::sony2Id);
  997|     32|    if (!value)
  ------------------
  |  Branch (997:9): [True: 0, False: 32]
  ------------------
  998|      0|      return -1;
  999|     32|  }
 1000|       |
 1001|     83|  if (value->count() < 4)
  ------------------
  |  Branch (1001:7): [True: 29, False: 54]
  ------------------
 1002|     29|    return -1;
 1003|       |
 1004|     54|  switch (value->toInt64(0)) {                 // Using encrypted values
 1005|     11|    case 231:                                  // 231 == 9
  ------------------
  |  Branch (1005:5): [True: 11, False: 43]
  ------------------
 1006|     18|    case 234:                                  // 234 == 12
  ------------------
  |  Branch (1006:5): [True: 7, False: 47]
  ------------------
 1007|     24|    case 205:                                  // 205 == 13
  ------------------
  |  Branch (1007:5): [True: 6, False: 48]
  ------------------
 1008|     30|    case 138:                                  // 138 == 15
  ------------------
  |  Branch (1008:5): [True: 6, False: 48]
  ------------------
 1009|     33|    case 112:                                  // 112 == 16
  ------------------
  |  Branch (1009:5): [True: 3, False: 51]
  ------------------
 1010|     33|      return value->toInt64(3) == 8 ? 0 : -1;  // 8   == 2
  ------------------
  |  Branch (1010:14): [True: 12, False: 21]
  ------------------
 1011|     21|    default:
  ------------------
  |  Branch (1011:5): [True: 21, False: 33]
  ------------------
 1012|     21|      break;
 1013|     54|  }
 1014|     21|  return -1;
 1015|     54|}
_ZN5Exiv28Internal18sonyMisc3cSelectorEtPKhmPNS0_13TiffComponentE:
 1016|    279|int sonyMisc3cSelector(uint16_t /*tag*/, const byte* /*pData*/, size_t /*size*/, TiffComponent* pRoot) {
 1017|       |  // For condition, see Exiftool (Tag 9400c):
 1018|       |  // https://github.com/exiftool/exiftool/blob/2200871d9cef988051d2a99d67df3bda6cbb30a8/lib/Image/ExifTool/Sony.pm#L1826
 1019|       |
 1020|       |  // Get the value from the image format that is being used
 1021|    279|  auto value = getExifValue(pRoot, 0x9400, Exiv2::IfdId::sony1Id);
 1022|    279|  if (!value) {
  ------------------
  |  Branch (1022:7): [True: 57, False: 222]
  ------------------
 1023|     57|    value = getExifValue(pRoot, 0x9400, Exiv2::IfdId::sony2Id);
 1024|     57|    if (!value)
  ------------------
  |  Branch (1024:9): [True: 0, False: 57]
  ------------------
 1025|      0|      return -1;
 1026|     57|  }
 1027|       |
 1028|    279|  if (value->count() < 1)
  ------------------
  |  Branch (1028:7): [True: 3, False: 276]
  ------------------
 1029|      3|    return -1;
 1030|       |
 1031|    276|  switch (value->toInt64()) {
 1032|     22|    case 35:  // 0x23 for DSC-RX10/HX60V/HX350/HX400V/WX220/WX350, ILCE-7/7R/5000/6000, ILCA-68/77M2
  ------------------
  |  Branch (1032:5): [True: 22, False: 254]
  ------------------
 1033|     58|    case 36:  // 0x24 for ILCA-99M2,ILCE-5100/6300/6500/7M2/7RM2/7S/7SM2/QX1,
  ------------------
  |  Branch (1033:5): [True: 36, False: 240]
  ------------------
 1034|       |              // DSC-HX80/HX90V/QX30/RX0/RX100M3/RX100M4/RX100M5/RX10M2/RX10M3/RX1RM2/WX500
 1035|     76|    case 38:  // 0x26 for ILCE-6100/6400/6600/7M3/7RM3/9, DSC-RX0M2/RX10M4/RX100M5A/RX100M6/HX95/HX99
  ------------------
  |  Branch (1035:5): [True: 18, False: 258]
  ------------------
 1036|     91|    case 40:  // 0x28 for ILCE-7RM4/9M2, DSC-RX100M7, ZV-1/1F/1M2/E10
  ------------------
  |  Branch (1036:5): [True: 15, False: 261]
  ------------------
 1037|    111|    case 49:  // 0x31 for ILCE-1/7M4/7SM3, ILME-FX3
  ------------------
  |  Branch (1037:5): [True: 20, False: 256]
  ------------------
 1038|    117|    case 50:  // 0x32 for ILCE-7RM5, ILME-FX30
  ------------------
  |  Branch (1038:5): [True: 6, False: 270]
  ------------------
 1039|    141|    case 51:  // 0x33 for ILCE-6700/7CM2/7CR/9M3, ZV-E1
  ------------------
  |  Branch (1039:5): [True: 24, False: 252]
  ------------------
 1040|    159|    case 52:  // 0x34 for DSC-RX10M5
  ------------------
  |  Branch (1040:5): [True: 18, False: 258]
  ------------------
 1041|    173|    case 65:  // 0x41 for ILCE-7M5
  ------------------
  |  Branch (1041:5): [True: 14, False: 262]
  ------------------
 1042|    216|    case 67:  // 0x43 for ILCE-7RM6
  ------------------
  |  Branch (1042:5): [True: 43, False: 233]
  ------------------
 1043|    216|      return 0;
 1044|     60|    default:
  ------------------
  |  Branch (1044:5): [True: 60, False: 216]
  ------------------
 1045|     60|      break;
 1046|    276|  }
 1047|     60|  return -1;
 1048|    276|}
makernote_int.cpp:_ZN12_GLOBAL__N_112getExifValueEPN5Exiv28Internal13TiffComponentEtNS0_5IfdIdE:
 1054|  1.15k|const Exiv2::Value* getExifValue(Exiv2::Internal::TiffComponent* pRoot, uint16_t tag, Exiv2::IfdId group) {
 1055|  1.15k|  Exiv2::Internal::TiffFinder finder(tag, group);
 1056|  1.15k|  if (!pRoot)
  ------------------
  |  Branch (1056:7): [True: 0, False: 1.15k]
  ------------------
 1057|      0|    return nullptr;
 1058|  1.15k|  pRoot->accept(finder);
 1059|  1.15k|  auto te = dynamic_cast<const Exiv2::Internal::TiffEntryBase*>(finder.result());
 1060|  1.15k|  return (!te || !te->pValue()) ? nullptr : te->pValue();
  ------------------
  |  Branch (1060:11): [True: 320, False: 833]
  |  Branch (1060:18): [True: 98, False: 735]
  ------------------
 1061|  1.15k|}
makernote_int.cpp:_ZN12_GLOBAL__N_112getExifModelEPN5Exiv28Internal13TiffComponentE:
 1063|    702|std::string getExifModel(Exiv2::Internal::TiffComponent* pRoot) {
 1064|       |  // Lookup the Exif.Image.Model tag
 1065|    702|  const auto value = getExifValue(pRoot, 0x0110, Exiv2::IfdId::ifd0Id);
 1066|    702|  return (!value || value->count() == 0) ? std::string() : value->toString();
  ------------------
  |  Branch (1066:11): [True: 329, False: 373]
  |  Branch (1066:21): [True: 102, False: 271]
  ------------------
 1067|    702|}
makernote_int.cpp:_ZN12_GLOBAL__N_16ncryptEPhjjj:
 1069|     83|void ncrypt(Exiv2::byte* pData, uint32_t size, uint32_t count, uint32_t serial) {
 1070|     83|  static const Exiv2::byte xlat[2][256] = {
 1071|     83|      {0xc1, 0xbf, 0x6d, 0x0d, 0x59, 0xc5, 0x13, 0x9d, 0x83, 0x61, 0x6b, 0x4f, 0xc7, 0x7f, 0x3d, 0x3d, 0x53, 0x59, 0xe3,
 1072|     83|       0xc7, 0xe9, 0x2f, 0x95, 0xa7, 0x95, 0x1f, 0xdf, 0x7f, 0x2b, 0x29, 0xc7, 0x0d, 0xdf, 0x07, 0xef, 0x71, 0x89, 0x3d,
 1073|     83|       0x13, 0x3d, 0x3b, 0x13, 0xfb, 0x0d, 0x89, 0xc1, 0x65, 0x1f, 0xb3, 0x0d, 0x6b, 0x29, 0xe3, 0xfb, 0xef, 0xa3, 0x6b,
 1074|     83|       0x47, 0x7f, 0x95, 0x35, 0xa7, 0x47, 0x4f, 0xc7, 0xf1, 0x59, 0x95, 0x35, 0x11, 0x29, 0x61, 0xf1, 0x3d, 0xb3, 0x2b,
 1075|     83|       0x0d, 0x43, 0x89, 0xc1, 0x9d, 0x9d, 0x89, 0x65, 0xf1, 0xe9, 0xdf, 0xbf, 0x3d, 0x7f, 0x53, 0x97, 0xe5, 0xe9, 0x95,
 1076|     83|       0x17, 0x1d, 0x3d, 0x8b, 0xfb, 0xc7, 0xe3, 0x67, 0xa7, 0x07, 0xf1, 0x71, 0xa7, 0x53, 0xb5, 0x29, 0x89, 0xe5, 0x2b,
 1077|     83|       0xa7, 0x17, 0x29, 0xe9, 0x4f, 0xc5, 0x65, 0x6d, 0x6b, 0xef, 0x0d, 0x89, 0x49, 0x2f, 0xb3, 0x43, 0x53, 0x65, 0x1d,
 1078|     83|       0x49, 0xa3, 0x13, 0x89, 0x59, 0xef, 0x6b, 0xef, 0x65, 0x1d, 0x0b, 0x59, 0x13, 0xe3, 0x4f, 0x9d, 0xb3, 0x29, 0x43,
 1079|     83|       0x2b, 0x07, 0x1d, 0x95, 0x59, 0x59, 0x47, 0xfb, 0xe5, 0xe9, 0x61, 0x47, 0x2f, 0x35, 0x7f, 0x17, 0x7f, 0xef, 0x7f,
 1080|     83|       0x95, 0x95, 0x71, 0xd3, 0xa3, 0x0b, 0x71, 0xa3, 0xad, 0x0b, 0x3b, 0xb5, 0xfb, 0xa3, 0xbf, 0x4f, 0x83, 0x1d, 0xad,
 1081|     83|       0xe9, 0x2f, 0x71, 0x65, 0xa3, 0xe5, 0x07, 0x35, 0x3d, 0x0d, 0xb5, 0xe9, 0xe5, 0x47, 0x3b, 0x9d, 0xef, 0x35, 0xa3,
 1082|     83|       0xbf, 0xb3, 0xdf, 0x53, 0xd3, 0x97, 0x53, 0x49, 0x71, 0x07, 0x35, 0x61, 0x71, 0x2f, 0x43, 0x2f, 0x11, 0xdf, 0x17,
 1083|     83|       0x97, 0xfb, 0x95, 0x3b, 0x7f, 0x6b, 0xd3, 0x25, 0xbf, 0xad, 0xc7, 0xc5, 0xc5, 0xb5, 0x8b, 0xef, 0x2f, 0xd3, 0x07,
 1084|     83|       0x6b, 0x25, 0x49, 0x95, 0x25, 0x49, 0x6d, 0x71, 0xc7},
 1085|     83|      {0xa7, 0xbc, 0xc9, 0xad, 0x91, 0xdf, 0x85, 0xe5, 0xd4, 0x78, 0xd5, 0x17, 0x46, 0x7c, 0x29, 0x4c, 0x4d, 0x03, 0xe9,
 1086|     83|       0x25, 0x68, 0x11, 0x86, 0xb3, 0xbd, 0xf7, 0x6f, 0x61, 0x22, 0xa2, 0x26, 0x34, 0x2a, 0xbe, 0x1e, 0x46, 0x14, 0x68,
 1087|     83|       0x9d, 0x44, 0x18, 0xc2, 0x40, 0xf4, 0x7e, 0x5f, 0x1b, 0xad, 0x0b, 0x94, 0xb6, 0x67, 0xb4, 0x0b, 0xe1, 0xea, 0x95,
 1088|     83|       0x9c, 0x66, 0xdc, 0xe7, 0x5d, 0x6c, 0x05, 0xda, 0xd5, 0xdf, 0x7a, 0xef, 0xf6, 0xdb, 0x1f, 0x82, 0x4c, 0xc0, 0x68,
 1089|     83|       0x47, 0xa1, 0xbd, 0xee, 0x39, 0x50, 0x56, 0x4a, 0xdd, 0xdf, 0xa5, 0xf8, 0xc6, 0xda, 0xca, 0x90, 0xca, 0x01, 0x42,
 1090|     83|       0x9d, 0x8b, 0x0c, 0x73, 0x43, 0x75, 0x05, 0x94, 0xde, 0x24, 0xb3, 0x80, 0x34, 0xe5, 0x2c, 0xdc, 0x9b, 0x3f, 0xca,
 1091|     83|       0x33, 0x45, 0xd0, 0xdb, 0x5f, 0xf5, 0x52, 0xc3, 0x21, 0xda, 0xe2, 0x22, 0x72, 0x6b, 0x3e, 0xd0, 0x5b, 0xa8, 0x87,
 1092|     83|       0x8c, 0x06, 0x5d, 0x0f, 0xdd, 0x09, 0x19, 0x93, 0xd0, 0xb9, 0xfc, 0x8b, 0x0f, 0x84, 0x60, 0x33, 0x1c, 0x9b, 0x45,
 1093|     83|       0xf1, 0xf0, 0xa3, 0x94, 0x3a, 0x12, 0x77, 0x33, 0x4d, 0x44, 0x78, 0x28, 0x3c, 0x9e, 0xfd, 0x65, 0x57, 0x16, 0x94,
 1094|     83|       0x6b, 0xfb, 0x59, 0xd0, 0xc8, 0x22, 0x36, 0xdb, 0xd2, 0x63, 0x98, 0x43, 0xa1, 0x04, 0x87, 0x86, 0xf7, 0xa6, 0x26,
 1095|     83|       0xbb, 0xd6, 0x59, 0x4d, 0xbf, 0x6a, 0x2e, 0xaa, 0x2b, 0xef, 0xe6, 0x78, 0xb6, 0x4e, 0xe0, 0x2f, 0xdc, 0x7c, 0xbe,
 1096|     83|       0x57, 0x19, 0x32, 0x7e, 0x2a, 0xd0, 0xb8, 0xba, 0x29, 0x00, 0x3c, 0x52, 0x7d, 0xa8, 0x49, 0x3b, 0x2d, 0xeb, 0x25,
 1097|     83|       0x49, 0xfa, 0xa3, 0xaa, 0x39, 0xa7, 0xc5, 0xa7, 0x50, 0x11, 0x36, 0xfb, 0xc6, 0x67, 0x4a, 0xf5, 0xa5, 0x12, 0x65,
 1098|     83|       0x7e, 0xb0, 0xdf, 0xaf, 0x4e, 0xb3, 0x61, 0x7f, 0x2f},
 1099|     83|  };
 1100|     83|  Exiv2::byte key = 0;
 1101|    415|  for (int i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1101:19): [True: 332, False: 83]
  ------------------
 1102|    332|    key ^= static_cast<Exiv2::byte>(count >> (i * 8));
 1103|    332|  }
 1104|     83|  Exiv2::byte ci = xlat[0][serial & 0xff];
 1105|     83|  Exiv2::byte cj = xlat[1][key];
 1106|     83|  Exiv2::byte ck = 0x60;
 1107|  26.4k|  for (uint32_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (1107:24): [True: 26.3k, False: 83]
  ------------------
 1108|  26.3k|    cj += ci * ck++;
 1109|  26.3k|    pData[i] ^= cj;
 1110|  26.3k|  }
 1111|     83|}
_ZNK5Exiv28Internal13NikonArrayIdxeqERKNS1_3KeyE:
  854|  15.8k|  bool operator==(const Key& key) const {
  855|  15.8k|    return key.tag_ == tag_ && 0 == strncmp(key.ver_, ver_, strlen(ver_)) && (size_ == 0 || key.size_ == size_);
  ------------------
  |  Branch (855:12): [True: 4.75k, False: 11.0k]
  |  Branch (855:32): [True: 807, False: 3.94k]
  |  Branch (855:79): [True: 771, False: 36]
  |  Branch (855:93): [True: 0, False: 36]
  ------------------
  856|  15.8k|  }

_ZN5Exiv28Internal8MnHeaderC2Ev:
   99|  9.02k|  MnHeader() = default;
_ZN5Exiv28Internal8MnHeaderD2Ev:
  101|  9.02k|  virtual ~MnHeader() = default;

_ZN5Exiv213MatroskaVideoC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  600|  2.10k|    Image(ImageType::mkv, mdNone, std::move(io), params) {
  601|  2.10k|}  // MatroskaVideo::MatroskaVideo
_ZNK5Exiv213MatroskaVideo8mimeTypeEv:
  603|  2.10k|std::string MatroskaVideo::mimeType() const {
  604|  2.10k|  return "video/matroska";
  605|  2.10k|}
_ZN5Exiv213MatroskaVideo13writeMetadataEv:
  607|  1.22k|void MatroskaVideo::writeMetadata() {
  608|  1.22k|}
_ZN5Exiv213MatroskaVideo12readMetadataEv:
  610|  2.10k|void MatroskaVideo::readMetadata() {
  611|  2.10k|  if (io_->open() != 0)
  ------------------
  |  Branch (611:7): [True: 0, False: 2.10k]
  ------------------
  612|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  613|       |
  614|       |  // Ensure that this is the correct image type
  615|  2.10k|  if (!isMkvType(*io_, false)) {
  ------------------
  |  Branch (615:7): [True: 0, False: 2.10k]
  ------------------
  616|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (616:9): [True: 0, False: 0]
  |  Branch (616:25): [True: 0, False: 0]
  ------------------
  617|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  618|      0|    throw Error(ErrorCode::kerNotAnImage, "Matroska");
  619|      0|  }
  620|       |
  621|  2.10k|  IoCloser closer(*io_);
  622|  2.10k|  clearMetadata();
  623|  2.10k|  continueTraversing_ = true;
  624|  2.10k|  height_ = width_ = 1;
  625|       |
  626|  2.10k|  xmpData_["Xmp.video.FileSize"] = io_->size() / bytesMB;
  627|  2.10k|  xmpData_["Xmp.video.MimeType"] = mimeType();
  628|       |
  629|  63.3k|  while (continueTraversing_)
  ------------------
  |  Branch (629:10): [True: 61.2k, False: 2.10k]
  ------------------
  630|  61.2k|    decodeBlock();
  631|       |
  632|  2.10k|  xmpData_["Xmp.video.AspectRatio"] = getAspectRatio(width_, height_);
  633|  2.10k|}
_ZN5Exiv213MatroskaVideo11decodeBlockEv:
  635|  61.2k|void MatroskaVideo::decodeBlock() {
  636|  61.2k|  byte buf[8];
  637|  61.2k|  io_->read(buf, 1);
  638|       |
  639|  61.2k|  if (io_->eof()) {
  ------------------
  |  Branch (639:7): [True: 276, False: 60.9k]
  ------------------
  640|    276|    continueTraversing_ = false;
  641|    276|    return;
  642|    276|  }
  643|       |
  644|  60.9k|  uint32_t block_size = findBlockSize(buf[0]);  // 0-8
  645|  60.9k|  if (block_size > 0)
  ------------------
  |  Branch (645:7): [True: 60.6k, False: 303]
  ------------------
  646|  60.6k|    io_->readOrThrow(buf + 1, block_size - 1, ErrorCode::kerCorruptedMetadata);
  647|       |
  648|  60.9k|  auto tag_id = returnTagValue(buf, block_size);
  649|  60.9k|  const MatroskaTag* tag = Exiv2::find(matroskaTags, tag_id);
  650|       |
  651|  60.9k|  if (!tag) {
  ------------------
  |  Branch (651:7): [True: 1.05k, False: 59.8k]
  ------------------
  652|  1.05k|    continueTraversing_ = false;
  653|  1.05k|    return;
  654|  1.05k|  }
  655|       |
  656|       |  // tag->dump(std::cout);
  657|       |
  658|  59.8k|  if (tag->_id == Cues || tag->_id == Cluster) {
  ------------------
  |  Branch (658:7): [True: 354, False: 59.5k]
  |  Branch (658:27): [True: 1, False: 59.5k]
  ------------------
  659|      2|    continueTraversing_ = false;
  660|      2|    return;
  661|      2|  }
  662|       |
  663|  59.8k|  io_->readOrThrow(buf, 1, ErrorCode::kerCorruptedMetadata);
  664|  59.8k|  block_size = findBlockSize(buf[0]);  // 0-8
  665|       |
  666|  59.8k|  if (block_size > 0)
  ------------------
  |  Branch (666:7): [True: 59.4k, False: 428]
  ------------------
  667|  59.4k|    io_->readOrThrow(buf + 1, block_size - 1, ErrorCode::kerCorruptedMetadata);
  668|  59.8k|  size_t size = returnTagValue(buf, block_size);
  669|       |
  670|  59.8k|  if (tag->isComposite() && !tag->isSkipped())
  ------------------
  |  Branch (670:7): [True: 30.4k, False: 29.4k]
  |  Branch (670:29): [True: 30.4k, False: 0]
  ------------------
  671|  30.4k|    return;
  672|       |
  673|  29.4k|  const size_t bufMaxSize = 200;
  674|       |
  675|  29.4k|#ifndef SUPPRESS_WARNINGS
  676|  29.4k|  if (!tag->isSkipped() && size > bufMaxSize) {
  ------------------
  |  Branch (676:7): [True: 27.6k, False: 1.83k]
  |  Branch (676:28): [True: 100, False: 27.5k]
  ------------------
  677|    100|    EXV_WARNING << "Size " << size << " of Matroska tag 0x" << std::hex << tag->_id << std::dec << " is greater than "
  ------------------
  |  |  138|    100|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 100]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    100|  LogMsg(LogMsg::warn).os()
  ------------------
  678|      0|                << bufMaxSize << ": ignoring it.\n";
  679|    100|  }
  680|  29.4k|#endif
  681|  29.4k|  if (tag->isSkipped() || size > bufMaxSize) {
  ------------------
  |  Branch (681:7): [True: 1.83k, False: 27.6k]
  |  Branch (681:27): [True: 100, False: 27.5k]
  ------------------
  682|  1.49k|    io_->seek(size, BasicIo::cur);
  683|  1.49k|    return;
  684|  1.49k|  }
  685|       |
  686|  27.9k|  DataBuf buf2(bufMaxSize + 1);
  687|  27.9k|  io_->readOrThrow(buf2.data(), size, ErrorCode::kerCorruptedMetadata);
  688|  27.9k|  switch (tag->_type) {
  689|  7.81k|    case InternalField:
  ------------------
  |  Branch (689:5): [True: 7.81k, False: 20.1k]
  ------------------
  690|  7.81k|      decodeInternalTags(tag, buf2.data());
  691|  7.81k|      break;
  692|  2.61k|    case String:
  ------------------
  |  Branch (692:5): [True: 2.61k, False: 25.3k]
  ------------------
  693|  2.61k|    case Utf8:
  ------------------
  |  Branch (693:5): [True: 0, False: 27.9k]
  ------------------
  694|  2.61k|      decodeStringTags(tag, buf2.data());
  695|  2.61k|      break;
  696|  3.08k|    case Integer:
  ------------------
  |  Branch (696:5): [True: 3.08k, False: 24.8k]
  ------------------
  697|  6.90k|    case UInteger:
  ------------------
  |  Branch (697:5): [True: 3.82k, False: 24.1k]
  ------------------
  698|  6.90k|      decodeIntegerTags(tag, buf2.data());
  699|  6.90k|      break;
  700|  6.76k|    case Boolean:
  ------------------
  |  Branch (700:5): [True: 6.76k, False: 21.1k]
  ------------------
  701|  6.76k|      decodeBooleanTags(tag, buf2.data());
  702|  6.76k|      break;
  703|  2.10k|    case Date:
  ------------------
  |  Branch (703:5): [True: 2.10k, False: 25.8k]
  ------------------
  704|  2.10k|      decodeDateTags(tag, buf2.data(), size);
  705|  2.10k|      break;
  706|  1.19k|    case Float:
  ------------------
  |  Branch (706:5): [True: 1.19k, False: 26.7k]
  ------------------
  707|  1.19k|      decodeFloatTags(tag, buf2.data());
  708|  1.19k|      break;
  709|      0|    case Binary:
  ------------------
  |  Branch (709:5): [True: 0, False: 27.9k]
  ------------------
  710|      0|      break;
  711|      0|    case Master:
  ------------------
  |  Branch (711:5): [True: 0, False: 27.9k]
  ------------------
  712|      0|      break;
  713|      0|    default:
  ------------------
  |  Branch (713:5): [True: 0, False: 27.9k]
  ------------------
  714|      0|      break;
  715|  27.9k|  }
  716|  27.9k|}  // MatroskaVideo::decodeBlock
_ZN5Exiv213MatroskaVideo18decodeInternalTagsEPKNS_8Internal11MatroskaTagEPKh:
  718|  7.81k|void MatroskaVideo::decodeInternalTags(const MatroskaTag* tag, const byte* buf) {
  719|  7.81k|  uint64_t key = getULongLong(buf, bigEndian);
  720|  7.81k|  if (!key)
  ------------------
  |  Branch (720:7): [True: 156, False: 7.65k]
  ------------------
  721|    156|    return;
  722|       |
  723|  7.65k|  auto internalMt = [=]() -> const MatroskaTag* {
  724|  7.65k|    switch (tag->_id) {
  725|  7.65k|      case Xmp_video_VideoScanTpye:
  726|  7.65k|        return Exiv2::find(videoScanType, key);
  727|  7.65k|      case Xmp_audio_ChannelType:
  728|  7.65k|        return Exiv2::find(audioChannels, key);
  729|  7.65k|      case Xmp_video_ContentCompressAlgo:
  730|  7.65k|        return Exiv2::find(compressionAlgorithm, key);
  731|  7.65k|      case Xmp_video_ContentEncryptAlgo:
  732|  7.65k|        return Exiv2::find(encryptionAlgorithm, key);
  733|  7.65k|      case Xmp_video_ContentSignAlgo_1:
  734|  7.65k|      case Xmp_video_ContentSignAlgo_2:
  735|  7.65k|        return Exiv2::find(contentSignatureAlgorithm, key);
  736|  7.65k|      case Xmp_video_ContentSignHashAlgo_1:
  737|  7.65k|      case Xmp_video_ContentSignHashAlgo_2:
  738|  7.65k|        return Exiv2::find(contentSignatureHashAlgorithm, key);
  739|  7.65k|      case Xmp_video_ContentEncodingType:
  740|  7.65k|        return Exiv2::find(encodingType, key);
  741|  7.65k|      case Xmp_video_DisplayUnit:
  742|  7.65k|        return Exiv2::find(displayUnit, key);
  743|  7.65k|      case Xmp_video_AspectRatioType:
  744|  7.65k|        return Exiv2::find(aspectRatioType, key);
  745|  7.65k|      case Xmp_video_PhysicalEquivalent:
  746|  7.65k|        return Exiv2::find(chapterPhysicalEquivalent, key);
  747|  7.65k|      case Xmp_video_TranslateCodec:
  748|  7.65k|        return Exiv2::find(chapterTranslateCodec, key);
  749|  7.65k|      case Video_Audio_CodecID:
  750|  7.65k|        return Exiv2::find(trackCodec, key);
  751|  7.65k|      case Video_Audio_CodecName:
  752|  7.65k|        return Exiv2::find(codecInfo, key);
  753|  7.65k|      case CodecDownloadURL:
  754|  7.65k|      case CodecInfoURL:
  755|  7.65k|        return Exiv2::find(codecDownloadUrl, key);
  756|  7.65k|    }
  757|  7.65k|    return nullptr;
  758|  7.65k|  }();
  759|  7.65k|  if (internalMt) {
  ------------------
  |  Branch (759:7): [True: 2.46k, False: 5.19k]
  ------------------
  760|  2.46k|    xmpData_[tag->_label] = internalMt->_label;
  761|  5.19k|  } else {
  762|  5.19k|    xmpData_[tag->_label] = key;
  763|  5.19k|  }
  764|  7.65k|}
_ZN5Exiv213MatroskaVideo16decodeStringTagsEPKNS_8Internal11MatroskaTagEPKh:
  766|  2.61k|void MatroskaVideo::decodeStringTags(const MatroskaTag* tag, const byte* buf) {
  767|  2.61k|  if (tag->_id == TrackNumber) {
  ------------------
  |  Branch (767:7): [True: 1.28k, False: 1.33k]
  ------------------
  768|  1.28k|    track_count_++;
  769|  1.28k|    xmpData_[tag->_label] = track_count_;
  770|  1.33k|  } else {
  771|  1.33k|    xmpData_[tag->_label] = buf;
  772|  1.33k|  }
  773|  2.61k|}
_ZN5Exiv213MatroskaVideo17decodeIntegerTagsEPKNS_8Internal11MatroskaTagEPKh:
  775|  6.90k|void MatroskaVideo::decodeIntegerTags(const MatroskaTag* tag, const byte* buf) {
  776|  6.90k|  uint64_t value = getULongLong(buf, bigEndian);
  777|  6.90k|  if (!value)
  ------------------
  |  Branch (777:7): [True: 4.28k, False: 2.62k]
  ------------------
  778|  4.28k|    return;
  779|       |
  780|  2.62k|  if (tag->_id == Xmp_video_Width_1 || tag->_id == Xmp_video_Width_2)
  ------------------
  |  Branch (780:7): [True: 1.70k, False: 922]
  |  Branch (780:40): [True: 366, False: 556]
  ------------------
  781|  2.06k|    width_ = value;
  782|  2.62k|  if (tag->_id == Xmp_video_Height_1 || tag->_id == Xmp_video_Height_2)
  ------------------
  |  Branch (782:7): [True: 301, False: 2.32k]
  |  Branch (782:41): [True: 246, False: 2.07k]
  ------------------
  783|    547|    height_ = value;
  784|  2.62k|  xmpData_[tag->_label] = value;
  785|  2.62k|}
_ZN5Exiv213MatroskaVideo17decodeBooleanTagsEPKNS_8Internal11MatroskaTagEPKh:
  787|  6.76k|void MatroskaVideo::decodeBooleanTags(const MatroskaTag* tag, const byte* buf) {
  788|  6.76k|  const MatroskaTag* internalMt = nullptr;
  789|  6.76k|  uint64_t key = getULongLong(buf, bigEndian);
  790|  6.76k|  if (!key)
  ------------------
  |  Branch (790:7): [True: 1.30k, False: 5.46k]
  ------------------
  791|  1.30k|    return;
  792|       |
  793|  5.46k|  switch (tag->_id) {
  794|  2.61k|    case TrackType:  // this tags is used internally only to deduce the type of track (video or audio)
  ------------------
  |  Branch (794:5): [True: 2.61k, False: 2.84k]
  ------------------
  795|  2.61k|      if (auto f = Exiv2::find(matroskaTrackType, key)) {
  ------------------
  |  Branch (795:16): [True: 272, False: 2.34k]
  ------------------
  796|    272|        stream_ = f->_id;
  797|    272|      }
  798|  2.61k|      break;
  799|    239|    case TrackUsed:
  ------------------
  |  Branch (799:5): [True: 239, False: 5.22k]
  ------------------
  800|    239|      internalMt = Exiv2::find(trackEnable, key);
  801|    239|      break;
  802|    921|    case TrackDefault:
  ------------------
  |  Branch (802:5): [True: 921, False: 4.54k]
  ------------------
  803|    921|      internalMt = Exiv2::find(defaultOn, key);
  804|    921|      break;
  805|    272|    case TrackForced:
  ------------------
  |  Branch (805:5): [True: 272, False: 5.19k]
  ------------------
  806|    272|      internalMt = Exiv2::find(trackForced, key);
  807|    272|      break;
  808|    547|    case TrackLacing:
  ------------------
  |  Branch (808:5): [True: 547, False: 4.91k]
  ------------------
  809|    547|      internalMt = Exiv2::find(trackLacing, key);
  810|    547|      break;
  811|    401|    case CodecDecodeAll:
  ------------------
  |  Branch (811:5): [True: 401, False: 5.06k]
  ------------------
  812|    401|      internalMt = Exiv2::find(codecDecodeAll, key);
  813|    401|      break;
  814|    461|    case CodecSettings:
  ------------------
  |  Branch (814:5): [True: 461, False: 5.00k]
  ------------------
  815|    461|      internalMt = Exiv2::find(codecSettings, key);
  816|    461|      break;
  817|      5|    case Xmp_video_TagDefault:
  ------------------
  |  Branch (817:5): [True: 5, False: 5.46k]
  ------------------
  818|      5|      internalMt = tag;
  819|      5|      break;
  820|      0|    default:
  ------------------
  |  Branch (820:5): [True: 0, False: 5.46k]
  ------------------
  821|      0|      break;
  822|  5.46k|  }
  823|       |
  824|  5.46k|  if (internalMt) {
  ------------------
  |  Branch (824:7): [True: 1.37k, False: 4.08k]
  ------------------
  825|  1.37k|    xmpData_[internalMt->_label] = "Yes";
  826|  1.37k|  }
  827|  5.46k|}
_ZN5Exiv213MatroskaVideo14decodeDateTagsEPKNS_8Internal11MatroskaTagEPKhm:
  829|  2.10k|void MatroskaVideo::decodeDateTags(const MatroskaTag* tag, const byte* buf, size_t size) {
  830|  2.10k|  int64_t duration_in_ms = 0;
  831|  2.10k|  uint64_t value;
  832|  2.10k|  switch (tag->_id) {
  833|  1.35k|    case Xmp_video_Duration:
  ------------------
  |  Branch (833:5): [True: 1.35k, False: 752]
  ------------------
  834|  1.35k|      if (size <= 4) {
  ------------------
  |  Branch (834:11): [True: 1.12k, False: 224]
  ------------------
  835|  1.12k|        duration_in_ms = std::llround(getFloat(buf, bigEndian) * time_code_scale_ * 1000.0);
  836|  1.12k|      } else {
  837|    224|        duration_in_ms = std::llround(getDouble(buf, bigEndian) * time_code_scale_ * 1000);
  838|    224|      }
  839|  1.35k|      xmpData_[tag->_label] = duration_in_ms;
  840|  1.35k|      break;
  841|    234|    case Xmp_video_DateUTC:
  ------------------
  |  Branch (841:5): [True: 234, False: 1.87k]
  ------------------
  842|    234|      value = getULongLong(buf, bigEndian);
  843|    234|      if (!value)
  ------------------
  |  Branch (843:11): [True: 18, False: 216]
  ------------------
  844|     18|        return;
  845|    216|      duration_in_ms = value / 1000000000;
  846|    216|      xmpData_[tag->_label] = duration_in_ms;
  847|    216|      break;
  848|       |
  849|    518|    case TimecodeScale:
  ------------------
  |  Branch (849:5): [True: 518, False: 1.58k]
  ------------------
  850|    518|      value = getULongLong(buf, bigEndian);
  851|    518|      if (!value)
  ------------------
  |  Branch (851:11): [True: 379, False: 139]
  ------------------
  852|    379|        return;
  853|    139|      time_code_scale_ = static_cast<double>(value) / static_cast<double>(1000000000);
  854|    139|      xmpData_[tag->_label] = time_code_scale_;
  855|    139|      break;
  856|      0|    default:
  ------------------
  |  Branch (856:5): [True: 0, False: 2.10k]
  ------------------
  857|      0|      break;
  858|  2.10k|  }
  859|  2.10k|}
_ZN5Exiv213MatroskaVideo15decodeFloatTagsEPKNS_8Internal11MatroskaTagEPKh:
  861|  1.19k|void MatroskaVideo::decodeFloatTags(const MatroskaTag* tag, const byte* buf) {
  862|  1.19k|  xmpData_[tag->_label] = getFloat(buf, bigEndian);
  863|       |
  864|  1.19k|  switch (tag->_id) {
  865|    468|    case Xmp_audio_SampleRate:
  ------------------
  |  Branch (865:5): [True: 468, False: 724]
  ------------------
  866|    540|    case Xmp_audio_OutputSampleRate:
  ------------------
  |  Branch (866:5): [True: 72, False: 1.12k]
  ------------------
  867|    540|      xmpData_[tag->_label] = getFloat(buf, bigEndian);
  868|    540|      break;
  869|      0|    case VideoFrameRate_DefaultDuration:
  ------------------
  |  Branch (869:5): [True: 0, False: 1.19k]
  ------------------
  870|    652|    case Xmp_video_FrameRate: {
  ------------------
  |  Branch (870:5): [True: 652, False: 540]
  ------------------
  871|    652|      uint64_t key = getULongLong(buf, bigEndian);
  872|    652|      if (!key)
  ------------------
  |  Branch (872:11): [True: 20, False: 632]
  ------------------
  873|     20|        return;
  874|    632|      if (auto internalMt = Exiv2::find(streamRate, key)) {
  ------------------
  |  Branch (874:16): [True: 360, False: 272]
  ------------------
  875|    360|        double frame_rate = 0;
  876|    360|        switch (stream_) {
  877|    119|          case 1:  // video
  ------------------
  |  Branch (877:11): [True: 119, False: 241]
  ------------------
  878|    119|            frame_rate = 1000000000.0 / static_cast<double>(key);
  879|    119|            break;
  880|     53|          case 2:  // audio
  ------------------
  |  Branch (880:11): [True: 53, False: 307]
  ------------------
  881|     53|            frame_rate = static_cast<double>(key) / 1000;
  882|     53|            break;
  883|    188|          default:
  ------------------
  |  Branch (883:11): [True: 188, False: 172]
  ------------------
  884|    188|            break;
  885|    360|        }
  886|    360|        if (std::isgreater(frame_rate, 0.0))
  ------------------
  |  Branch (886:13): [True: 172, False: 188]
  ------------------
  887|    172|          xmpData_[internalMt->_label] = frame_rate;
  888|    360|      } else
  889|    272|        xmpData_[tag->_label] = "Variable Bit Rate";
  890|    632|    } break;
  891|    632|    default:
  ------------------
  |  Branch (891:5): [True: 0, False: 1.19k]
  ------------------
  892|      0|      xmpData_[tag->_label] = getFloat(buf, bigEndian);
  893|      0|      break;
  894|  1.19k|  }
  895|  1.19k|}
_ZN5Exiv213MatroskaVideo13findBlockSizeEh:
  897|   120k|uint32_t MatroskaVideo::findBlockSize(byte b) {
  898|   120k|  if (b & 128)
  ------------------
  |  Branch (898:7): [True: 97.6k, False: 22.7k]
  ------------------
  899|  97.6k|    return 1;
  900|  22.7k|  if (b & 64)
  ------------------
  |  Branch (900:7): [True: 13.3k, False: 9.35k]
  ------------------
  901|  13.3k|    return 2;
  902|  9.35k|  if (b & 32)
  ------------------
  |  Branch (902:7): [True: 1.76k, False: 7.58k]
  ------------------
  903|  1.76k|    return 3;
  904|  7.58k|  if (b & 16)
  ------------------
  |  Branch (904:7): [True: 4.20k, False: 3.38k]
  ------------------
  905|  4.20k|    return 4;
  906|  3.38k|  if (b & 8)
  ------------------
  |  Branch (906:7): [True: 712, False: 2.66k]
  ------------------
  907|    712|    return 5;
  908|  2.66k|  if (b & 4)
  ------------------
  |  Branch (908:7): [True: 284, False: 2.38k]
  ------------------
  909|    284|    return 6;
  910|  2.38k|  if (b & 2)
  ------------------
  |  Branch (910:7): [True: 476, False: 1.90k]
  ------------------
  911|    476|    return 7;
  912|  1.90k|  if (b & 1)
  ------------------
  |  Branch (912:7): [True: 1.55k, False: 353]
  ------------------
  913|  1.55k|    return 8;
  914|    353|  return 0;
  915|  1.90k|}
_ZN5Exiv214newMkvInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  917|  2.10k|Image::UniquePtr newMkvInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  918|  2.10k|  auto image = std::make_unique<MatroskaVideo>(std::move(io), params);
  919|  2.10k|  if (!image->good()) {
  ------------------
  |  Branch (919:7): [True: 0, False: 2.10k]
  ------------------
  920|      0|    return nullptr;
  921|      0|  }
  922|  2.10k|  return image;
  923|  2.10k|}
_ZN5Exiv29isMkvTypeERNS_7BasicIoEb:
  925|  9.32k|bool isMkvType(BasicIo& iIo, bool advance) {
  926|  9.32k|  bool result = true;
  927|  9.32k|  byte tmpBuf[4];
  928|  9.32k|  iIo.read(tmpBuf, 4);
  929|       |
  930|  9.32k|  if (iIo.error() || iIo.eof())
  ------------------
  |  Branch (930:7): [True: 0, False: 9.32k]
  |  Branch (930:22): [True: 245, False: 9.08k]
  ------------------
  931|    245|    return false;
  932|       |
  933|  9.08k|  if (0x1a != tmpBuf[0] || 0x45 != tmpBuf[1] || 0xdf != tmpBuf[2] || 0xa3 != tmpBuf[3]) {
  ------------------
  |  Branch (933:7): [True: 2.61k, False: 6.46k]
  |  Branch (933:28): [True: 78, False: 6.38k]
  |  Branch (933:49): [True: 30, False: 6.35k]
  |  Branch (933:70): [True: 35, False: 6.31k]
  ------------------
  934|  2.76k|    result = false;
  935|  2.76k|  }
  936|       |
  937|  9.08k|  if (!advance || !result)
  ------------------
  |  Branch (937:7): [True: 9.08k, False: 0]
  |  Branch (937:19): [True: 0, False: 0]
  ------------------
  938|  9.08k|    iIo.seek(0, BasicIo::beg);
  939|  9.08k|  return result;
  940|  9.32k|}
matroskavideo.cpp:_ZN5Exiv28InternalL14returnTagValueEPKhm:
  582|   120k|[[nodiscard]] static size_t returnTagValue(const byte* buf, size_t size) {
  583|   120k|  enforce(size > 0 && size <= 8, Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (583:11): [True: 120k, False: 353]
  |  Branch (583:23): [True: 120k, False: 0]
  ------------------
  584|       |
  585|   120k|  size_t b0 = buf[0] & (0xff >> size);
  586|   120k|  size_t tag = b0 << ((size - 1) * 8);
  587|   167k|  for (size_t i = 1; i < size; ++i) {
  ------------------
  |  Branch (587:22): [True: 47.3k, False: 120k]
  ------------------
  588|  47.3k|    tag |= static_cast<size_t>(buf[i]) << ((size - i - 1) * 8);
  589|  47.3k|  }
  590|       |
  591|   120k|  return tag;
  592|   120k|}
matroskavideo.cpp:_ZZN5Exiv213MatroskaVideo18decodeInternalTagsEPKNS_8Internal11MatroskaTagEPKhENK3$_0clEv:
  723|  7.65k|  auto internalMt = [=]() -> const MatroskaTag* {
  724|  7.65k|    switch (tag->_id) {
  ------------------
  |  Branch (724:13): [True: 7.65k, False: 0]
  ------------------
  725|    664|      case Xmp_video_VideoScanTpye:
  ------------------
  |  Branch (725:7): [True: 664, False: 6.99k]
  ------------------
  726|    664|        return Exiv2::find(videoScanType, key);
  727|    799|      case Xmp_audio_ChannelType:
  ------------------
  |  Branch (727:7): [True: 799, False: 6.85k]
  ------------------
  728|    799|        return Exiv2::find(audioChannels, key);
  729|    257|      case Xmp_video_ContentCompressAlgo:
  ------------------
  |  Branch (729:7): [True: 257, False: 7.40k]
  ------------------
  730|    257|        return Exiv2::find(compressionAlgorithm, key);
  731|    509|      case Xmp_video_ContentEncryptAlgo:
  ------------------
  |  Branch (731:7): [True: 509, False: 7.14k]
  ------------------
  732|    509|        return Exiv2::find(encryptionAlgorithm, key);
  733|     79|      case Xmp_video_ContentSignAlgo_1:
  ------------------
  |  Branch (733:7): [True: 79, False: 7.57k]
  ------------------
  734|    460|      case Xmp_video_ContentSignAlgo_2:
  ------------------
  |  Branch (734:7): [True: 381, False: 7.27k]
  ------------------
  735|    460|        return Exiv2::find(contentSignatureAlgorithm, key);
  736|    147|      case Xmp_video_ContentSignHashAlgo_1:
  ------------------
  |  Branch (736:7): [True: 147, False: 7.51k]
  ------------------
  737|  1.52k|      case Xmp_video_ContentSignHashAlgo_2:
  ------------------
  |  Branch (737:7): [True: 1.37k, False: 6.28k]
  ------------------
  738|  1.52k|        return Exiv2::find(contentSignatureHashAlgorithm, key);
  739|    288|      case Xmp_video_ContentEncodingType:
  ------------------
  |  Branch (739:7): [True: 288, False: 7.36k]
  ------------------
  740|    288|        return Exiv2::find(encodingType, key);
  741|  1.02k|      case Xmp_video_DisplayUnit:
  ------------------
  |  Branch (741:7): [True: 1.02k, False: 6.63k]
  ------------------
  742|  1.02k|        return Exiv2::find(displayUnit, key);
  743|    605|      case Xmp_video_AspectRatioType:
  ------------------
  |  Branch (743:7): [True: 605, False: 7.05k]
  ------------------
  744|    605|        return Exiv2::find(aspectRatioType, key);
  745|    914|      case Xmp_video_PhysicalEquivalent:
  ------------------
  |  Branch (745:7): [True: 914, False: 6.74k]
  ------------------
  746|    914|        return Exiv2::find(chapterPhysicalEquivalent, key);
  747|    432|      case Xmp_video_TranslateCodec:
  ------------------
  |  Branch (747:7): [True: 432, False: 7.22k]
  ------------------
  748|    432|        return Exiv2::find(chapterTranslateCodec, key);
  749|      0|      case Video_Audio_CodecID:
  ------------------
  |  Branch (749:7): [True: 0, False: 7.65k]
  ------------------
  750|      0|        return Exiv2::find(trackCodec, key);
  751|     94|      case Video_Audio_CodecName:
  ------------------
  |  Branch (751:7): [True: 94, False: 7.56k]
  ------------------
  752|     94|        return Exiv2::find(codecInfo, key);
  753|      4|      case CodecDownloadURL:
  ------------------
  |  Branch (753:7): [True: 4, False: 7.65k]
  ------------------
  754|     89|      case CodecInfoURL:
  ------------------
  |  Branch (754:7): [True: 85, False: 7.57k]
  ------------------
  755|     89|        return Exiv2::find(codecDownloadUrl, key);
  756|  7.65k|    }
  757|      0|    return nullptr;
  758|  7.65k|  }();

_ZN5Exiv23KeyD2Ev:
   11|  11.1M|Key::~Key() = default;
_ZN5Exiv29MetadatumD2Ev:
   17|  7.41M|Metadatum::~Metadatum() = default;
_ZNK5Exiv29Metadatum8toUint32Em:
   25|  45.0k|uint32_t Metadatum::toUint32(size_t n) const {
   26|  45.0k|  auto i = toInt64(n);
   27|  45.0k|  Internal::enforce(std::numeric_limits<uint32_t>::min() <= i, ErrorCode::kerCorruptedMetadata);
   28|  45.0k|  Internal::enforce(i <= std::numeric_limits<uint32_t>::max(), ErrorCode::kerCorruptedMetadata);
   29|  45.0k|  return static_cast<uint32_t>(i);
   30|  45.0k|}

_ZN5Exiv28Internal16MinoltaMakerNote7tagListEv:
   25|  48.0k|  static constexpr auto tagList() {
   26|  48.0k|    return tagInfo_;
   27|  48.0k|  }
_ZN5Exiv28Internal16MinoltaMakerNote11tagListCs5DEv:
   37|    412|  static constexpr auto tagListCs5D() {
   38|    412|    return tagInfoCs5D_;
   39|    412|  }
_ZN5Exiv28Internal16MinoltaMakerNote11tagListCs7DEv:
   33|  1.84k|  static constexpr auto tagListCs7D() {
   34|  1.84k|    return tagInfoCs7D_;
   35|  1.84k|  }
_ZN5Exiv28Internal16MinoltaMakerNote12tagListCsStdEv:
   29|    671|  static constexpr auto tagListCsStd() {
   30|    671|    return tagInfoCsStd_;
   31|    671|  }
_ZN5Exiv28Internal16MinoltaMakerNote13tagListCsA100Ev:
   41|    256|  static constexpr auto tagListCsA100() {
   42|    256|    return tagInfoCsA100_;
   43|    256|  }

_ZN5Exiv28MrwImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   24|    243|    Image(ImageType::mrw, mdExif | mdIptc | mdXmp, std::move(io), params) {
   25|    243|}
_ZNK5Exiv28MrwImage10pixelWidthEv:
   31|     21|uint32_t MrwImage::pixelWidth() const {
   32|     21|  auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageWidth"));
   33|     21|  if (imageWidth != exifData_.end() && imageWidth->count() > 0) {
  ------------------
  |  Branch (33:7): [True: 9, False: 12]
  |  Branch (33:7): [True: 5, False: 16]
  |  Branch (33:40): [True: 5, False: 4]
  ------------------
   34|      5|    return imageWidth->toUint32();
   35|      5|  }
   36|     16|  return 0;
   37|     21|}
_ZNK5Exiv28MrwImage11pixelHeightEv:
   39|     21|uint32_t MrwImage::pixelHeight() const {
   40|     21|  auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageLength"));
   41|     21|  if (imageHeight != exifData_.end() && imageHeight->count() > 0) {
  ------------------
  |  Branch (41:7): [True: 12, False: 9]
  |  Branch (41:7): [True: 6, False: 15]
  |  Branch (41:41): [True: 6, False: 6]
  ------------------
   42|      6|    return imageHeight->toUint32();
   43|      6|  }
   44|     15|  return 0;
   45|     21|}
_ZN5Exiv28MrwImage12readMetadataEv:
   62|    243|void MrwImage::readMetadata() {
   63|       |#ifdef EXIV2_DEBUG_MESSAGES
   64|       |  std::cerr << "Reading MRW file " << io_->path() << "\n";
   65|       |#endif
   66|    243|  if (io_->open() != 0) {
  ------------------
  |  Branch (66:7): [True: 0, False: 243]
  ------------------
   67|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   68|      0|  }
   69|    243|  IoCloser closer(*io_);
   70|       |  // Ensure that this is the correct image type
   71|    243|  if (!isMrwType(*io_, false)) {
  ------------------
  |  Branch (71:7): [True: 0, False: 243]
  ------------------
   72|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (72:9): [True: 0, False: 0]
  |  Branch (72:25): [True: 0, False: 0]
  ------------------
   73|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   74|      0|    throw Error(ErrorCode::kerNotAnImage, "MRW");
   75|      0|  }
   76|    243|  clearMetadata();
   77|       |
   78|       |  // Find the TTW block and read it into a buffer
   79|    243|  uint32_t const len = 8;
   80|    243|  byte tmp[len];
   81|    243|  io_->read(tmp, len);
   82|    243|  uint32_t pos = len;
   83|    243|  uint32_t const end = getULong(tmp + 4, bigEndian);
   84|       |
   85|    243|  pos += len;
   86|    243|  Internal::enforce(pos <= end, ErrorCode::kerFailedToReadImageData);
   87|    243|  io_->read(tmp, len);
   88|    243|  if (io_->error() || io_->eof())
  ------------------
  |  Branch (88:7): [True: 23, False: 220]
  |  Branch (88:23): [True: 0, False: 220]
  ------------------
   89|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
   90|       |
   91|    647|  while (memcmp(tmp + 1, "TTW", 3) != 0) {
  ------------------
  |  Branch (91:10): [True: 404, False: 243]
  ------------------
   92|    404|    uint32_t const siz = getULong(tmp + 4, bigEndian);
   93|    404|    Internal::enforce(siz <= end - pos, ErrorCode::kerFailedToReadImageData);
   94|    404|    pos += siz;
   95|    404|    io_->seek(siz, BasicIo::cur);
   96|    404|    Internal::enforce(!io_->error() && !io_->eof(), ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (96:23): [True: 365, False: 39]
  |  Branch (96:40): [True: 306, False: 59]
  ------------------
   97|       |
   98|    404|    Internal::enforce(len <= end - pos, ErrorCode::kerFailedToReadImageData);
   99|    404|    pos += len;
  100|    404|    io_->read(tmp, len);
  101|    404|    Internal::enforce(!io_->error() && !io_->eof(), ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (101:23): [True: 289, False: 115]
  |  Branch (101:40): [True: 258, False: 31]
  ------------------
  102|    404|  }
  103|       |
  104|    243|  const uint32_t siz = getULong(tmp + 4, bigEndian);
  105|       |  // First do an approximate bounds check of siz, so that we don't
  106|       |  // get DOS-ed by a 4GB allocation on the next line. If siz is
  107|       |  // greater than io_->size() then it is definitely invalid. But the
  108|       |  // exact bounds checking is done by the call to io_->read, which
  109|       |  // will fail if there are fewer than siz bytes left to read.
  110|    243|  Internal::enforce(siz <= io_->size(), ErrorCode::kerFailedToReadImageData);
  111|    243|  DataBuf buf(siz);
  112|    243|  io_->read(buf.data(), buf.size());
  113|    243|  Internal::enforce(!io_->error() && !io_->eof(), ErrorCode::kerFailedToReadImageData);
  ------------------
  |  Branch (113:21): [True: 45, False: 198]
  |  Branch (113:38): [True: 38, False: 7]
  ------------------
  114|       |
  115|    243|  const DecodeParams dp(max_recursion_depth_);
  116|    243|  ByteOrder bo = TiffParser::decode(exifData_, iptcData_, xmpData_, buf.c_data(), buf.size(), dp);
  117|    243|  setByteOrder(bo);
  118|    243|}  // MrwImage::readMetadata
_ZN5Exiv28MrwImage13writeMetadataEv:
  120|      2|void MrwImage::writeMetadata() {
  121|       |  // Todo: implement me!
  122|      2|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "MRW"));
  123|      2|}  // MrwImage::writeMetadata
_ZN5Exiv214newMrwInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  127|    243|Image::UniquePtr newMrwInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  128|    243|  auto image = std::make_unique<MrwImage>(std::move(io), params);
  129|    243|  if (!image->good()) {
  ------------------
  |  Branch (129:7): [True: 0, False: 243]
  ------------------
  130|      0|    return nullptr;
  131|      0|  }
  132|    243|  return image;
  133|    243|}
_ZN5Exiv29isMrwTypeERNS_7BasicIoEb:
  135|  31.2k|bool isMrwType(BasicIo& iIo, bool advance) {
  136|  31.2k|  const int32_t len = 4;
  137|  31.2k|  const std::array<byte, len> MrwId{0x0, 0x4d, 0x52, 0x4d};
  138|  31.2k|  std::array<byte, len> buf;
  139|  31.2k|  iIo.read(buf.data(), len);
  140|  31.2k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (140:7): [True: 0, False: 31.2k]
  |  Branch (140:22): [True: 163, False: 31.1k]
  ------------------
  141|    163|    return false;
  142|    163|  }
  143|  31.1k|  bool rc = buf == MrwId;
  144|  31.1k|  if (!advance || !rc) {
  ------------------
  |  Branch (144:7): [True: 31.1k, False: 0]
  |  Branch (144:19): [True: 0, False: 0]
  ------------------
  145|  31.1k|    iIo.seek(-len, BasicIo::cur);
  146|  31.1k|  }
  147|  31.1k|  return rc;
  148|  31.2k|}

_ZN5Exiv28Internal15Nikon1MakerNote7tagListEv:
   38|    725|  static constexpr auto tagList() {
   39|    725|    return tagInfo_;
   40|    725|  }
_ZN5Exiv28Internal15Nikon2MakerNote7tagListEv:
   71|     80|  static constexpr auto tagList() {
   72|     80|    return tagInfo_;
   73|     80|  }
_ZN5Exiv28Internal15Nikon3MakerNote7tagListEv:
   91|  8.85k|  static constexpr auto tagList() {
   92|  8.85k|    return tagInfo_;
   93|  8.85k|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListVrEv:
   95|  1.53k|  static constexpr auto tagListVr() {
   96|  1.53k|    return tagInfoVr_;
   97|  1.53k|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListPcEv:
   99|    531|  static constexpr auto tagListPc() {
  100|    531|    return tagInfoPc_;
  101|    531|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListWtEv:
  103|    680|  static constexpr auto tagListWt() {
  104|    680|    return tagInfoWt_;
  105|    680|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListIiEv:
  107|  1.76k|  static constexpr auto tagListIi() {
  108|  1.76k|    return tagInfoIi_;
  109|  1.76k|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListAfEv:
  111|  1.11k|  static constexpr auto tagListAf() {
  112|  1.11k|    return tagInfoAf_;
  113|  1.11k|  }
_ZN5Exiv28Internal15Nikon3MakerNote11tagListAf21Ev:
  115|    717|  static constexpr auto tagListAf21() {
  116|    717|    return tagInfoAf21_;
  117|    717|  }
_ZN5Exiv28Internal15Nikon3MakerNote11tagListAf22Ev:
  119|    308|  static constexpr auto tagListAf22() {
  120|    308|    return tagInfoAf22_;
  121|    308|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListAFTEv:
  123|    718|  static constexpr auto tagListAFT() {
  124|    718|    return tagInfoAFT_;
  125|    718|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListFiEv:
  127|     38|  static constexpr auto tagListFi() {
  128|     38|    return tagInfoFi_;
  129|     38|  }
_ZN5Exiv28Internal15Nikon3MakerNote9tagListMeEv:
  131|     76|  static constexpr auto tagListMe() {
  132|     76|    return tagInfoMe_;
  133|     76|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListFl1Ev:
  135|     19|  static constexpr auto tagListFl1() {
  136|     19|    return tagInfoFl1_;
  137|     19|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListFl2Ev:
  139|     30|  static constexpr auto tagListFl2() {
  140|     30|    return tagInfoFl2_;
  141|     30|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListFl3Ev:
  143|     36|  static constexpr auto tagListFl3() {
  144|     36|    return tagInfoFl3_;
  145|     36|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListFl6Ev:
  147|     82|  static constexpr auto tagListFl6() {
  148|     82|    return tagInfoFl6_;
  149|     82|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListFl7Ev:
  151|     73|  static constexpr auto tagListFl7() {
  152|     73|    return tagInfoFl7_;
  153|     73|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListSi1Ev:
  155|     56|  static constexpr auto tagListSi1() {
  156|     56|    return tagInfoSi1_;
  157|     56|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListSi2Ev:
  159|     16|  static constexpr auto tagListSi2() {
  160|     16|    return tagInfoSi2_;
  161|     16|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListSi5Ev:
  171|    314|  static constexpr auto tagListSi5() {
  172|    314|    return tagInfoSi5_;
  173|    314|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListCb1Ev:
  175|     18|  static constexpr auto tagListCb1() {
  176|     18|    return tagInfoCb1_;
  177|     18|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListCb2Ev:
  179|     13|  static constexpr auto tagListCb2() {
  180|     13|    return tagInfoCb2_;
  181|     13|  }
_ZN5Exiv28Internal15Nikon3MakerNote11tagListCb2aEv:
  183|     18|  static constexpr auto tagListCb2a() {
  184|     18|    return tagInfoCb2a_;
  185|     18|  }
_ZN5Exiv28Internal15Nikon3MakerNote11tagListCb2bEv:
  187|    109|  static constexpr auto tagListCb2b() {
  188|    109|    return tagInfoCb2b_;
  189|    109|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListCb3Ev:
  191|     15|  static constexpr auto tagListCb3() {
  192|     15|    return tagInfoCb3_;
  193|     15|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListCb4Ev:
  195|     42|  static constexpr auto tagListCb4() {
  196|     42|    return tagInfoCb4_;
  197|     42|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListLd1Ev:
  199|    585|  static constexpr auto tagListLd1() {
  200|    585|    return tagInfoLd1_;
  201|    585|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListLd2Ev:
  203|  6.09k|  static constexpr auto tagListLd2() {
  204|  6.09k|    return tagInfoLd2_;
  205|  6.09k|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListLd3Ev:
  207|     12|  static constexpr auto tagListLd3() {
  208|     12|    return tagInfoLd3_;
  209|     12|  }
_ZN5Exiv28Internal15Nikon3MakerNote10tagListLd4Ev:
  211|    802|  static constexpr auto tagListLd4() {
  212|    802|    return tagInfoLd4_;
  213|    802|  }

_ZN5Exiv28Internal16OlympusMakerNote7tagListEv:
   33|  69.0k|  static constexpr auto tagList() {
   34|  69.0k|    return tagInfo_;
   35|  69.0k|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListCsEv:
   37|  31.1k|  static constexpr auto tagListCs() {
   38|  31.1k|    return tagInfoCs_;
   39|  31.1k|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListEqEv:
   41|    668|  static constexpr auto tagListEq() {
   42|    668|    return tagInfoEq_;
   43|    668|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListRdEv:
   45|     73|  static constexpr auto tagListRd() {
   46|     73|    return tagInfoRd_;
   47|     73|  }
_ZN5Exiv28Internal16OlympusMakerNote10tagListRd2Ev:
   49|     74|  static constexpr auto tagListRd2() {
   50|     74|    return tagInfoRd2_;
   51|     74|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListIpEv:
   53|    534|  static constexpr auto tagListIp() {
   54|    534|    return tagInfoIp_;
   55|    534|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListFiEv:
   57|    529|  static constexpr auto tagListFi() {
   58|    529|    return tagInfoFi_;
   59|    529|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListFeEv:
   61|  1.20k|  static constexpr auto tagListFe() {
   62|  1.20k|    return tagInfoFe_;
   63|  1.20k|  }
_ZN5Exiv28Internal16OlympusMakerNote9tagListRiEv:
   65|    386|  static constexpr auto tagListRi() {
   66|    386|    return tagInfoRi_;
   67|    386|  }

_ZN5Exiv28OrfImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   25|    114|    TiffImage(/*ImageType::orf, mdExif | mdIptc | mdXmp,*/ std::move(io), params) {
   26|    114|  setTypeSupported(ImageType::orf, mdExif | mdIptc | mdXmp);
   27|    114|}  // OrfImage::OrfImage
_ZNK5Exiv28OrfImage10pixelWidthEv:
   33|     46|uint32_t OrfImage::pixelWidth() const {
   34|     46|  auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageWidth"));
   35|     46|  if (imageWidth != exifData_.end() && imageWidth->count() > 0) {
  ------------------
  |  Branch (35:7): [True: 21, False: 25]
  |  Branch (35:7): [True: 16, False: 30]
  |  Branch (35:40): [True: 16, False: 5]
  ------------------
   36|     16|    return imageWidth->toUint32();
   37|     16|  }
   38|     30|  return 0;
   39|     46|}
_ZNK5Exiv28OrfImage11pixelHeightEv:
   41|     46|uint32_t OrfImage::pixelHeight() const {
   42|     46|  auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.Image.ImageLength"));
   43|     46|  if (imageHeight != exifData_.end() && imageHeight->count() > 0) {
  ------------------
  |  Branch (43:7): [True: 29, False: 17]
  |  Branch (43:7): [True: 16, False: 30]
  |  Branch (43:41): [True: 16, False: 13]
  ------------------
   44|     16|    return imageHeight->toUint32();
   45|     16|  }
   46|     30|  return 0;
   47|     46|}
_ZN5Exiv28OrfImage12readMetadataEv:
   70|    114|void OrfImage::readMetadata() {
   71|       |#ifdef EXIV2_DEBUG_MESSAGES
   72|       |  std::cerr << "Reading ORF file " << io_->path() << "\n";
   73|       |#endif
   74|    114|  if (io_->open() != 0) {
  ------------------
  |  Branch (74:7): [True: 0, False: 114]
  ------------------
   75|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   76|      0|  }
   77|    114|  IoCloser closer(*io_);
   78|       |  // Ensure that this is the correct image type
   79|    114|  if (!isOrfType(*io_, false)) {
  ------------------
  |  Branch (79:7): [True: 0, False: 114]
  ------------------
   80|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (80:9): [True: 0, False: 0]
  |  Branch (80:25): [True: 0, False: 0]
  ------------------
   81|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   82|      0|    throw Error(ErrorCode::kerNotAnImage, "ORF");
   83|      0|  }
   84|    114|  clearMetadata();
   85|    114|  const DecodeParams dp(max_recursion_depth_);
   86|    114|  ByteOrder bo = OrfParser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), io_->size(), dp);
   87|    114|  setByteOrder(bo);
   88|    114|}
_ZN5Exiv28OrfImage13writeMetadataEv:
   90|     34|void OrfImage::writeMetadata() {
   91|       |#ifdef EXIV2_DEBUG_MESSAGES
   92|       |  std::cerr << "Writing ORF file " << io_->path() << "\n";
   93|       |#endif
   94|     34|  ByteOrder bo = byteOrder();
   95|     34|  const byte* pData = nullptr;
   96|     34|  size_t size = 0;
   97|     34|  IoCloser closer(*io_);
   98|       |  // Ensure that this is the correct image type
   99|     34|  if (io_->open() == 0 && isOrfType(*io_, false)) {
  ------------------
  |  Branch (99:7): [True: 34, False: 0]
  |  Branch (99:27): [True: 34, False: 0]
  ------------------
  100|     34|    pData = io_->mmap(true);
  101|     34|    size = io_->size();
  102|     34|    OrfHeader orfHeader;
  103|     34|    if (0 == orfHeader.read(pData, 8)) {
  ------------------
  |  Branch (103:9): [True: 0, False: 34]
  ------------------
  104|      0|      bo = orfHeader.byteOrder();
  105|      0|    }
  106|     34|  }
  107|     34|  if (bo == invalidByteOrder) {
  ------------------
  |  Branch (107:7): [True: 0, False: 34]
  ------------------
  108|      0|    bo = littleEndian;
  109|      0|  }
  110|     34|  setByteOrder(bo);
  111|     34|  OrfParser::encode(*io_, pData, size, bo, exifData_, iptcData_, xmpData_);  // may throw
  112|     34|}  // OrfImage::writeMetadata
_ZN5Exiv29OrfParser6decodeERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPKhmRKNS_12DecodeParamsE:
  115|    114|                            const DecodeParams& dp) {
  116|    114|  OrfHeader orfHeader;
  117|    114|  return TiffParserWorker::decode(exifData, iptcData, xmpData, pData, size, Tag::root, TiffMapping::findDecoder, dp,
  118|    114|                                  &orfHeader);
  119|    114|}
_ZN5Exiv29OrfParser6encodeERNS_7BasicIoEPKhmNS_9ByteOrderERNS_8ExifDataERKNS_8IptcDataERKNS_7XmpDataE:
  122|     34|                              const IptcData& iptcData, const XmpData& xmpData) {
  123|       |  // Delete IFDs which do not occur in TIFF images
  124|     34|  static constexpr auto filteredIfds = {
  125|     34|      IfdId::panaRawId,
  126|     34|  };
  127|     34|  for (auto&& filteredIfd : filteredIfds) {
  ------------------
  |  Branch (127:27): [True: 34, False: 34]
  ------------------
  128|       |#ifdef EXIV2_DEBUG_MESSAGES
  129|       |    std::cerr << "Warning: Exif IFD " << filteredIfd << " not encoded\n";
  130|       |#endif
  131|     34|    exifData.erase(std::remove_if(exifData.begin(), exifData.end(), FindExifdatum(filteredIfd)), exifData.end());
  132|     34|  }
  133|       |
  134|     34|  OrfHeader header(byteOrder);
  135|     34|  return TiffParserWorker::encode(io, pData, size, exifData, iptcData, xmpData, Tag::root, TiffMapping::findEncoder,
  136|     34|                                  &header, nullptr);
  137|     34|}
_ZN5Exiv214newOrfInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  141|    114|Image::UniquePtr newOrfInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  142|    114|  auto image = std::make_unique<OrfImage>(std::move(io), params);
  143|    114|  if (!image->good()) {
  ------------------
  |  Branch (143:7): [True: 0, False: 114]
  ------------------
  144|      0|    return nullptr;
  145|      0|  }
  146|    114|  return image;
  147|    114|}
_ZN5Exiv29isOrfTypeERNS_7BasicIoEb:
  149|  18.6k|bool isOrfType(BasicIo& iIo, bool advance) {
  150|  18.6k|  const int32_t len = 8;
  151|  18.6k|  byte buf[len];
  152|  18.6k|  iIo.read(buf, len);
  153|  18.6k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (153:7): [True: 0, False: 18.6k]
  |  Branch (153:22): [True: 200, False: 18.4k]
  ------------------
  154|    200|    return false;
  155|    200|  }
  156|  18.4k|  OrfHeader orfHeader;
  157|  18.4k|  bool rc = orfHeader.read(buf, len);
  158|  18.4k|  if (!advance || !rc) {
  ------------------
  |  Branch (158:7): [True: 18.4k, False: 0]
  |  Branch (158:19): [True: 0, False: 0]
  ------------------
  159|  18.4k|    iIo.seek(-len, BasicIo::cur);
  160|  18.4k|  }
  161|  18.4k|  return rc;
  162|  18.6k|}

_ZN5Exiv28Internal9OrfHeaderC2ENS_9ByteOrderE:
    6|  18.6k|OrfHeader::OrfHeader(ByteOrder byteOrder) : TiffHeaderBase(0x4f52, 8, byteOrder, 0x00000008) {
    7|  18.6k|}
_ZN5Exiv28Internal9OrfHeader4readEPKhm:
    9|  18.6k|bool OrfHeader::read(const byte* pData, size_t size) {
   10|  18.6k|  if (size < 8)
  ------------------
  |  Branch (10:7): [True: 0, False: 18.6k]
  ------------------
   11|      0|    return false;
   12|       |
   13|  18.6k|  if (pData[0] == 'I' && pData[0] == pData[1]) {
  ------------------
  |  Branch (13:7): [True: 187, False: 18.4k]
  |  Branch (13:26): [True: 126, False: 61]
  ------------------
   14|    126|    setByteOrder(littleEndian);
   15|  18.5k|  } else if (pData[0] == 'M' && pData[0] == pData[1]) {
  ------------------
  |  Branch (15:14): [True: 588, False: 17.9k]
  |  Branch (15:33): [True: 548, False: 40]
  ------------------
   16|    548|    setByteOrder(bigEndian);
   17|  17.9k|  } else {
   18|  17.9k|    return false;
   19|  17.9k|  }
   20|       |
   21|    674|  uint16_t sig = getUShort(pData + 2, byteOrder());
   22|    674|  if (tag() != sig && 0x5352 != sig)
  ------------------
  |  Branch (22:7): [True: 623, False: 51]
  |  Branch (22:23): [True: 116, False: 507]
  ------------------
   23|    116|    return false;  // #658: Added 0x5352 "SR" for SP-560UZ
   24|    558|  sig_ = sig;
   25|    558|  setOffset(getULong(pData + 4, byteOrder()));
   26|    558|  return true;
   27|    674|}
_ZNK5Exiv28Internal9OrfHeader5writeEv:
   29|     25|DataBuf OrfHeader::write() const {
   30|     25|  DataBuf buf(8);
   31|     25|  switch (byteOrder()) {
   32|      3|    case littleEndian:
  ------------------
  |  Branch (32:5): [True: 3, False: 22]
  ------------------
   33|      3|      buf.write_uint8(0, 'I');
   34|      3|      break;
   35|     22|    case bigEndian:
  ------------------
  |  Branch (35:5): [True: 22, False: 3]
  ------------------
   36|     22|      buf.write_uint8(0, 'M');
   37|     22|      break;
   38|      0|    default:
  ------------------
  |  Branch (38:5): [True: 0, False: 25]
  ------------------
   39|      0|      break;
   40|     25|  }
   41|     25|  buf.write_uint8(1, buf.read_uint8(0));
   42|       |
   43|     25|  buf.write_uint16(2, sig_, byteOrder());
   44|     25|  buf.write_uint32(4, 0x00000008, byteOrder());
   45|     25|  return buf;
   46|     25|}

_ZN5Exiv28Internal18PanasonicMakerNote10tagListRawEv:
   29|   163k|  static constexpr auto tagListRaw() {
   30|   163k|    return tagInfoRaw_;
   31|   163k|  }
_ZN5Exiv28Internal18PanasonicMakerNote7tagListEv:
   25|  35.7k|  static constexpr auto tagList() {
   26|  35.7k|    return tagInfo_;
   27|  35.7k|  }

_ZN5Exiv28Internal15PentaxMakerNote7tagListEv:
   23|  41.2k|  static constexpr auto tagList() {
   24|  41.2k|    return tagInfo_;
   25|  41.2k|  }

_ZN5Exiv28PgfImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   53|    651|    Image(ImageType::pgf, mdExif | mdIptc | mdXmp | mdComment, std::move(io), params), bSwap_(isBigEndianPlatform()) {
   54|    651|  if (params.create() && io_->open() == 0) {
  ------------------
  |  Branch (54:7): [True: 0, False: 651]
  |  Branch (54:26): [True: 0, False: 0]
  ------------------
   55|       |#ifdef EXIV2_DEBUG_MESSAGES
   56|       |    std::cerr << "Exiv2::PgfImage:: Creating PGF image to memory\n";
   57|       |#endif
   58|      0|    IoCloser closer(*io_);
   59|      0|    if (io_->write(pgfBlank, sizeof(pgfBlank)) != sizeof(pgfBlank)) {
  ------------------
  |  Branch (59:9): [True: 0, False: 0]
  ------------------
   60|       |#ifdef EXIV2_DEBUG_MESSAGES
   61|       |      std::cerr << "Exiv2::PgfImage:: Failed to create PGF image on memory\n";
   62|       |#endif
   63|      0|    }
   64|      0|  }
   65|    651|}  // PgfImage::PgfImage
_ZN5Exiv28PgfImage12readMetadataEv:
   67|    651|void PgfImage::readMetadata() {
   68|       |#ifdef EXIV2_DEBUG_MESSAGES
   69|       |  std::cerr << "Exiv2::PgfImage::readMetadata: Reading PGF file " << io_->path() << "\n";
   70|       |#endif
   71|    651|  if (io_->open() != 0) {
  ------------------
  |  Branch (71:7): [True: 0, False: 651]
  ------------------
   72|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   73|      0|  }
   74|    651|  IoCloser closer(*io_);
   75|       |  // Ensure that this is the correct image type
   76|    651|  if (!isPgfType(*io_, true)) {
  ------------------
  |  Branch (76:7): [True: 0, False: 651]
  ------------------
   77|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (77:9): [True: 0, False: 0]
  |  Branch (77:25): [True: 0, False: 0]
  ------------------
   78|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   79|      0|    throw Error(ErrorCode::kerNotAnImage, "PGF");
   80|      0|  }
   81|    651|  clearMetadata();
   82|       |
   83|    651|  readPgfMagicNumber(*io_);
   84|       |
   85|    651|  size_t headerSize = readPgfHeaderSize(*io_);
   86|    651|  readPgfHeaderStructure(*io_, pixelWidth_, pixelHeight_);
   87|       |
   88|       |  // And now, the most interesting, the user data byte array where metadata are stored as small image.
   89|       |
   90|    651|  Internal::enforce(headerSize <= std::numeric_limits<size_t>::max() - 8, ErrorCode::kerCorruptedMetadata);
   91|    651|  size_t size = headerSize + 8 - io_->tell();
   92|       |
   93|       |#ifdef EXIV2_DEBUG_MESSAGES
   94|       |  std::cout << "Exiv2::PgfImage::readMetadata: Found Image data (" << size << " bytes)\n";
   95|       |#endif
   96|       |
   97|    651|  const size_t offset = io_->tell();
   98|    651|  assert(offset <= io_->size());
   99|    651|  if (size > io_->size() - offset)
  ------------------
  |  Branch (99:7): [True: 85, False: 566]
  ------------------
  100|     85|    throw Error(ErrorCode::kerInputDataReadFailed);
  101|    566|  if (size == 0)
  ------------------
  |  Branch (101:7): [True: 16, False: 550]
  ------------------
  102|     16|    return;
  103|       |
  104|    550|  const Exiv2::byte* base = io_->mmap();
  105|    550|  if (io_->error())
  ------------------
  |  Branch (105:7): [True: 0, False: 550]
  ------------------
  106|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  107|       |
  108|    550|  auto image = Exiv2::ImageFactory::open(base + offset, size);
  109|    550|  image->readMetadata();
  110|    550|  exifData() = image->exifData();
  111|    550|  iptcData() = image->iptcData();
  112|    550|  xmpData() = image->xmpData();
  113|    550|}
_ZN5Exiv28PgfImage13writeMetadataEv:
  115|    317|void PgfImage::writeMetadata() {
  116|    317|  if (io_->open() != 0) {
  ------------------
  |  Branch (116:7): [True: 0, False: 317]
  ------------------
  117|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  118|      0|  }
  119|    317|  IoCloser closer(*io_);
  120|    317|  MemIo tempIo;
  121|       |
  122|    317|  doWriteMetadata(tempIo);  // may throw
  123|    317|  io_->close();
  124|    317|  io_->transfer(tempIo);  // may throw
  125|       |
  126|    317|}  // PgfImage::writeMetadata
_ZN5Exiv28PgfImage15doWriteMetadataERNS_7BasicIoE:
  128|    317|void PgfImage::doWriteMetadata(BasicIo& outIo) {
  129|    317|  if (!io_->isopen())
  ------------------
  |  Branch (129:7): [True: 0, False: 317]
  ------------------
  130|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  131|    317|  if (!outIo.isopen())
  ------------------
  |  Branch (131:7): [True: 0, False: 317]
  ------------------
  132|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  133|       |
  134|       |#ifdef EXIV2_DEBUG_MESSAGES
  135|       |  std::cout << "Exiv2::PgfImage::doWriteMetadata: Writing PGF file " << io_->path() << "\n";
  136|       |  std::cout << "Exiv2::PgfImage::doWriteMetadata: tmp file created " << outIo.path() << "\n";
  137|       |#endif
  138|       |
  139|       |  // Ensure that this is the correct image type
  140|    317|  if (!isPgfType(*io_, true)) {
  ------------------
  |  Branch (140:7): [True: 0, False: 317]
  ------------------
  141|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (141:9): [True: 0, False: 0]
  |  Branch (141:25): [True: 0, False: 0]
  ------------------
  142|      0|      throw Error(ErrorCode::kerInputDataReadFailed);
  143|      0|    throw Error(ErrorCode::kerNoImageInInputData);
  144|      0|  }
  145|       |
  146|       |  // Ensure PGF version.
  147|    317|  byte mnb = readPgfMagicNumber(*io_);
  148|       |
  149|    317|  readPgfHeaderSize(*io_);
  150|       |
  151|    317|  uint32_t w = 0;
  152|    317|  uint32_t h = 0;
  153|    317|  DataBuf header = readPgfHeaderStructure(*io_, w, h);
  154|       |
  155|    317|  auto img = ImageFactory::create(ImageType::png);
  156|       |
  157|    317|  img->setExifData(exifData_);
  158|    317|  img->setIptcData(iptcData_);
  159|    317|  img->setXmpData(xmpData_);
  160|    317|  img->writeMetadata();
  161|    317|  size_t imgSize = img->io().size();
  162|    317|  DataBuf imgBuf = img->io().read(imgSize);
  163|       |
  164|       |#ifdef EXIV2_DEBUG_MESSAGES
  165|       |  std::cout << "Exiv2::PgfImage::doWriteMetadata: Creating image to host metadata (" << imgSize << " bytes)\n";
  166|       |#endif
  167|       |
  168|       |  //---------------------------------------------------------------
  169|       |
  170|       |  // Write PGF Signature.
  171|    317|  if (outIo.write(pgfSignature.data(), 3) != 3)
  ------------------
  |  Branch (171:7): [True: 0, False: 317]
  ------------------
  172|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  173|       |
  174|       |  // Write Magic number.
  175|    317|  if (outIo.putb(mnb) == EOF)
  ------------------
  |  Branch (175:7): [True: 0, False: 317]
  ------------------
  176|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  177|       |
  178|       |  // Write new Header size.
  179|    317|  auto newHeaderSize = static_cast<uint32_t>(header.size() + imgSize);
  180|    317|  DataBuf buffer(4);
  181|    317|  std::memcpy(buffer.data(), &newHeaderSize, sizeof(uint32_t));
  182|    317|  byteSwap_(buffer, 0, bSwap_);
  183|    317|  if (outIo.write(buffer.c_data(), 4) != 4)
  ------------------
  |  Branch (183:7): [True: 0, False: 317]
  ------------------
  184|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  185|       |
  186|       |#ifdef EXIV2_DEBUG_MESSAGES
  187|       |  std::cout << "Exiv2::PgfImage: new PGF header size : " << newHeaderSize << " bytes\n";
  188|       |
  189|       |  printf("%x\n", buffer.read_uint8(0));
  190|       |  printf("%x\n", buffer.read_uint8(1));
  191|       |  printf("%x\n", buffer.read_uint8(2));
  192|       |  printf("%x\n", buffer.read_uint8(3));
  193|       |#endif
  194|       |
  195|       |  // Write Header data.
  196|    317|  if (outIo.write(header.c_data(), header.size()) != header.size())
  ------------------
  |  Branch (196:7): [True: 0, False: 317]
  ------------------
  197|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  198|       |
  199|       |  // Write new metadata byte array.
  200|    317|  if (outIo.write(imgBuf.c_data(), imgBuf.size()) != imgBuf.size())
  ------------------
  |  Branch (200:7): [True: 0, False: 317]
  ------------------
  201|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  202|       |
  203|       |  // Copy the rest of PGF image data.
  204|       |
  205|    317|  DataBuf buf(4096);
  206|    317|  size_t readSize = io_->read(buf.data(), buf.size());
  207|    949|  while (readSize != 0) {
  ------------------
  |  Branch (207:10): [True: 632, False: 317]
  ------------------
  208|    632|    if (outIo.write(buf.c_data(), readSize) != readSize)
  ------------------
  |  Branch (208:9): [True: 0, False: 632]
  ------------------
  209|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  210|    632|    readSize = io_->read(buf.data(), buf.size());
  211|    632|  }
  212|    317|  if (outIo.error())
  ------------------
  |  Branch (212:7): [True: 0, False: 317]
  ------------------
  213|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  214|       |
  215|    317|}  // PgfImage::doWriteMetadata
_ZN5Exiv28PgfImage18readPgfMagicNumberERNS_7BasicIoE:
  217|    968|byte PgfImage::readPgfMagicNumber(BasicIo& iIo) {
  218|    968|  auto b = static_cast<byte>(iIo.getb());
  219|    968|  if (iIo.error())
  ------------------
  |  Branch (219:7): [True: 0, False: 968]
  ------------------
  220|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  221|       |
  222|    968|  if (b < 0x36)  // 0x36 = '6'.
  ------------------
  |  Branch (222:7): [True: 264, False: 704]
  ------------------
  223|    264|  {
  224|       |    // Not right Magick version.
  225|       |#ifdef EXIV2_DEBUG_MESSAGES
  226|       |    std::cout << "Exiv2::PgfImage::readMetadata: wrong Magick number\n";
  227|       |#endif
  228|    264|  }
  229|       |
  230|    968|  return b;
  231|    968|}  // PgfImage::readPgfMagicNumber
_ZNK5Exiv28PgfImage17readPgfHeaderSizeERNS_7BasicIoE:
  233|    968|size_t PgfImage::readPgfHeaderSize(BasicIo& iIo) const {
  234|    968|  DataBuf buffer(4);
  235|    968|  const size_t bufRead = iIo.read(buffer.data(), buffer.size());
  236|    968|  if (iIo.error())
  ------------------
  |  Branch (236:7): [True: 0, False: 968]
  ------------------
  237|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  238|    968|  if (bufRead != buffer.size())
  ------------------
  |  Branch (238:7): [True: 0, False: 968]
  ------------------
  239|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  240|       |
  241|    968|  auto headerSize = static_cast<size_t>(byteSwap_(buffer, 0, bSwap_));
  242|    968|  if (headerSize == 0)
  ------------------
  |  Branch (242:7): [True: 14, False: 954]
  ------------------
  243|     14|    throw Error(ErrorCode::kerNoImageInInputData);
  244|       |
  245|       |#ifdef EXIV2_DEBUG_MESSAGES
  246|       |  std::cout << "Exiv2::PgfImage: PGF header size : " << headerSize << " bytes\n";
  247|       |#endif
  248|       |
  249|    954|  return headerSize;
  250|    968|}
_ZNK5Exiv28PgfImage22readPgfHeaderStructureERNS_7BasicIoERjS3_:
  252|    954|DataBuf PgfImage::readPgfHeaderStructure(BasicIo& iIo, uint32_t& width, uint32_t& height) const {
  253|    954|  DataBuf header(16);
  254|    954|  size_t bufRead = iIo.read(header.data(), header.size());
  255|    954|  if (iIo.error())
  ------------------
  |  Branch (255:7): [True: 0, False: 954]
  ------------------
  256|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  257|    954|  if (bufRead != header.size())
  ------------------
  |  Branch (257:7): [True: 0, False: 954]
  ------------------
  258|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  259|       |
  260|    954|  DataBuf work(header.data(), 8);  // don't disturb the binary data - doWriteMetadata reuses it
  261|    954|  width = byteSwap_(work, 0, bSwap_);
  262|    954|  height = byteSwap_(work, 4, bSwap_);
  263|       |
  264|       |  /* NOTE: properties not yet used
  265|       |  byte nLevels  = buffer.pData_[8];
  266|       |  byte quality  = buffer.pData_[9];
  267|       |  byte bpp      = buffer.pData_[10];
  268|       |  byte channels = buffer.pData_[11];
  269|       |  */
  270|       |
  271|    954|  if (header.read_uint8(12) == 2)  // Indexed color image. We pass color table (256 * 3 bytes).
  ------------------
  |  Branch (271:7): [True: 47, False: 907]
  ------------------
  272|     47|  {
  273|     47|    header.alloc(16 + (256 * 3));
  274|       |
  275|     47|    bufRead = iIo.read(header.data(16), 256 * 3);
  276|     47|    if (iIo.error())
  ------------------
  |  Branch (276:9): [True: 0, False: 47]
  ------------------
  277|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  278|     47|    if (bufRead != 256 * 3)
  ------------------
  |  Branch (278:9): [True: 43, False: 4]
  ------------------
  279|     43|      throw Error(ErrorCode::kerInputDataReadFailed);
  280|     47|  }
  281|       |
  282|    911|  return header;
  283|    954|}  // PgfImage::readPgfHeaderStructure
_ZN5Exiv214newPgfInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  287|    651|Image::UniquePtr newPgfInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  288|    651|  auto image = std::make_unique<PgfImage>(std::move(io), params);
  289|    651|  if (!image->good()) {
  ------------------
  |  Branch (289:7): [True: 0, False: 651]
  ------------------
  290|      0|    return nullptr;
  291|      0|  }
  292|    651|  return image;
  293|    651|}
_ZN5Exiv29isPgfTypeERNS_7BasicIoEb:
  295|  18.5k|bool isPgfType(BasicIo& iIo, bool advance) {
  296|  18.5k|  const int32_t len = 3;
  297|  18.5k|  std::array<byte, len> buf;
  298|  18.5k|  iIo.read(buf.data(), len);
  299|  18.5k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (299:7): [True: 0, False: 18.5k]
  |  Branch (299:22): [True: 0, False: 18.5k]
  ------------------
  300|      0|    return false;
  301|      0|  }
  302|  18.5k|  bool rc = buf == pgfSignature;
  303|  18.5k|  if (!advance || !rc) {
  ------------------
  |  Branch (303:7): [True: 17.6k, False: 968]
  |  Branch (303:19): [True: 0, False: 968]
  ------------------
  304|  17.6k|    iIo.seek(-len, BasicIo::cur);
  305|  17.6k|  }
  306|       |
  307|  18.5k|  return rc;
  308|  18.5k|}
pgfimage.cpp:_ZN5Exiv2L9byteSwap_ERNS_7DataBufEmb:
   39|  3.19k|static uint32_t byteSwap_(Exiv2::DataBuf& buf, size_t offset, bool bSwap) {
   40|  3.19k|  uint32_t v = 0;
   41|  3.19k|  auto p = reinterpret_cast<byte*>(&v);
   42|  3.19k|  int i;
   43|  15.9k|  for (i = 0; i < 4; i++)
  ------------------
  |  Branch (43:15): [True: 12.7k, False: 3.19k]
  ------------------
   44|  12.7k|    p[i] = buf.read_uint8(offset + i);
   45|  3.19k|  uint32_t result = Image::byteSwap(v, bSwap);
   46|  3.19k|  p = reinterpret_cast<byte*>(&result);
   47|  15.9k|  for (i = 0; i < 4; i++)
  ------------------
  |  Branch (47:15): [True: 12.7k, False: 3.19k]
  ------------------
   48|  12.7k|    buf.write_uint8(offset + i, p[i]);
   49|  3.19k|  return result;
   50|  3.19k|}

_ZN5Exiv29Photoshop5isIrbEPKh:
   27|  60.2M|bool Photoshop::isIrb(const byte* pPsData) {
   28|  60.2M|  if (pPsData == nullptr)
  ------------------
  |  Branch (28:7): [True: 0, False: 60.2M]
  ------------------
   29|      0|    return false;
   30|       |
   31|  60.2M|  for (auto id : irbId_)
  ------------------
  |  Branch (31:16): [True: 240M, False: 4.84k]
  ------------------
   32|   240M|    if (std::equal(id, id + 4, pPsData))
  ------------------
  |  Branch (32:9): [True: 60.2M, False: 180M]
  ------------------
   33|  60.2M|      return true;
   34|       |
   35|  4.84k|  return false;
   36|  60.2M|}
_ZN5Exiv29Photoshop5validEPKhm:
   38|  38.6k|bool Photoshop::valid(const byte* pPsData, size_t sizePsData) {
   39|  38.6k|  const byte* record = nullptr;
   40|  38.6k|  uint32_t sizeIptc = 0;
   41|  38.6k|  uint32_t sizeHdr = 0;
   42|  38.6k|  const byte* pCur = pPsData;
   43|  38.6k|  const byte* pEnd = pPsData + sizePsData;
   44|  38.6k|  int ret = 0;
   45|  30.1M|  while (pCur < pEnd && 0 == (ret = Photoshop::locateIptcIrb(pCur, (pEnd - pCur), &record, sizeHdr, sizeIptc))) {
  ------------------
  |  Branch (45:10): [True: 30.1M, False: 47]
  |  Branch (45:25): [True: 30.0M, False: 38.6k]
  ------------------
   46|  30.0M|    pCur = record + sizeHdr + sizeIptc + (sizeIptc & 1);
   47|  30.0M|  }
   48|  38.6k|  return ret >= 0;
   49|  38.6k|}
_ZN5Exiv29Photoshop9locateIrbEPKhmtPS2_RjS4_:
   55|  30.1M|                         uint32_t& sizeData) {
   56|  30.1M|  if (sizePsData < 12) {
  ------------------
  |  Branch (56:7): [True: 1.18k, False: 30.1M]
  ------------------
   57|  1.18k|    return 3;
   58|  1.18k|  }
   59|       |
   60|       |  // Used for error checking
   61|  30.1M|  size_t position = 0;
   62|       |#ifdef EXIV2_DEBUG_MESSAGES
   63|       |  std::cerr << "Photoshop::locateIrb: ";
   64|       |#endif
   65|       |  // Data should follow Photoshop format, if not exit
   66|  60.2M|  while (position <= (sizePsData - 12) && isIrb(pPsData + position)) {
  ------------------
  |  Branch (66:10): [True: 60.2M, False: 194]
  |  Branch (66:43): [True: 60.2M, False: 4.49k]
  ------------------
   67|  60.2M|    const byte* hrd = pPsData + position;
   68|  60.2M|    position += 4;
   69|  60.2M|    uint16_t type = getUShort(pPsData + position, bigEndian);
   70|  60.2M|    position += 2;
   71|       |#ifdef EXIV2_DEBUG_MESSAGES
   72|       |    std::cerr << "0x" << std::hex << type << std::dec << " ";
   73|       |#endif
   74|       |    // Pascal string is padded to have an even size (including size byte)
   75|  60.2M|    byte psSize = pPsData[position] + 1;
   76|  60.2M|    psSize += (psSize & 1);
   77|  60.2M|    position += psSize;
   78|  60.2M|    if (position + 4 > sizePsData) {
  ------------------
  |  Branch (78:9): [True: 32.1k, False: 60.1M]
  ------------------
   79|       |#ifdef EXIV2_DEBUG_MESSAGES
   80|       |      std::cerr << "Warning: "
   81|       |                << "Invalid or extended Photoshop IRB\n";
   82|       |#endif
   83|  32.1k|      return -2;
   84|  32.1k|    }
   85|  60.1M|    uint32_t dataSize = getULong(pPsData + position, bigEndian);
   86|  60.1M|    position += 4;
   87|  60.1M|    if (dataSize > (sizePsData - position)) {
  ------------------
  |  Branch (87:9): [True: 1.95k, False: 60.1M]
  ------------------
   88|       |#ifdef EXIV2_DEBUG_MESSAGES
   89|       |      std::cerr << "Warning: "
   90|       |                << "Invalid Photoshop IRB data size " << dataSize << " or extended Photoshop IRB\n";
   91|       |#endif
   92|  1.95k|      return -2;
   93|  1.95k|    }
   94|       |#ifdef EXIV2_DEBUG_MESSAGES
   95|       |    if ((dataSize & 1) && position + dataSize == sizePsData) {
   96|       |      std::cerr << "Warning: "
   97|       |                << "Photoshop IRB data is not padded to even size\n";
   98|       |    }
   99|       |#endif
  100|  60.1M|    if (type == psTag) {
  ------------------
  |  Branch (100:9): [True: 30.1M, False: 30.0M]
  ------------------
  101|       |#ifdef EXIV2_DEBUG_MESSAGES
  102|       |      std::cerr << "ok\n";
  103|       |#endif
  104|  30.1M|      sizeData = dataSize;
  105|  30.1M|      sizeHdr = psSize + 10;
  106|  30.1M|      *record = hrd;
  107|  30.1M|      return 0;
  108|  30.1M|    }
  109|       |    // Data size is also padded to be even
  110|  30.0M|    position += dataSize + (dataSize & 1);
  111|  30.0M|  }
  112|       |#ifdef EXIV2_DEBUG_MESSAGES
  113|       |  std::cerr << "pPsData doesn't start with '8BIM'\n";
  114|       |#endif
  115|  4.69k|  if (position < sizePsData) {
  ------------------
  |  Branch (115:7): [True: 4.66k, False: 23]
  ------------------
  116|       |#ifdef EXIV2_DEBUG_MESSAGES
  117|       |    std::cerr << "Warning: "
  118|       |              << "Invalid or extended Photoshop IRB\n";
  119|       |#endif
  120|  4.66k|    return -2;
  121|  4.66k|  }
  122|     23|  return 3;
  123|  4.69k|}
_ZN5Exiv29Photoshop13locateIptcIrbEPKhmPS2_RjS4_:
  126|  30.1M|                             uint32_t& sizeData) {
  127|  30.1M|  return locateIrb(pPsData, sizePsData, iptc_, record, sizeHdr, sizeData);
  128|  30.1M|}
_ZN5Exiv29Photoshop10setIptcIrbEPKhmRKNS_8IptcDataE:
  135|    447|DataBuf Photoshop::setIptcIrb(const byte* pPsData, size_t sizePsData, const IptcData& iptcData) {
  136|       |#ifdef EXIV2_DEBUG_MESSAGES
  137|       |  std::cerr << "IRB block at the beginning of Photoshop::setIptcIrb\n";
  138|       |  if (sizePsData == 0)
  139|       |    std::cerr << "  None.\n";
  140|       |  else
  141|       |    hexdump(std::cerr, pPsData, sizePsData);
  142|       |#endif
  143|    447|  const byte* record = pPsData;
  144|    447|  uint32_t sizeIptc = 0;
  145|    447|  uint32_t sizeHdr = 0;
  146|    447|  DataBuf rc;
  147|    447|  if (0 > Photoshop::locateIptcIrb(pPsData, sizePsData, &record, sizeHdr, sizeIptc)) {
  ------------------
  |  Branch (147:7): [True: 99, False: 348]
  ------------------
  148|     99|    return rc;
  149|     99|  }
  150|       |
  151|    348|  Blob psBlob;
  152|    348|  const auto sizeFront = static_cast<size_t>(record - pPsData);
  153|       |  // Write data before old record.
  154|    348|  if (sizePsData > 0 && sizeFront > 0) {
  ------------------
  |  Branch (154:7): [True: 114, False: 234]
  |  Branch (154:25): [True: 9, False: 105]
  ------------------
  155|      9|    append(psBlob, pPsData, sizeFront);
  156|      9|  }
  157|       |
  158|       |  // Write new iptc record if we have it
  159|    348|  if (DataBuf rawIptc = IptcParser::encode(iptcData); !rawIptc.empty()) {
  ------------------
  |  Branch (159:55): [True: 158, False: 190]
  ------------------
  160|    158|    std::array<byte, 12> tmpBuf;
  161|    158|    std::copy_n(Photoshop::irbId_[0], 4, tmpBuf.begin());
  162|    158|    us2Data(tmpBuf.data() + 4, iptc_, bigEndian);
  163|    158|    tmpBuf[6] = 0;
  164|    158|    tmpBuf[7] = 0;
  165|    158|    ul2Data(tmpBuf.data() + 8, static_cast<uint32_t>(rawIptc.size()), bigEndian);
  166|    158|    append(psBlob, tmpBuf.data(), 12);
  167|    158|    append(psBlob, rawIptc.c_data(), rawIptc.size());
  168|       |    // Data is padded to be even (but not included in size)
  169|    158|    if (rawIptc.size() & 1)
  ------------------
  |  Branch (169:9): [True: 84, False: 74]
  ------------------
  170|     84|      psBlob.push_back(0x00);
  171|    158|  }
  172|       |
  173|       |  // Write existing stuff after record, skip the current and all remaining IPTC blocks
  174|    348|  size_t pos = sizeFront;
  175|    348|  auto nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
  176|    348|  Internal::enforce(nextSizeData >= 0, ErrorCode::kerCorruptedMetadata);
  177|  15.7k|  while (0 == Photoshop::locateIptcIrb(pPsData + pos, nextSizeData, &record, sizeHdr, sizeIptc)) {
  ------------------
  |  Branch (177:10): [True: 15.4k, False: 348]
  ------------------
  178|  15.4k|    const auto newPos = static_cast<size_t>(record - pPsData);
  179|  15.4k|    if (newPos > pos) {  // Copy data up to the IPTC IRB
  ------------------
  |  Branch (179:9): [True: 15.1k, False: 292]
  ------------------
  180|  15.1k|      append(psBlob, pPsData + pos, newPos - pos);
  181|  15.1k|    }
  182|  15.4k|    pos = newPos + sizeHdr + sizeIptc + (sizeIptc & 1);  // Skip the IPTC IRB
  183|  15.4k|    nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
  184|  15.4k|    Internal::enforce(nextSizeData >= 0, ErrorCode::kerCorruptedMetadata);
  185|  15.4k|  }
  186|    348|  if (pos < sizePsData) {
  ------------------
  |  Branch (186:7): [True: 99, False: 249]
  ------------------
  187|     99|    append(psBlob, pPsData + pos, sizePsData - pos);
  188|     99|  }
  189|       |
  190|       |  // Data is rounded to be even
  191|    348|  if (!psBlob.empty())
  ------------------
  |  Branch (191:7): [True: 253, False: 95]
  ------------------
  192|    253|    rc = DataBuf(psBlob.data(), psBlob.size());
  193|       |#ifdef EXIV2_DEBUG_MESSAGES
  194|       |  std::cerr << "IRB block at the end of Photoshop::setIptcIrb\n";
  195|       |  if (rc.empty())
  196|       |    std::cerr << "  None.\n";
  197|       |  else
  198|       |    hexdump(std::cerr, rc.c_data(), rc.size());
  199|       |#endif
  200|    348|  return rc;
  201|    447|}

_ZN5Exiv28Internal8PngChunk15decodeIHDRChunkERKNS_7DataBufEPjS5_:
   45|    103|void PngChunk::decodeIHDRChunk(const DataBuf& data, uint32_t* outWidth, uint32_t* outHeight) {
   46|       |  // Extract image width and height from IHDR chunk.
   47|    103|  *outWidth = data.read_uint32(0, bigEndian);
   48|    103|  *outHeight = data.read_uint32(4, bigEndian);
   49|    103|}
_ZN5Exiv28Internal8PngChunk14decodeTXTChunkEPNS_5ImageERKNS_7DataBufENS1_12TxtChunkTypeERKNS_12DecodeParamsE:
   51|  7.16k|void PngChunk::decodeTXTChunk(Image* pImage, const DataBuf& data, TxtChunkType type, const DecodeParams& dp) {
   52|  7.16k|  DataBuf key = keyTXTChunk(data);
   53|  7.16k|  DataBuf arr = parseTXTChunk(data, key.size(), type);
   54|       |
   55|       |#ifdef EXIV2_DEBUG_MESSAGES
   56|       |  std::cout << "Exiv2::PngChunk::decodeTXTChunk: TXT chunk data: " << std::string(arr.c_str(), arr.size()) << '\n';
   57|       |#endif
   58|  7.16k|  if (!key.empty())
  ------------------
  |  Branch (58:7): [True: 6.47k, False: 687]
  ------------------
   59|  6.47k|    parseChunkContent(pImage, key.c_data(), key.size(), arr, dp);
   60|  7.16k|}
_ZN5Exiv28Internal8PngChunk11keyTXTChunkERKNS_7DataBufEb:
   71|  8.61k|DataBuf PngChunk::keyTXTChunk(const DataBuf& data, bool stripHeader) {
   72|       |  // From a tEXt, zTXt, or iTXt chunk, we get the keyword which is null terminated.
   73|  8.61k|  const size_t offset = stripHeader ? 8ul : 0ul;
  ------------------
  |  Branch (73:25): [True: 1.45k, False: 7.16k]
  ------------------
   74|  8.61k|  if (data.size() <= offset)
  ------------------
  |  Branch (74:7): [True: 18, False: 8.59k]
  ------------------
   75|     18|    throw Error(ErrorCode::kerFailedToReadImageData);
   76|       |
   77|  8.59k|  auto it = std::find(data.begin() + offset, data.end(), 0);
   78|  8.59k|  if (it == data.end())
  ------------------
  |  Branch (78:7): [True: 29, False: 8.57k]
  ------------------
   79|     29|    throw Error(ErrorCode::kerFailedToReadImageData);
   80|       |
   81|  8.57k|  return {data.c_data() + offset, std::distance(data.begin(), it) - offset};
   82|  8.59k|}
_ZN5Exiv28Internal8PngChunk13parseTXTChunkERKNS_7DataBufEmNS1_12TxtChunkTypeE:
   84|  7.11k|DataBuf PngChunk::parseTXTChunk(const DataBuf& data, size_t keysize, TxtChunkType type) {
   85|  7.11k|  DataBuf arr;
   86|       |
   87|  7.11k|  if (type == zTXt_Chunk) {
  ------------------
  |  Branch (87:7): [True: 313, False: 6.80k]
  ------------------
   88|    313|    enforce(data.size() >= Safe::add(keysize, nullSeparators), ErrorCode::kerCorruptedMetadata);
   89|       |
   90|       |    // Extract a deflate compressed Latin-1 text chunk
   91|       |
   92|       |    // we get the compression method after the key
   93|    313|    if (*data.c_data(keysize + 1) != 0x00) {
  ------------------
  |  Branch (93:9): [True: 12, False: 301]
  ------------------
   94|       |      // then it isn't zlib compressed and we are sunk
   95|       |#ifdef EXIV2_DEBUG_MESSAGES
   96|       |      std::cerr << "Exiv2::PngChunk::parseTXTChunk: Non-standard zTXt compression method.\n";
   97|       |#endif
   98|     12|      throw Error(ErrorCode::kerFailedToReadImageData);
   99|     12|    }
  100|       |
  101|       |    // compressed string after the compression technique spec
  102|    301|    size_t compressedTextSize = data.size() - keysize - nullSeparators;
  103|    301|    if (compressedTextSize) {
  ------------------
  |  Branch (103:9): [True: 46, False: 255]
  ------------------
  104|     46|      const byte* compressedText = data.c_data(keysize + nullSeparators);
  105|     46|      enforce(compressedTextSize < data.size(), ErrorCode::kerCorruptedMetadata);
  106|       |
  107|     46|      zlibUncompress(compressedText, static_cast<uint32_t>(compressedTextSize), arr);
  108|     46|    }
  109|  6.80k|  } else if (type == tEXt_Chunk) {
  ------------------
  |  Branch (109:14): [True: 2.90k, False: 3.90k]
  ------------------
  110|  2.90k|    enforce(data.size() >= Safe::add(keysize, std::size_t{1}), ErrorCode::kerCorruptedMetadata);
  111|       |    // Extract a non-compressed Latin-1 text chunk
  112|       |
  113|       |    // the text comes after the key, but isn't null terminated
  114|  2.90k|    size_t textsize = data.size() - keysize - 1;
  115|  2.90k|    if (textsize) {
  ------------------
  |  Branch (115:9): [True: 1.89k, False: 1.00k]
  ------------------
  116|  1.89k|      const byte* text = data.c_data(keysize + 1);
  117|       |
  118|  1.89k|      arr = DataBuf(text, textsize);
  119|  1.89k|    }
  120|  3.90k|  } else if (type == iTXt_Chunk) {
  ------------------
  |  Branch (120:14): [True: 3.90k, False: 0]
  ------------------
  121|  3.90k|    enforce(data.size() > Safe::add(keysize, std::size_t{3}), ErrorCode::kerCorruptedMetadata);
  122|  3.90k|    const size_t nullCount = std::count(data.c_data(keysize + 3), data.c_data(data.size() - 1), '\0');
  123|  3.90k|    enforce(nullCount >= nullSeparators, ErrorCode::kerCorruptedMetadata);
  124|       |
  125|       |    // Extract a deflate compressed or uncompressed UTF-8 text chunk
  126|       |
  127|       |    // we get the compression flag after the key
  128|  3.90k|    const byte compressionFlag = data.read_uint8(keysize + 1);
  129|       |    // we get the compression method after the compression flag
  130|  3.90k|    const byte compressionMethod = data.read_uint8(keysize + 2);
  131|       |
  132|  3.90k|    enforce(compressionFlag == 0x00 || compressionFlag == 0x01, ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (132:13): [True: 3.69k, False: 210]
  |  Branch (132:40): [True: 172, False: 38]
  ------------------
  133|  3.90k|    if (compressionFlag == 0x01)
  ------------------
  |  Branch (133:9): [True: 172, False: 3.73k]
  ------------------
  134|    172|      enforce(compressionMethod == 0x00, ErrorCode::kerFailedToReadImageData);
  135|       |
  136|       |    // language description string after the compression technique spec
  137|  3.90k|    const size_t languageTextMaxSize = data.size() - keysize - 3;
  138|  3.90k|    std::string languageText = string_from_unterminated(data.c_str(keysize + 3), languageTextMaxSize);
  139|  3.90k|    const size_t languageTextSize = languageText.size();
  140|       |
  141|  3.90k|    enforce(data.size() >= Safe::add(Safe::add(keysize, std::size_t{4}), languageTextSize),
  142|  3.90k|            ErrorCode::kerCorruptedMetadata);
  143|       |    // translated keyword string after the language description
  144|  3.90k|    std::string translatedKeyText = string_from_unterminated(data.c_str(keysize + 3 + languageTextSize + 1),
  145|  3.90k|                                                             data.size() - (keysize + 3 + languageTextSize + 1));
  146|  3.90k|    const size_t translatedKeyTextSize = translatedKeyText.size();
  147|       |
  148|  3.90k|    enforce(Safe::add(keysize + 3 + languageTextSize + 1, Safe::add(translatedKeyTextSize, size_t{1})) <= data.size(),
  149|  3.90k|            ErrorCode::kerCorruptedMetadata);
  150|       |
  151|  3.90k|    const auto textsize =
  152|  3.90k|        static_cast<long>(data.size() - (keysize + 3 + languageTextSize + 1 + translatedKeyTextSize + 1));
  153|  3.90k|    if (textsize) {
  ------------------
  |  Branch (153:9): [True: 3.68k, False: 214]
  ------------------
  154|  3.68k|      const byte* text = data.c_data(keysize + 3 + languageTextSize + 1 + translatedKeyTextSize + 1);
  155|       |
  156|  3.68k|      if (compressionFlag == 0x00) {
  ------------------
  |  Branch (156:11): [True: 3.55k, False: 136]
  ------------------
  157|       |        // then it's an uncompressed iTXt chunk
  158|       |#ifdef EXIV2_DEBUG_MESSAGES
  159|       |        std::cout << "Exiv2::PngChunk::parseTXTChunk: We found an uncompressed iTXt field\n";
  160|       |#endif
  161|  3.55k|        arr = DataBuf(text, textsize);
  162|  3.55k|      } else {
  163|       |        // then it's a zlib compressed iTXt chunk
  164|       |#ifdef EXIV2_DEBUG_MESSAGES
  165|       |        std::cout << "Exiv2::PngChunk::parseTXTChunk: We found a zlib compressed iTXt field\n";
  166|       |#endif
  167|       |
  168|       |        // the compressed text comes after the translated keyword, but isn't null terminated
  169|    136|        zlibUncompress(text, textsize, arr);
  170|    136|      }
  171|  3.68k|    }
  172|  3.90k|  } else {
  173|       |#ifdef DEBUG
  174|       |    std::cerr << "Exiv2::PngChunk::parseTXTChunk: We found a field, not expected though\n";
  175|       |#endif
  176|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  177|      0|  }
  178|       |
  179|  7.10k|  return arr;
  180|  7.11k|}
_ZN5Exiv28Internal8PngChunk17parseChunkContentEPNS_5ImageEPKhmRKNS_7DataBufERKNS_12DecodeParamsE:
  183|  6.47k|                                 const DecodeParams& dp) {
  184|       |  // We look if an ImageMagick EXIF raw profile exist.
  185|       |
  186|  6.47k|  if (keySize >= 21 &&
  ------------------
  |  Branch (186:7): [True: 2.33k, False: 4.14k]
  ------------------
  187|  2.33k|      (memcmp("Raw profile type exif", key, 21) == 0 || memcmp("Raw profile type APP1", key, 21) == 0) &&
  ------------------
  |  Branch (187:8): [True: 15, False: 2.31k]
  |  Branch (187:57): [True: 558, False: 1.76k]
  ------------------
  188|    573|      pImage->exifData().empty()) {
  ------------------
  |  Branch (188:7): [True: 573, False: 0]
  ------------------
  189|    573|    DataBuf exifData = readRawProfile(arr, false);
  190|    573|    size_t length = exifData.size();
  191|       |
  192|    573|    if (length >= 4) {  // length should have at least the size of TIFF header
  ------------------
  |  Branch (192:9): [True: 378, False: 195]
  ------------------
  193|       |      // Find the position of TIFF header in bytes array.
  194|       |      // Forgives the absence of the expected Exif\0 APP1 prefix.
  195|    378|      const std::array<byte, 4> tiffHeaderLE{0x49, 0x49, 0x2A, 0x00};  // "II*\0"
  196|    378|      const std::array<byte, 4> tiffHeaderBE{0x4D, 0x4D, 0x00, 0x2A};  // "MM\0*"
  197|    378|      size_t pos = std::numeric_limits<size_t>::max();
  198|       |
  199|       |      /// \todo Find substring inside an string
  200|    562|      for (size_t i = 0; i < length - tiffHeaderLE.size(); i++) {
  ------------------
  |  Branch (200:26): [True: 184, False: 378]
  ------------------
  201|    184|        if (0 == exifData.cmpBytes(i, tiffHeaderLE.data(), tiffHeaderLE.size()) ||
  ------------------
  |  Branch (201:13): [True: 0, False: 184]
  ------------------
  202|    184|            0 == exifData.cmpBytes(i, tiffHeaderBE.data(), tiffHeaderBE.size())) {
  ------------------
  |  Branch (202:13): [True: 0, False: 184]
  ------------------
  203|      0|          pos = i;
  204|      0|          break;
  205|      0|        }
  206|    184|      }
  207|       |
  208|       |      // If found it, store only these data at from this place.
  209|       |
  210|    378|      if (pos != std::numeric_limits<size_t>::max()) {
  ------------------
  |  Branch (210:11): [True: 0, False: 378]
  ------------------
  211|       |#ifdef EXIV2_DEBUG_MESSAGES
  212|       |        std::cout << "Exiv2::PngChunk::parseChunkContent: TIFF header found at position " << pos << "\n";
  213|       |#endif
  214|      0|        ByteOrder bo = TiffParser::decode(pImage->exifData(), pImage->iptcData(), pImage->xmpData(),
  215|      0|                                          exifData.c_data(pos), length - pos, dp);
  216|      0|        pImage->setByteOrder(bo);
  217|    378|      } else {
  218|    378|#ifndef SUPPRESS_WARNINGS
  219|    378|        EXV_WARNING << "Failed to decode Exif metadata.\n";
  ------------------
  |  |  138|    378|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 378]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    378|  LogMsg(LogMsg::warn).os()
  ------------------
  220|    378|#endif
  221|    378|        pImage->exifData().clear();
  222|    378|      }
  223|    378|    }
  224|    573|  }
  225|       |
  226|       |  // We look if an ImageMagick IPTC raw profile exist.
  227|       |
  228|  6.47k|  if (keySize >= 21 && memcmp("Raw profile type iptc", key, 21) == 0 && pImage->iptcData().empty()) {
  ------------------
  |  Branch (228:7): [True: 2.32k, False: 4.15k]
  |  Branch (228:24): [True: 807, False: 1.51k]
  |  Branch (228:73): [True: 801, False: 6]
  ------------------
  229|    801|    DataBuf psData = readRawProfile(arr, false);
  230|    801|    if (!psData.empty()) {
  ------------------
  |  Branch (230:9): [True: 71, False: 730]
  ------------------
  231|     71|      Blob iptcBlob;
  232|     71|      const byte* record = nullptr;
  233|     71|      uint32_t sizeIptc = 0;
  234|     71|      uint32_t sizeHdr = 0;
  235|       |
  236|     71|      const byte* pEnd = psData.c_data(psData.size() - 1);
  237|     71|      const byte* pCur = psData.c_data();
  238|     71|      while (pCur < pEnd && 0 == Photoshop::locateIptcIrb(pCur, pEnd - pCur, &record, sizeHdr, sizeIptc)) {
  ------------------
  |  Branch (238:14): [True: 64, False: 7]
  |  Branch (238:29): [True: 0, False: 64]
  ------------------
  239|      0|        if (sizeIptc) {
  ------------------
  |  Branch (239:13): [True: 0, False: 0]
  ------------------
  240|       |#ifdef EXIV2_DEBUG_MESSAGES
  241|       |          std::cerr << "Found IPTC IRB, size = " << sizeIptc << "\n";
  242|       |#endif
  243|      0|          append(iptcBlob, record + sizeHdr, sizeIptc);
  244|      0|        }
  245|      0|        pCur = record + sizeHdr + sizeIptc;
  246|      0|        pCur += (sizeIptc & 1);
  247|      0|      }
  248|     71|      if (!iptcBlob.empty() && IptcParser::decode(pImage->iptcData(), iptcBlob.data(), iptcBlob.size())) {
  ------------------
  |  Branch (248:11): [True: 0, False: 71]
  |  Branch (248:32): [True: 0, False: 0]
  ------------------
  249|      0|#ifndef SUPPRESS_WARNINGS
  250|      0|        EXV_WARNING << "Failed to decode IPTC metadata.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  251|      0|#endif
  252|      0|        pImage->clearIptcData();
  253|      0|      }
  254|       |      // If there is no IRB, try to decode the complete chunk data
  255|     71|      if (iptcBlob.empty() && IptcParser::decode(pImage->iptcData(), psData.c_data(), psData.size())) {
  ------------------
  |  Branch (255:11): [True: 71, False: 0]
  |  Branch (255:31): [True: 25, False: 46]
  ------------------
  256|     25|#ifndef SUPPRESS_WARNINGS
  257|     25|        EXV_WARNING << "Failed to decode IPTC metadata.\n";
  ------------------
  |  |  138|     25|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 25]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     25|  LogMsg(LogMsg::warn).os()
  ------------------
  258|     25|#endif
  259|     25|        pImage->clearIptcData();
  260|     25|      }
  261|     71|    }  // if (psData.size() > 0)
  262|    801|  }
  263|       |
  264|       |  // We look if an ImageMagick XMP raw profile exist.
  265|       |
  266|  6.47k|  if (keySize >= 20 && memcmp("Raw profile type xmp", key, 20) == 0 && pImage->xmpData().empty()) {
  ------------------
  |  Branch (266:7): [True: 2.31k, False: 4.16k]
  |  Branch (266:24): [True: 68, False: 2.24k]
  |  Branch (266:72): [True: 67, False: 1]
  ------------------
  267|     67|    DataBuf xmpBuf = readRawProfile(arr, false);
  268|     67|    size_t length = xmpBuf.size();
  269|       |
  270|     67|    if (length > 0) {
  ------------------
  |  Branch (270:9): [True: 28, False: 39]
  ------------------
  271|     28|      std::string& xmpPacket = pImage->xmpPacket();
  272|     28|      xmpPacket.assign(xmpBuf.c_str(), length);
  273|     28|      if (auto idx = xmpPacket.find_first_of('<'); idx != std::string::npos && idx > 0) {
  ------------------
  |  Branch (273:52): [True: 11, False: 17]
  |  Branch (273:80): [True: 10, False: 1]
  ------------------
  274|     10|#ifndef SUPPRESS_WARNINGS
  275|     10|        EXV_WARNING << "Removing " << idx << " characters from the beginning of the XMP packet\n";
  ------------------
  |  |  138|     10|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 10]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     10|  LogMsg(LogMsg::warn).os()
  ------------------
  276|     10|#endif
  277|     10|        xmpPacket = xmpPacket.substr(idx);
  278|     10|      }
  279|     28|      if (XmpParser::decode(pImage->xmpData(), xmpPacket, dp)) {
  ------------------
  |  Branch (279:11): [True: 28, False: 0]
  ------------------
  280|     28|#ifndef SUPPRESS_WARNINGS
  281|     28|        EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|     28|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 28]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     28|  LogMsg(LogMsg::warn).os()
  ------------------
  282|     28|#endif
  283|     28|      }
  284|     28|    }
  285|     67|  }
  286|       |
  287|       |  // We look if an Adobe XMP string exist.
  288|       |
  289|  6.47k|  if (keySize >= 17 && memcmp("XML:com.adobe.xmp", key, 17) == 0 && pImage->xmpData().empty() && !arr.empty()) {
  ------------------
  |  Branch (289:7): [True: 4.50k, False: 1.97k]
  |  Branch (289:24): [True: 779, False: 3.72k]
  |  Branch (289:69): [True: 712, False: 67]
  |  Branch (289:98): [True: 249, False: 463]
  ------------------
  290|    249|    std::string& xmpPacket = pImage->xmpPacket();
  291|    249|    xmpPacket.assign(arr.c_str(), arr.size());
  292|    249|    if (auto idx = xmpPacket.find_first_of('<'); idx != std::string::npos && idx > 0) {
  ------------------
  |  Branch (292:50): [True: 103, False: 146]
  |  Branch (292:78): [True: 87, False: 16]
  ------------------
  293|     87|#ifndef SUPPRESS_WARNINGS
  294|     87|      EXV_WARNING << "Removing " << idx << " characters "
  ------------------
  |  |  138|     87|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 87]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     87|  LogMsg(LogMsg::warn).os()
  ------------------
  295|      0|                  << "from the beginning of the XMP packet\n";
  296|     87|#endif
  297|     87|      xmpPacket = xmpPacket.substr(idx);
  298|     87|    }
  299|    249|    if (XmpParser::decode(pImage->xmpData(), xmpPacket, dp)) {
  ------------------
  |  Branch (299:9): [True: 234, False: 15]
  ------------------
  300|    234|#ifndef SUPPRESS_WARNINGS
  301|    234|      EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|    234|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 234]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    234|  LogMsg(LogMsg::warn).os()
  ------------------
  302|    234|#endif
  303|    234|    }
  304|    249|  }
  305|       |
  306|       |  // We look if a comments string exist. Note than we use only 'Description' keyword which
  307|       |  // is dedicated to store long comments. 'Comment' keyword is ignored.
  308|       |
  309|  6.47k|  if (keySize >= 11 && memcmp("Description", key, 11) == 0 && pImage->comment().empty()) {
  ------------------
  |  Branch (309:7): [True: 4.78k, False: 1.69k]
  |  Branch (309:7): [True: 153, False: 6.32k]
  |  Branch (309:24): [True: 1.04k, False: 3.74k]
  |  Branch (309:63): [True: 153, False: 888]
  ------------------
  310|    153|    pImage->setComment(std::string(arr.c_str(), arr.size()));
  311|    153|  }
  312|       |
  313|  6.47k|}  // PngChunk::parseChunkContent
_ZN5Exiv28Internal8PngChunk17makeMetadataChunkENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEENS_10MetadataIdE:
  315|    468|std::string PngChunk::makeMetadataChunk(std::string_view metadata, MetadataId type) {
  316|    468|  std::string rawProfile;
  317|       |
  318|    468|  switch (type) {
  ------------------
  |  Branch (318:11): [True: 468, False: 0]
  ------------------
  319|    122|    case mdComment:
  ------------------
  |  Branch (319:5): [True: 122, False: 346]
  ------------------
  320|    122|      return makeUtf8TxtChunk("Description", metadata, true);
  321|     62|    case mdIptc:
  ------------------
  |  Branch (321:5): [True: 62, False: 406]
  ------------------
  322|     62|      rawProfile = writeRawProfile(metadata, "iptc");
  323|     62|      return makeAsciiTxtChunk("Raw profile type iptc", rawProfile, true);
  324|    284|    case mdXmp:
  ------------------
  |  Branch (324:5): [True: 284, False: 184]
  ------------------
  325|    284|      return makeUtf8TxtChunk("XML:com.adobe.xmp", metadata, false);
  326|      0|    case mdExif:
  ------------------
  |  Branch (326:5): [True: 0, False: 468]
  ------------------
  327|      0|    case mdIccProfile:
  ------------------
  |  Branch (327:5): [True: 0, False: 468]
  ------------------
  328|      0|    case mdNone:
  ------------------
  |  Branch (328:5): [True: 0, False: 468]
  ------------------
  329|      0|      return {};
  330|    468|  }
  331|       |
  332|      0|  return {};
  333|       |
  334|    468|}  // PngChunk::makeMetadataChunk
_ZN5Exiv28Internal8PngChunk14zlibUncompressEPKhjRNS_7DataBufE:
  336|    182|void PngChunk::zlibUncompress(const byte* compressedText, unsigned int compressedTextSize, DataBuf& arr) {
  337|    182|  uLongf uncompressedLen = compressedTextSize * 2;  // just a starting point
  338|    182|  int zlibResult = Z_BUF_ERROR;
  339|    182|  int dos = 0;
  340|       |
  341|    321|  while (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (341:10): [True: 228, False: 93]
  ------------------
  342|    228|    arr.alloc(uncompressedLen);
  343|    228|    zlibResult = uncompress(arr.data(), &uncompressedLen, compressedText, compressedTextSize);
  344|    228|    if (zlibResult == Z_OK) {
  ------------------
  |  Branch (344:9): [True: 93, False: 135]
  ------------------
  345|     93|      arr.resize(uncompressedLen);
  346|    135|    } else if (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (346:16): [True: 46, False: 89]
  ------------------
  347|       |      // the uncompressedArray needs to be larger
  348|     46|      uncompressedLen *= 2;
  349|       |      // DoS protection. can't be bigger than 64k
  350|     46|      if (uncompressedLen > 131072) {
  ------------------
  |  Branch (350:11): [True: 1, False: 45]
  ------------------
  351|      1|        if (++dos > 1)
  ------------------
  |  Branch (351:13): [True: 0, False: 1]
  ------------------
  352|      0|          break;
  353|      1|        uncompressedLen = 131072;
  354|      1|      }
  355|     89|    } else {
  356|       |      // something bad happened
  357|     89|      throw Error(ErrorCode::kerFailedToReadImageData);
  358|     89|    }
  359|    228|  }
  360|       |
  361|     93|  if (zlibResult != Z_OK) {
  ------------------
  |  Branch (361:7): [True: 0, False: 93]
  ------------------
  362|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  363|      0|  }
  364|     93|}  // PngChunk::zlibUncompress
_ZN5Exiv28Internal8PngChunk12zlibCompressENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  366|    184|std::string PngChunk::zlibCompress(std::string_view text) {
  367|    184|  auto compressedLen = static_cast<uLongf>(text.size() * 2);  // just a starting point
  368|    184|  int zlibResult = Z_BUF_ERROR;
  369|       |
  370|    184|  DataBuf arr;
  371|    419|  while (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (371:10): [True: 235, False: 184]
  ------------------
  372|    235|    arr.resize(compressedLen);
  373|    235|    zlibResult = compress2(arr.data(), &compressedLen, reinterpret_cast<const Bytef*>(text.data()),
  374|    235|                           static_cast<uLong>(text.size()), Z_BEST_COMPRESSION);
  375|       |
  376|    235|    switch (zlibResult) {
  377|    184|      case Z_OK:
  ------------------
  |  Branch (377:7): [True: 184, False: 51]
  ------------------
  378|    184|        arr.resize(compressedLen);
  379|    184|        break;
  380|     51|      case Z_BUF_ERROR:
  ------------------
  |  Branch (380:7): [True: 51, False: 184]
  ------------------
  381|       |        // The compressed array needs to be larger
  382|       |#ifdef EXIV2_DEBUG_MESSAGES
  383|       |        std::cout << "Exiv2::PngChunk::parsePngChunk: doubling size for compression.\n";
  384|       |#endif
  385|     51|        compressedLen *= 2;
  386|       |        // DoS protection. Cap max compressed size
  387|     51|        if (compressedLen > 131072)
  ------------------
  |  Branch (387:13): [True: 0, False: 51]
  ------------------
  388|      0|          throw Error(ErrorCode::kerFailedToReadImageData);
  389|     51|        break;
  390|     51|      default:
  ------------------
  |  Branch (390:7): [True: 0, False: 235]
  ------------------
  391|       |        // Something bad happened
  392|      0|        throw Error(ErrorCode::kerFailedToReadImageData);
  393|    235|    }
  394|    235|  }
  395|       |
  396|    184|  return {arr.c_str(), arr.size()};
  397|       |
  398|    184|}  // PngChunk::zlibCompress
_ZN5Exiv28Internal8PngChunk17makeAsciiTxtChunkENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_b:
  400|     62|std::string PngChunk::makeAsciiTxtChunk(std::string_view keyword, std::string_view text, bool compress) {
  401|       |  // Chunk structure: length (4 bytes) + chunk type + chunk data + CRC (4 bytes)
  402|       |  // Length is the size of the chunk data
  403|       |  // CRC is calculated on chunk type + chunk data
  404|       |
  405|       |  // Compressed text chunk using zlib.
  406|       |  // Chunk data format : keyword + 0x00 + compression method (0x00) + compressed text
  407|       |
  408|       |  // Not Compressed text chunk.
  409|       |  // Chunk data format : keyword + 0x00 + text
  410|       |
  411|       |  // Build chunk data, determine chunk type
  412|     62|  auto chunkData = std::string(keyword) + '\0';
  413|     62|  std::string chunkType;
  414|     62|  if (compress) {
  ------------------
  |  Branch (414:7): [True: 62, False: 0]
  ------------------
  415|     62|    chunkData += '\0' + zlibCompress(text);
  416|     62|    chunkType = "zTXt";
  417|     62|  } else {
  418|      0|    chunkData += text;
  419|      0|    chunkType = "tEXt";
  420|      0|  }
  421|       |  // Determine length of the chunk data
  422|     62|  byte length[4];
  423|     62|  ul2Data(length, static_cast<uint32_t>(chunkData.size()), bigEndian);
  424|       |  // Calculate CRC on chunk type and chunk data
  425|     62|  std::string crcData = chunkType + chunkData;
  426|     62|  uLong tmp = crc32(0L, Z_NULL, 0);
  427|     62|  tmp = crc32(tmp, reinterpret_cast<const Bytef*>(crcData.data()), static_cast<uInt>(crcData.size()));
  428|     62|  byte crc[4];
  429|     62|  ul2Data(crc, tmp, bigEndian);
  430|       |  // Assemble the chunk
  431|     62|  return std::string(reinterpret_cast<const char*>(length), 4) + chunkType + chunkData +
  432|     62|         std::string(reinterpret_cast<const char*>(crc), 4);
  433|       |
  434|     62|}  // PngChunk::makeAsciiTxtChunk
_ZN5Exiv28Internal8PngChunk16makeUtf8TxtChunkENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_b:
  436|    406|std::string PngChunk::makeUtf8TxtChunk(std::string_view keyword, std::string_view text, bool compress) {
  437|       |  // Chunk structure: length (4 bytes) + chunk type + chunk data + CRC (4 bytes)
  438|       |  // Length is the size of the chunk data
  439|       |  // CRC is calculated on chunk type + chunk data
  440|       |
  441|       |  // Chunk data format : keyword + 0x00 + compression flag (0x00: uncompressed - 0x01: compressed)
  442|       |  //                     + compression method (0x00: zlib format) + language tag (null) + 0x00
  443|       |  //                     + translated keyword (null) + 0x00 + text (compressed or not)
  444|       |
  445|       |  // Build chunk data, determine chunk type
  446|    406|  auto chunkData = std::string(keyword);
  447|    406|  if (compress) {
  ------------------
  |  Branch (447:7): [True: 122, False: 284]
  ------------------
  448|    122|    static const char flags[] = {0x00, 0x01, 0x00, 0x00, 0x00};
  449|    122|    chunkData += std::string(flags, 5) + zlibCompress(text);
  450|    284|  } else {
  451|    284|    static const char flags[] = {0x00, 0x00, 0x00, 0x00, 0x00};
  452|    284|    chunkData += std::string(flags, 5) + text.data();
  453|    284|  }
  454|       |  // Determine length of the chunk data
  455|    406|  byte length[4];
  456|    406|  ul2Data(length, static_cast<uint32_t>(chunkData.size()), bigEndian);
  457|       |  // Calculate CRC on chunk type and chunk data
  458|    406|  std::string chunkType = "iTXt";
  459|    406|  std::string crcData = chunkType + chunkData;
  460|    406|  uLong tmp = crc32(0L, Z_NULL, 0);
  461|    406|  tmp = crc32(tmp, reinterpret_cast<const Bytef*>(crcData.data()), static_cast<uInt>(crcData.size()));
  462|    406|  byte crc[4];
  463|    406|  ul2Data(crc, tmp, bigEndian);
  464|       |  // Assemble the chunk
  465|    406|  return std::string(reinterpret_cast<const char*>(length), 4) + chunkType + chunkData +
  466|    406|         std::string(reinterpret_cast<const char*>(crc), 4);
  467|       |
  468|    406|}  // PngChunk::makeUtf8TxtChunk
_ZN5Exiv28Internal8PngChunk14readRawProfileERKNS_7DataBufEb:
  470|  1.44k|DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) {
  471|  1.44k|  DataBuf info;
  472|  1.44k|  if (text.size() <= 1) {
  ------------------
  |  Branch (472:7): [True: 95, False: 1.34k]
  ------------------
  473|     95|    return info;
  474|     95|  }
  475|       |
  476|  1.34k|  const unsigned char unhex[103] = {
  477|  1.34k|      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0,  0,  0,  0,  0, 0,
  478|  1.34k|      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0,  0,  0,  0,  0,  0,  0, 0,
  479|  1.34k|      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15,
  480|  1.34k|  };
  481|       |
  482|  1.34k|  if (iTXt) {
  ------------------
  |  Branch (482:7): [True: 0, False: 1.34k]
  ------------------
  483|      0|    info.alloc(text.size());
  484|      0|    std::copy(text.begin(), text.end(), info.begin());
  485|      0|    return info;
  486|      0|  }
  487|       |
  488|  1.34k|  const char* sp = text.c_str(1);                 // current byte (space pointer)
  489|  1.34k|  const char* eot = text.c_str(text.size() - 1);  // end of text
  490|       |
  491|  1.34k|  if (sp >= eot) {
  ------------------
  |  Branch (491:7): [True: 66, False: 1.28k]
  ------------------
  492|     66|    return info;
  493|     66|  }
  494|       |
  495|       |  // Look for newline
  496|  12.8k|  while (*sp != '\n') {
  ------------------
  |  Branch (496:10): [True: 11.6k, False: 1.12k]
  ------------------
  497|  11.6k|    sp++;
  498|  11.6k|    if (sp == eot) {
  ------------------
  |  Branch (498:9): [True: 156, False: 11.5k]
  ------------------
  499|    156|      return info;
  500|    156|    }
  501|  11.6k|  }
  502|  1.12k|  sp++;  // step over '\n'
  503|  1.12k|  if (sp == eot) {
  ------------------
  |  Branch (503:7): [True: 149, False: 975]
  ------------------
  504|    149|    return info;
  505|    149|  }
  506|       |
  507|       |  // Look for length
  508|  3.53k|  while (*sp == '\0' || *sp == ' ' || *sp == '\n') {
  ------------------
  |  Branch (508:10): [True: 909, False: 2.62k]
  |  Branch (508:25): [True: 776, False: 1.85k]
  |  Branch (508:39): [True: 893, False: 960]
  ------------------
  509|  2.57k|    sp++;
  510|  2.57k|    if (sp == eot) {
  ------------------
  |  Branch (510:9): [True: 15, False: 2.56k]
  ------------------
  511|     15|      return info;
  512|     15|    }
  513|  2.57k|  }
  514|       |
  515|       |  // Parse the length.
  516|    960|  size_t length = 0;
  517|  2.05k|  while ('0' <= *sp && *sp <= '9') {
  ------------------
  |  Branch (517:10): [True: 1.61k, False: 440]
  |  Branch (517:24): [True: 1.11k, False: 506]
  ------------------
  518|       |    // Compute the new length using unsigned long, so that we can check for overflow.
  519|  1.11k|    const size_t newlength = (10 * length) + (*sp - '0');
  520|  1.11k|    length = newlength;
  521|  1.11k|    sp++;
  522|  1.11k|    if (sp == eot) {
  ------------------
  |  Branch (522:9): [True: 14, False: 1.09k]
  ------------------
  523|     14|      return info;
  524|     14|    }
  525|  1.11k|  }
  526|    946|  sp++;  // step over '\n'
  527|    946|  if (sp == eot) {
  ------------------
  |  Branch (527:7): [True: 237, False: 709]
  ------------------
  528|    237|    return info;
  529|    237|  }
  530|       |
  531|    709|  enforce(length <= static_cast<size_t>(eot - sp) / 2, Exiv2::ErrorCode::kerCorruptedMetadata);
  532|       |
  533|       |  // Allocate space
  534|    709|  if (length == 0) {
  ------------------
  |  Branch (534:7): [True: 140, False: 569]
  ------------------
  535|       |#ifdef EXIV2_DEBUG_MESSAGES
  536|       |    std::cerr << "Exiv2::PngChunk::readRawProfile: Unable To Copy Raw Profile: invalid profile length\n";
  537|       |#endif
  538|    140|  }
  539|    709|  info.alloc(length);
  540|    709|  if (info.size() != length) {
  ------------------
  |  Branch (540:7): [True: 0, False: 709]
  ------------------
  541|       |#ifdef EXIV2_DEBUG_MESSAGES
  542|       |    std::cerr << "Exiv2::PngChunk::readRawProfile: Unable To Copy Raw Profile: cannot allocate memory\n";
  543|       |#endif
  544|      0|    return info;
  545|      0|  }
  546|       |
  547|    709|  if (info.empty())  // Early return
  ------------------
  |  Branch (547:7): [True: 140, False: 569]
  ------------------
  548|    140|    return info;
  549|       |
  550|       |  // Copy profile, skipping white space and column 1 "=" signs
  551|    569|  unsigned char* dp = info.data();  // decode pointer
  552|    569|  size_t nibbles = length * 2;
  553|       |
  554|  6.94k|  for (size_t i = 0; i < nibbles; i++) {
  ------------------
  |  Branch (554:22): [True: 6.41k, False: 536]
  ------------------
  555|  6.41k|    enforce(sp < eot, Exiv2::ErrorCode::kerCorruptedMetadata);
  556|  16.5k|    while (*sp < '0' || (*sp > '9' && *sp < 'a') || *sp > 'f') {
  ------------------
  |  Branch (556:12): [True: 4.96k, False: 11.5k]
  |  Branch (556:26): [True: 6.75k, False: 4.81k]
  |  Branch (556:39): [True: 2.57k, False: 4.18k]
  |  Branch (556:53): [True: 2.64k, False: 6.35k]
  ------------------
  557|  10.1k|      if (*sp == '\0') {
  ------------------
  |  Branch (557:11): [True: 33, False: 10.1k]
  ------------------
  558|       |#ifdef EXIV2_DEBUG_MESSAGES
  559|       |        std::cerr << "Exiv2::PngChunk::readRawProfile: Unable To Copy Raw Profile: ran out of data\n";
  560|       |#endif
  561|     33|        return {};
  562|     33|      }
  563|       |
  564|  10.1k|      sp++;
  565|  10.1k|      enforce(sp < eot, Exiv2::ErrorCode::kerCorruptedMetadata);
  566|  10.1k|    }
  567|       |
  568|  6.37k|    if (i % 2 == 0)
  ------------------
  |  Branch (568:9): [True: 3.19k, False: 3.18k]
  ------------------
  569|  3.19k|      *dp = static_cast<unsigned char>(16 * unhex[static_cast<size_t>(*sp++)]);
  570|  3.18k|    else
  571|  3.18k|      (*dp++) += unhex[static_cast<size_t>(*sp++)];
  572|  6.37k|  }
  573|       |
  574|    536|  return info;
  575|       |
  576|    569|}  // PngChunk::readRawProfile
_ZN5Exiv28Internal8PngChunk15writeRawProfileENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEPKc:
  578|     62|std::string PngChunk::writeRawProfile(std::string_view profileData, const char* profileType) {
  579|     62|  static const byte hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
  580|       |
  581|     62|  auto ss = stringFormat("\n{}\n{:08}", profileType, profileData.size());
  ------------------
  |  |   18|     62|#define stringFormat std::format
  ------------------
  582|     62|  auto sp = reinterpret_cast<const byte*>(profileData.data());
  583|   364k|  for (std::string::size_type i = 0; i < profileData.size(); ++i) {
  ------------------
  |  Branch (583:38): [True: 364k, False: 62]
  ------------------
  584|   364k|    if (i % 36 == 0)
  ------------------
  |  Branch (584:9): [True: 10.1k, False: 353k]
  ------------------
  585|  10.1k|      ss += '\n';
  586|   364k|    ss += hex[*sp >> 4 & 0x0fU];
  587|   364k|    ss += hex[*sp++ & 0x0fU];
  588|   364k|  }
  589|     62|  ss += '\n';
  590|     62|  return ss;
  591|       |
  592|     62|}  // PngChunk::writeRawProfile

_ZN5Exiv28PngImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   56|  1.46k|    Image(ImageType::png, mdExif | mdIptc | mdXmp | mdComment, std::move(io), params) {
   57|  1.46k|  if (params.create() && io_->open() == 0) {
  ------------------
  |  Branch (57:7): [True: 317, False: 1.14k]
  |  Branch (57:26): [True: 317, False: 0]
  ------------------
   58|       |#ifdef EXIV2_DEBUG_MESSAGES
   59|       |    std::cerr << "Exiv2::PngImage:: Creating PNG image to memory\n";
   60|       |#endif
   61|    317|    IoCloser closer(*io_);
   62|    317|    if (io_->write(pngBlank, sizeof(pngBlank)) != sizeof(pngBlank)) {
  ------------------
  |  Branch (62:9): [True: 0, False: 317]
  ------------------
   63|       |#ifdef EXIV2_DEBUG_MESSAGES
   64|       |      std::cerr << "Exiv2::PngImage:: Failed to create PNG image on memory\n";
   65|       |#endif
   66|      0|    }
   67|    317|  }
   68|  1.46k|}
_ZN5Exiv28PngImage12readMetadataEv:
  392|  1.14k|void PngImage::readMetadata() {
  393|       |#ifdef EXIV2_DEBUG_MESSAGES
  394|       |  std::cerr << "Exiv2::PngImage::readMetadata: Reading PNG file " << io_->path() << '\n';
  395|       |#endif
  396|  1.14k|  if (io_->open() != 0) {
  ------------------
  |  Branch (396:7): [True: 0, False: 1.14k]
  ------------------
  397|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  398|      0|  }
  399|  1.14k|  IoCloser closer(*io_);
  400|  1.14k|  if (!isPngType(*io_, true)) {
  ------------------
  |  Branch (400:7): [True: 0, False: 1.14k]
  ------------------
  401|      0|    throw Error(ErrorCode::kerNotAnImage, "PNG");
  402|      0|  }
  403|  1.14k|  clearMetadata();
  404|       |
  405|  1.14k|  const size_t imgSize = io_->size();
  406|  1.14k|  DataBuf cheaderBuf(8);  // Chunk header: 4 bytes (data size) + 4 bytes (chunk type).
  407|  1.14k|  const DecodeParams dp(max_recursion_depth_);
  408|       |
  409|  18.8k|  while (!io_->eof()) {
  ------------------
  |  Branch (409:10): [True: 18.3k, False: 521]
  ------------------
  410|  18.3k|    readChunk(cheaderBuf, *io_);  // Read chunk header.
  411|       |
  412|       |    // Decode chunk data length.
  413|  18.3k|    uint32_t chunkLength = cheaderBuf.read_uint32(0, Exiv2::bigEndian);
  414|  18.3k|    if (chunkLength > imgSize - io_->tell()) {
  ------------------
  |  Branch (414:9): [True: 251, False: 18.1k]
  ------------------
  415|    251|      throw Exiv2::Error(ErrorCode::kerFailedToReadImageData);
  416|    251|    }
  417|       |
  418|  18.1k|    std::string chunkType(cheaderBuf.c_str(4), 4);
  419|       |#ifdef EXIV2_DEBUG_MESSAGES
  420|       |    std::cout << "Exiv2::PngImage::readMetadata: chunk type: " << chunkType << " length: " << chunkLength << '\n';
  421|       |#endif
  422|       |
  423|       |    /// \todo analyse remaining chunks of the standard
  424|       |    // Perform a chunk triage for item that we need.
  425|  18.1k|    if (chunkType == "IEND" || chunkType == "IHDR" || chunkType == "tEXt" || chunkType == "zTXt" ||
  ------------------
  |  Branch (425:9): [True: 246, False: 17.8k]
  |  Branch (425:32): [True: 2.18k, False: 15.6k]
  |  Branch (425:55): [True: 2.90k, False: 12.7k]
  |  Branch (425:78): [True: 314, False: 12.4k]
  ------------------
  426|  12.4k|        chunkType == "eXIf" || chunkType == "iTXt" || chunkType == "iCCP") {
  ------------------
  |  Branch (426:9): [True: 42, False: 12.4k]
  |  Branch (426:32): [True: 3.94k, False: 8.46k]
  |  Branch (426:55): [True: 447, False: 8.02k]
  ------------------
  427|  10.0k|      DataBuf chunkData(chunkLength);
  428|  10.0k|      if (chunkLength > 0) {
  ------------------
  |  Branch (428:11): [True: 7.75k, False: 2.26k]
  ------------------
  429|  7.75k|        readChunk(chunkData, *io_);  // Extract chunk data.
  430|  7.75k|      }
  431|       |
  432|  10.0k|      if (chunkType == "IEND") {
  ------------------
  |  Branch (432:11): [True: 188, False: 9.83k]
  ------------------
  433|    188|        return;  // Last chunk found: we stop parsing.
  434|    188|      }
  435|  9.83k|      if (chunkType == "IHDR" && chunkData.size() >= 8) {
  ------------------
  |  Branch (435:11): [True: 2.18k, False: 7.65k]
  |  Branch (435:34): [True: 103, False: 2.08k]
  ------------------
  436|    103|        PngChunk::decodeIHDRChunk(chunkData, &pixelWidth_, &pixelHeight_);
  437|  9.73k|      } else if (chunkType == "tEXt") {
  ------------------
  |  Branch (437:18): [True: 2.90k, False: 6.82k]
  ------------------
  438|  2.90k|        PngChunk::decodeTXTChunk(this, chunkData, PngChunk::tEXt_Chunk, dp);
  439|  6.82k|      } else if (chunkType == "zTXt") {
  ------------------
  |  Branch (439:18): [True: 314, False: 6.51k]
  ------------------
  440|    314|        PngChunk::decodeTXTChunk(this, chunkData, PngChunk::zTXt_Chunk, dp);
  441|  6.51k|      } else if (chunkType == "iTXt") {
  ------------------
  |  Branch (441:18): [True: 3.94k, False: 2.57k]
  ------------------
  442|  3.94k|        PngChunk::decodeTXTChunk(this, chunkData, PngChunk::iTXt_Chunk, dp);
  443|  3.94k|      } else if (chunkType == "eXIf") {
  ------------------
  |  Branch (443:18): [True: 42, False: 2.52k]
  ------------------
  444|     42|        ByteOrder bo = TiffParser::decode(exifData(), iptcData(), xmpData(), chunkData.c_data(), chunkData.size(), dp);
  445|     42|        setByteOrder(bo);
  446|  2.52k|      } else if (chunkType == "iCCP") {
  ------------------
  |  Branch (446:18): [True: 447, False: 2.08k]
  ------------------
  447|       |        // The ICC profile name can vary from 1-79 characters.
  448|    447|        uint32_t iccOffset = 0;
  449|  3.45k|        do {
  450|  3.45k|          enforce(iccOffset < 80 && iccOffset < chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
  ------------------
  |  Branch (450:19): [True: 3.45k, False: 5]
  |  Branch (450:37): [True: 3.44k, False: 11]
  ------------------
  451|  3.45k|        } while (chunkData.read_uint8(iccOffset++) != 0x00);
  ------------------
  |  Branch (451:18): [True: 3.01k, False: 447]
  ------------------
  452|       |
  453|    447|        profileName_ = std::string(chunkData.c_str(), iccOffset - 1);
  454|    447|        ++iccOffset;  // +1 = 'compressed' flag
  455|    447|        enforce(iccOffset <= chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
  456|       |
  457|    447|        zlibToDataBuf(chunkData.c_data(iccOffset), static_cast<uLongf>(chunkLength - iccOffset), iccProfile_);
  458|       |#ifdef EXIV2_DEBUG_MESSAGES
  459|       |        std::cout << "Exiv2::PngImage::readMetadata: profile name: " << profileName_ << '\n';
  460|       |        std::cout << "Exiv2::PngImage::readMetadata: iccProfile.size_ (uncompressed) : " << iccProfile_.size() << '\n';
  461|       |#endif
  462|    447|      }
  463|       |
  464|       |      // Set chunkLength to 0 in case we have read a supported chunk type. Otherwise, we need to seek the
  465|       |      // file to the next chunk position.
  466|  9.83k|      chunkLength = 0;
  467|  9.83k|    }
  468|       |
  469|       |    // Move to the next chunk: chunk data size + 4 CRC bytes.
  470|       |#ifdef EXIV2_DEBUG_MESSAGES
  471|       |    std::cout << "Exiv2::PngImage::readMetadata: Seek to offset: " << chunkLength + 4 << '\n';
  472|       |#endif
  473|  17.9k|    io_->seek(chunkLength + 4, BasicIo::cur);
  474|  17.9k|    if (io_->error() || io_->eof()) {
  ------------------
  |  Branch (474:9): [True: 521, False: 17.3k]
  |  Branch (474:25): [True: 183, False: 17.2k]
  ------------------
  475|    183|      throw Error(ErrorCode::kerFailedToReadImageData);
  476|    183|    }
  477|  17.9k|  }
  478|  1.14k|}  // PngImage::readMetadata
_ZN5Exiv28PngImage13writeMetadataEv:
  480|    462|void PngImage::writeMetadata() {
  481|    462|  if (io_->open() != 0) {
  ------------------
  |  Branch (481:7): [True: 0, False: 462]
  ------------------
  482|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  483|      0|  }
  484|    462|  IoCloser closer(*io_);
  485|    462|  MemIo tempIo;
  486|       |
  487|    462|  doWriteMetadata(tempIo);  // may throw
  488|    462|  io_->close();
  489|    462|  io_->transfer(tempIo);  // may throw
  490|       |
  491|    462|}  // PngImage::writeMetadata
_ZN5Exiv28PngImage15doWriteMetadataERNS_7BasicIoE:
  493|    462|void PngImage::doWriteMetadata(BasicIo& outIo) {
  494|    462|  if (!io_->isopen())
  ------------------
  |  Branch (494:7): [True: 0, False: 462]
  ------------------
  495|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  496|    462|  if (!outIo.isopen())
  ------------------
  |  Branch (496:7): [True: 0, False: 462]
  ------------------
  497|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  498|       |
  499|       |#ifdef EXIV2_DEBUG_MESSAGES
  500|       |  std::cout << "Exiv2::PngImage::doWriteMetadata: Writing PNG file " << io_->path() << "\n";
  501|       |  std::cout << "Exiv2::PngImage::doWriteMetadata: tmp file created " << outIo.path() << "\n";
  502|       |#endif
  503|       |
  504|    462|  if (!isPngType(*io_, true)) {
  ------------------
  |  Branch (504:7): [True: 0, False: 462]
  ------------------
  505|      0|    throw Error(ErrorCode::kerNoImageInInputData);
  506|      0|  }
  507|       |
  508|       |  // Write PNG Signature.
  509|    462|  if (outIo.write(pngSignature.data(), 8) != 8)
  ------------------
  |  Branch (509:7): [True: 0, False: 462]
  ------------------
  510|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  511|       |
  512|    462|  DataBuf cheaderBuf(8);  // Chunk header : 4 bytes (data size) + 4 bytes (chunk type).
  513|       |
  514|  5.01k|  while (!io_->eof()) {
  ------------------
  |  Branch (514:10): [True: 5.01k, False: 3]
  ------------------
  515|       |    // Read chunk header.
  516|  5.01k|    size_t bufRead = io_->read(cheaderBuf.data(), 8);
  517|  5.01k|    if (io_->error())
  ------------------
  |  Branch (517:9): [True: 0, False: 5.01k]
  ------------------
  518|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  519|  5.01k|    if (bufRead != 8)
  ------------------
  |  Branch (519:9): [True: 0, False: 5.01k]
  ------------------
  520|      0|      throw Error(ErrorCode::kerInputDataReadFailed);
  521|       |
  522|       |    // Decode chunk data length.
  523|       |
  524|  5.01k|    uint32_t dataOffset = cheaderBuf.read_uint32(0, Exiv2::bigEndian);
  525|  5.01k|    if (dataOffset > 0x7FFFFFFF)
  ------------------
  |  Branch (525:9): [True: 0, False: 5.01k]
  ------------------
  526|      0|      throw Exiv2::Error(ErrorCode::kerFailedToReadImageData);
  527|       |
  528|       |    // Read whole chunk : Chunk header + Chunk data (not fixed size - can be null) + CRC (4 bytes).
  529|       |
  530|  5.01k|    DataBuf chunkBuf(8 + dataOffset + 4);  // Chunk header (8 bytes) + Chunk data + CRC (4 bytes).
  531|  5.01k|    std::copy(cheaderBuf.begin(), cheaderBuf.end(), chunkBuf.begin());  // Copy header.
  532|  5.01k|    bufRead = io_->read(chunkBuf.data(8), dataOffset + 4);              // Extract chunk data + CRC
  533|  5.01k|    if (io_->error())
  ------------------
  |  Branch (533:9): [True: 0, False: 5.01k]
  ------------------
  534|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  535|  5.01k|    if (bufRead != dataOffset + 4)
  ------------------
  |  Branch (535:9): [True: 72, False: 4.94k]
  ------------------
  536|     72|      throw Error(ErrorCode::kerInputDataReadFailed);
  537|       |
  538|  4.94k|    const std::string szChunk(cheaderBuf.begin() + 4, cheaderBuf.end());
  539|       |
  540|  4.94k|    if (szChunk == "IEND") {
  ------------------
  |  Branch (540:9): [True: 387, False: 4.55k]
  ------------------
  541|       |      // Last chunk found: we write it and done.
  542|       |#ifdef EXIV2_DEBUG_MESSAGES
  543|       |      std::cout << "Exiv2::PngImage::doWriteMetadata: Write IEND chunk (length: " << dataOffset << ")\n";
  544|       |#endif
  545|    387|      if (outIo.write(chunkBuf.data(), chunkBuf.size()) != chunkBuf.size())
  ------------------
  |  Branch (545:11): [True: 0, False: 387]
  ------------------
  546|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  547|    387|      return;
  548|    387|    }
  549|  4.55k|    if (szChunk == "eXIf" || szChunk == "iCCP") {
  ------------------
  |  Branch (549:9): [True: 20, False: 4.53k]
  |  Branch (549:30): [True: 34, False: 4.50k]
  ------------------
  550|       |      // do nothing (strip): Exif metadata is written following IHDR
  551|       |      // together with the ICC profile as fresh eXIf and iCCP chunks
  552|       |#ifdef EXIV2_DEBUG_MESSAGES
  553|       |      std::cout << "Exiv2::PngImage::doWriteMetadata: strip " << szChunk << " chunk (length: " << dataOffset << ")"
  554|       |                << '\n';
  555|       |#endif
  556|  4.50k|    } else if (szChunk == "IHDR") {
  ------------------
  |  Branch (556:16): [True: 803, False: 3.69k]
  ------------------
  557|       |#ifdef EXIV2_DEBUG_MESSAGES
  558|       |      std::cout << "Exiv2::PngImage::doWriteMetadata: Write IHDR chunk (length: " << dataOffset << ")\n";
  559|       |#endif
  560|    803|      if (outIo.write(chunkBuf.data(), chunkBuf.size()) != chunkBuf.size())
  ------------------
  |  Branch (560:11): [True: 0, False: 803]
  ------------------
  561|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  562|       |
  563|       |      // Write all updated metadata here, just after IHDR.
  564|    803|      if (!comment_.empty()) {
  ------------------
  |  Branch (564:11): [True: 122, False: 681]
  ------------------
  565|       |        // Update Comment data to a new PNG chunk
  566|    122|        std::string chunk = PngChunk::makeMetadataChunk(comment_, mdComment);
  567|    122|        if (outIo.write(reinterpret_cast<const byte*>(chunk.data()), chunk.size()) != chunk.size()) {
  ------------------
  |  Branch (567:13): [True: 0, False: 122]
  ------------------
  568|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  569|      0|        }
  570|    122|      }
  571|       |
  572|    803|      if (!exifData_.empty()) {
  ------------------
  |  Branch (572:11): [True: 202, False: 601]
  ------------------
  573|       |        // Update Exif data to a new PNG chunk
  574|    202|        Blob blob;
  575|    202|        ExifParser::encode(blob, littleEndian, exifData_);
  576|    202|        if (!blob.empty()) {
  ------------------
  |  Branch (576:13): [True: 185, False: 17]
  ------------------
  577|    185|          byte length[4];
  578|    185|          ul2Data(length, static_cast<uint32_t>(blob.size()), bigEndian);
  579|       |
  580|       |          // calculate CRC
  581|    185|          uLong tmp = crc32(0L, Z_NULL, 0);
  582|    185|          tmp = crc32(tmp, typeExif, 4);
  583|    185|          tmp = crc32(tmp, blob.data(), static_cast<uint32_t>(blob.size()));
  584|    185|          byte crc[4];
  585|    185|          ul2Data(crc, tmp, bigEndian);
  586|       |
  587|    185|          if (outIo.write(length, 4) != 4 || outIo.write(typeExif, 4) != 4 ||
  ------------------
  |  Branch (587:15): [True: 0, False: 185]
  |  Branch (587:46): [True: 0, False: 185]
  ------------------
  588|    185|              outIo.write(blob.data(), blob.size()) != blob.size() || outIo.write(crc, 4) != 4) {
  ------------------
  |  Branch (588:15): [True: 0, False: 185]
  |  Branch (588:71): [True: 0, False: 185]
  ------------------
  589|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  590|      0|          }
  591|       |#ifdef EXIV2_DEBUG_MESSAGES
  592|       |          std::cout << "Exiv2::PngImage::doWriteMetadata: build eXIf"
  593|       |                    << " chunk (length: " << blob.size() << ")" << '\n';
  594|       |#endif
  595|    185|        }
  596|    202|      }
  597|       |
  598|    803|      if (!iptcData_.empty()) {
  ------------------
  |  Branch (598:11): [True: 62, False: 741]
  ------------------
  599|       |        // Update IPTC data to a new PNG chunk
  600|     62|        DataBuf newPsData = Photoshop::setIptcIrb(nullptr, 0, iptcData_);
  601|     62|        if (!newPsData.empty()) {
  ------------------
  |  Branch (601:13): [True: 62, False: 0]
  ------------------
  602|     62|          std::string rawIptc(newPsData.c_str(), newPsData.size());
  603|     62|          std::string chunk = PngChunk::makeMetadataChunk(rawIptc, mdIptc);
  604|     62|          if (outIo.write(reinterpret_cast<const byte*>(chunk.data()), chunk.size()) != chunk.size()) {
  ------------------
  |  Branch (604:15): [True: 0, False: 62]
  ------------------
  605|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  606|      0|          }
  607|     62|        }
  608|     62|      }
  609|       |
  610|    803|      if (iccProfileDefined()) {
  ------------------
  |  Branch (610:11): [True: 49, False: 754]
  ------------------
  611|     49|        DataBuf compressed;
  612|     49|        enforce(iccProfile_.size() <= std::numeric_limits<uLongf>::max(), ErrorCode::kerCorruptedMetadata);
  613|     49|        if (zlibToCompressed(iccProfile_.c_data(), static_cast<uLongf>(iccProfile_.size()), compressed)) {
  ------------------
  |  Branch (613:13): [True: 49, False: 0]
  ------------------
  614|     49|          const auto nameLength = static_cast<uint32_t>(profileName_.size());
  615|     49|          const uint32_t chunkLength = nameLength + 2 + static_cast<uint32_t>(compressed.size());
  616|     49|          byte length[4];
  617|     49|          ul2Data(length, chunkLength, bigEndian);
  618|       |
  619|       |          // calculate CRC
  620|     49|          uLong tmp = crc32(0L, Z_NULL, 0);
  621|     49|          tmp = crc32(tmp, typeICCP, 4);
  622|     49|          tmp = crc32(tmp, reinterpret_cast<const Bytef*>(profileName_.data()), nameLength);
  623|     49|          tmp = crc32(tmp, nullComp, 2);
  624|     49|          tmp = crc32(tmp, compressed.c_data(), static_cast<uint32_t>(compressed.size()));
  625|     49|          byte crc[4];
  626|     49|          ul2Data(crc, tmp, bigEndian);
  627|       |
  628|     49|          if (outIo.write(length, 4) != 4 || outIo.write(typeICCP, 4) != 4 ||
  ------------------
  |  Branch (628:15): [True: 0, False: 49]
  |  Branch (628:46): [True: 0, False: 49]
  ------------------
  629|     49|              outIo.write(reinterpret_cast<const byte*>(profileName_.data()), nameLength) != nameLength ||
  ------------------
  |  Branch (629:15): [True: 0, False: 49]
  ------------------
  630|     49|              outIo.write(nullComp, 2) != 2 ||
  ------------------
  |  Branch (630:15): [True: 0, False: 49]
  ------------------
  631|     49|              outIo.write(compressed.c_data(), compressed.size()) != compressed.size() || outIo.write(crc, 4) != 4) {
  ------------------
  |  Branch (631:15): [True: 0, False: 49]
  |  Branch (631:91): [True: 0, False: 49]
  ------------------
  632|      0|            throw Error(ErrorCode::kerImageWriteFailed);
  633|      0|          }
  634|       |#ifdef EXIV2_DEBUG_MESSAGES
  635|       |          std::cout << "Exiv2::PngImage::doWriteMetadata: build iCCP"
  636|       |                    << " chunk (length: " << chunkLength << ")" << '\n';
  637|       |#endif
  638|     49|        }
  639|     49|      }
  640|       |
  641|    803|      if (!writeXmpFromPacket() && XmpParser::encode(xmpPacket_, xmpData_) > 1) {
  ------------------
  |  Branch (641:11): [True: 800, False: 3]
  |  Branch (641:36): [True: 29, False: 771]
  ------------------
  642|     29|#ifndef SUPPRESS_WARNINGS
  643|     29|        EXV_ERROR << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  142|     29|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 29]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|     29|  LogMsg(LogMsg::error).os()
  ------------------
  644|     29|#endif
  645|     29|      }
  646|    803|      if (!xmpPacket_.empty()) {
  ------------------
  |  Branch (646:11): [True: 284, False: 519]
  ------------------
  647|       |        // Update XMP data to a new PNG chunk
  648|    284|        std::string chunk = PngChunk::makeMetadataChunk(xmpPacket_, mdXmp);
  649|    284|        if (outIo.write(reinterpret_cast<const byte*>(chunk.data()), chunk.size()) != chunk.size()) {
  ------------------
  |  Branch (649:13): [True: 0, False: 284]
  ------------------
  650|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  651|      0|        }
  652|    284|      }
  653|  3.69k|    } else if (szChunk == "tEXt" || szChunk == "zTXt" || szChunk == "iTXt") {
  ------------------
  |  Branch (653:16): [True: 1.24k, False: 2.45k]
  |  Branch (653:37): [True: 13, False: 2.43k]
  |  Branch (653:58): [True: 192, False: 2.24k]
  ------------------
  654|  1.45k|      DataBuf key = PngChunk::keyTXTChunk(chunkBuf, true);
  655|  1.45k|      if (!key.empty() && (compare("Raw profile type exif", key) || compare("Raw profile type APP1", key) ||
  ------------------
  |  Branch (655:11): [True: 1.32k, False: 125]
  |  Branch (655:28): [True: 57, False: 1.27k]
  |  Branch (655:69): [True: 19, False: 1.25k]
  ------------------
  656|  1.25k|                           compare("Raw profile type iptc", key) || compare("Raw profile type xmp", key) ||
  ------------------
  |  Branch (656:28): [True: 324, False: 927]
  |  Branch (656:69): [True: 7, False: 920]
  ------------------
  657|    920|                           compare("XML:com.adobe.xmp", key) || compare("Description", key))) {
  ------------------
  |  Branch (657:28): [True: 111, False: 809]
  |  Branch (657:65): [True: 130, False: 679]
  ------------------
  658|       |#ifdef EXIV2_DEBUG_MESSAGES
  659|       |        std::cout << "Exiv2::PngImage::doWriteMetadata: strip " << szChunk << " chunk (length: " << dataOffset << ")"
  660|       |                  << '\n';
  661|       |#endif
  662|    804|      } else {
  663|       |#ifdef EXIV2_DEBUG_MESSAGES
  664|       |        std::cout << "Exiv2::PngImage::doWriteMetadata: write " << szChunk << " chunk (length: " << dataOffset << ")"
  665|       |                  << '\n';
  666|       |#endif
  667|    804|        if (outIo.write(chunkBuf.c_data(), chunkBuf.size()) != chunkBuf.size())
  ------------------
  |  Branch (667:13): [True: 0, False: 804]
  ------------------
  668|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  669|    804|      }
  670|  2.24k|    } else {
  671|       |      // Write all others chunk as well.
  672|       |#ifdef EXIV2_DEBUG_MESSAGES
  673|       |      std::cout << "Exiv2::PngImage::doWriteMetadata:  copy " << szChunk << " chunk (length: " << dataOffset << ")"
  674|       |                << '\n';
  675|       |#endif
  676|  2.24k|      if (outIo.write(chunkBuf.c_data(), chunkBuf.size()) != chunkBuf.size())
  ------------------
  |  Branch (676:11): [True: 0, False: 2.24k]
  ------------------
  677|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  678|  2.24k|    }
  679|  4.55k|  }
  680|       |
  681|    462|}  // PngImage::doWriteMetadata
_ZN5Exiv214newPngInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  685|  1.46k|Image::UniquePtr newPngInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  686|  1.46k|  auto image = std::make_unique<PngImage>(std::move(io), params);
  687|  1.46k|  if (!image->good()) {
  ------------------
  |  Branch (687:7): [True: 0, False: 1.46k]
  ------------------
  688|      0|    return nullptr;
  689|      0|  }
  690|  1.46k|  return image;
  691|  1.46k|}
_ZN5Exiv29isPngTypeERNS_7BasicIoEb:
  693|  21.3k|bool isPngType(BasicIo& iIo, bool advance) {
  694|  21.3k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (694:7): [True: 0, False: 21.3k]
  |  Branch (694:22): [True: 200, False: 21.1k]
  ------------------
  695|    200|    throw Error(ErrorCode::kerInputDataReadFailed);
  696|    200|  }
  697|  21.1k|  const int32_t len = 8;
  698|  21.1k|  std::array<byte, len> buf;
  699|  21.1k|  iIo.read(buf.data(), len);
  700|  21.1k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (700:7): [True: 0, False: 21.1k]
  |  Branch (700:22): [True: 0, False: 21.1k]
  ------------------
  701|      0|    return false;
  702|      0|  }
  703|  21.1k|  bool rc = buf == pngSignature;
  704|  21.1k|  if (!advance || !rc) {
  ------------------
  |  Branch (704:7): [True: 19.5k, False: 1.60k]
  |  Branch (704:19): [True: 0, False: 1.60k]
  ------------------
  705|  19.5k|    iIo.seek(-len, BasicIo::cur);
  706|  19.5k|  }
  707|       |
  708|  21.1k|  return rc;
  709|  21.1k|}
pngimage.cpp:_ZN5Exiv2L13zlibToDataBufEPKhmRNS_7DataBufE:
   74|    413|static bool zlibToDataBuf(const byte* bytes, uLongf length, DataBuf& result) {
   75|    413|  uLongf uncompressedLen = length;  // just a starting point
   76|    413|  int zlibResult = Z_BUF_ERROR;
   77|       |
   78|    953|  while (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (78:10): [True: 540, False: 413]
  ------------------
   79|    540|    result.alloc(uncompressedLen);
   80|    540|    zlibResult = uncompress(result.data(), &uncompressedLen, bytes, length);
   81|       |    // if result buffer is large than necessary, redo to fit perfectly.
   82|    540|    if (zlibResult == Z_OK && uncompressedLen < result.size()) {
  ------------------
  |  Branch (82:9): [True: 21, False: 519]
  |  Branch (82:31): [True: 1, False: 20]
  ------------------
   83|      1|      result.reset();
   84|       |
   85|      1|      result.alloc(uncompressedLen);
   86|      1|      zlibResult = uncompress(result.data(), &uncompressedLen, bytes, length);
   87|      1|    }
   88|    540|    if (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (88:9): [True: 127, False: 413]
  ------------------
   89|       |      // the uncompressed buffer needs to be larger
   90|    127|      result.reset();
   91|       |
   92|       |      // Sanity - never bigger than 16mb
   93|    127|      if (uncompressedLen > 16 * 1024 * 1024)
  ------------------
  |  Branch (93:11): [True: 0, False: 127]
  ------------------
   94|      0|        zlibResult = Z_DATA_ERROR;
   95|    127|      else
   96|    127|        uncompressedLen *= 2;
   97|    127|    }
   98|    540|  }
   99|       |
  100|       |  return zlibResult == Z_OK;
  101|    413|}
pngimage.cpp:_ZN5Exiv2L9readChunkERNS_7DataBufERNS_7BasicIoE:
  379|  26.1k|static void readChunk(DataBuf& buffer, BasicIo& io) {
  380|       |#ifdef EXIV2_DEBUG_MESSAGES
  381|       |  std::cout << "Exiv2::PngImage::readMetadata: Position: " << io.tell() << '\n';
  382|       |#endif
  383|  26.1k|  const size_t bufRead = io.read(buffer.data(), buffer.size());
  384|  26.1k|  if (io.error()) {
  ------------------
  |  Branch (384:7): [True: 0, False: 26.1k]
  ------------------
  385|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  386|      0|  }
  387|  26.1k|  if (bufRead != buffer.size()) {
  ------------------
  |  Branch (387:7): [True: 58, False: 26.0k]
  ------------------
  388|     58|    throw Error(ErrorCode::kerInputDataReadFailed);
  389|     58|  }
  390|  26.1k|}
pngimage.cpp:_ZN5Exiv2L16zlibToCompressedEPKhmRNS_7DataBufE:
  103|     49|static bool zlibToCompressed(const byte* bytes, uLongf length, DataBuf& result) {
  104|     49|  uLongf compressedLen = length;  // just a starting point
  105|     49|  int zlibResult = Z_BUF_ERROR;
  106|       |
  107|    186|  while (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (107:10): [True: 137, False: 49]
  ------------------
  108|    137|    result.alloc(compressedLen);
  109|    137|    zlibResult = compress(result.data(), &compressedLen, bytes, length);
  110|    137|    if (zlibResult == Z_BUF_ERROR) {
  ------------------
  |  Branch (110:9): [True: 88, False: 49]
  ------------------
  111|       |      // the compressedArray needs to be larger
  112|     88|      result.reset();
  113|     88|      compressedLen *= 2;
  114|     88|    } else {
  115|     49|      result.reset();
  116|     49|      result.alloc(compressedLen);
  117|     49|      zlibResult = compress(result.data(), &compressedLen, bytes, length);
  118|     49|    }
  119|    137|  }
  120|       |
  121|       |  return zlibResult == Z_OK;
  122|     49|}
pngimage.cpp:_ZN12_GLOBAL__N_17compareENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERKN5Exiv27DataBufE:
   44|  6.50k|bool compare(std::string_view str, const Exiv2::DataBuf& buf) {
   45|  6.50k|  const auto minlen = std::min<size_t>(str.size(), buf.size());
   46|  6.50k|  return buf.cmpBytes(0, str.data(), minlen) == 0;
   47|  6.50k|}

_ZN5Exiv212PreviewImageC2ENS_17PreviewPropertiesEONS_7DataBufE:
  990|  1.37k|    properties_(std::move(properties)), preview_(std::move(data)) {
  991|  1.37k|}
_ZNK5Exiv212PreviewImage5pDataEv:
 1017|  1.37k|const byte* PreviewImage::pData() const {
 1018|  1.37k|  return preview_.c_data();
 1019|  1.37k|}
_ZNK5Exiv212PreviewImage4sizeEv:
 1021|  1.37k|uint32_t PreviewImage::size() const {
 1022|  1.37k|  return static_cast<uint32_t>(preview_.size());
 1023|  1.37k|}
_ZN5Exiv214PreviewManagerC2ERKNS_5ImageE:
 1045|  6.34k|PreviewManager::PreviewManager(const Image& image) : image_(image) {
 1046|  6.34k|}
_ZNK5Exiv214PreviewManager20getPreviewPropertiesEv:
 1048|  6.34k|PreviewPropertiesList PreviewManager::getPreviewProperties() const {
 1049|  6.34k|  PreviewPropertiesList list;
 1050|       |  // go through the loader table and store all successfully created loaders in the list
 1051|   220k|  for (PreviewId id = 0; id < Loader::getNumLoaders(); ++id) {
  ------------------
  |  Branch (1051:26): [True: 213k, False: 6.34k]
  ------------------
 1052|   213k|    auto loader = Loader::create(id, image_);
 1053|   213k|    if (loader && loader->readDimensions()) {
  ------------------
  |  Branch (1053:9): [True: 13.5k, False: 200k]
  |  Branch (1053:19): [True: 7.63k, False: 5.90k]
  ------------------
 1054|  7.63k|      PreviewProperties props = loader->getProperties();
 1055|  7.63k|      DataBuf buf = loader->getData();  // #16 getPreviewImage()
 1056|  7.63k|      props.size_ = buf.size();         //     update the size
 1057|  7.63k|      list.push_back(std::move(props));
 1058|  7.63k|    }
 1059|   213k|  }
 1060|  6.34k|  std::sort(list.begin(), list.end(),
 1061|  6.34k|            [](const auto& lhs, const auto& rhs) { return lhs.width_ * lhs.height_ < rhs.width_ * rhs.height_; });
 1062|       |
 1063|  6.34k|  return list;
 1064|  6.34k|}
_ZNK5Exiv214PreviewManager15getPreviewImageERKNS_17PreviewPropertiesE:
 1066|  1.37k|PreviewImage PreviewManager::getPreviewImage(const PreviewProperties& properties) const {
 1067|  1.37k|  auto loader = Loader::create(properties.id_, image_);
 1068|  1.37k|  DataBuf buf;
 1069|  1.37k|  if (loader) {
  ------------------
  |  Branch (1069:7): [True: 1.37k, False: 0]
  ------------------
 1070|  1.37k|    buf = loader->getData();
 1071|  1.37k|  }
 1072|       |
 1073|  1.37k|  return {properties, std::move(buf)};
 1074|  1.37k|}
preview.cpp:_ZN12_GLOBAL__N_16Loader13getNumLoadersEv:
  350|   435k|PreviewId Loader::getNumLoaders() {
  351|   435k|  return PreviewId{std::size(loaderList_)};
  352|   435k|}
preview.cpp:_ZN12_GLOBAL__N_118createLoaderNativeEiRKN5Exiv25ImageEi:
  368|  25.3k|Loader::UniquePtr createLoaderNative(PreviewId id, const Image& image, int parIdx) {
  369|  25.3k|  return std::make_unique<LoaderNative>(id, image, parIdx);
  370|  25.3k|}
preview.cpp:_ZN12_GLOBAL__N_112LoaderNativeC2EiRKN5Exiv25ImageEi:
  354|  25.3k|LoaderNative::LoaderNative(PreviewId id, const Image& image, int parIdx) : Loader(id, image) {
  355|  25.3k|  if (0 > parIdx || static_cast<size_t>(parIdx) >= image.nativePreviews().size())
  ------------------
  |  Branch (355:7): [True: 0, False: 25.3k]
  |  Branch (355:21): [True: 25.3k, False: 0]
  ------------------
  356|  25.3k|    return;
  357|      0|  nativePreview_ = image.nativePreviews()[parIdx];
  358|      0|  width_ = nativePreview_.width_;
  359|      0|  height_ = nativePreview_.height_;
  360|      0|  valid_ = true;
  361|      0|  if (nativePreview_.filter_.empty()) {
  ------------------
  |  Branch (361:7): [True: 0, False: 0]
  ------------------
  362|      0|    size_ = nativePreview_.size_;
  363|      0|  } else {
  364|      0|    size_ = getData().size();
  365|      0|  }
  366|      0|}
preview.cpp:_ZN12_GLOBAL__N_16LoaderC2EiRKN5Exiv25ImageE:
  343|   202k|Loader::Loader(PreviewId id, const Image& image) : id_(id), image_(image) {
  344|   202k|}
preview.cpp:_ZNK12_GLOBAL__N_16Loader13getPropertiesEv:
  346|  7.63k|PreviewProperties Loader::getProperties() const {
  347|  7.63k|  return {"", "", size_, width_, height_, id_};
  348|  7.63k|}
preview.cpp:_ZN12_GLOBAL__N_16Loader14readDimensionsEv:
   77|  1.43k|  virtual bool readDimensions() {
   78|  1.43k|    return true;
   79|  1.43k|  }
preview.cpp:_ZN12_GLOBAL__N_16LoaderD2Ev:
   54|   202k|  virtual ~Loader() = default;
preview.cpp:_ZNK12_GLOBAL__N_16Loader5validEv:
   66|   222k|  [[nodiscard]] virtual bool valid() const {
   67|   222k|    return valid_;
   68|   222k|  }
preview.cpp:_ZN12_GLOBAL__N_124createLoaderExifDataJpegEiRKN5Exiv25ImageEi:
  568|  76.2k|Loader::UniquePtr createLoaderExifDataJpeg(PreviewId id, const Image& image, int parIdx) {
  569|  76.2k|  return std::make_unique<LoaderExifDataJpeg>(id, image, parIdx);
  570|  76.2k|}
preview.cpp:_ZN12_GLOBAL__N_118LoaderExifDataJpegC2EiRKN5Exiv25ImageEi:
  555|  76.2k|    Loader(id, image), dataKey_(param_[parIdx].dataKey_) {
  556|  76.2k|  if (auto pos = image_.exifData().findKey(dataKey_); pos != image_.exifData().end()) {
  ------------------
  |  Branch (556:55): [True: 215, False: 76.0k]
  ------------------
  557|    215|    size_ = pos->sizeDataArea();  // indirect data
  558|    215|    if (size_ == 0 && pos->typeId() == undefined)
  ------------------
  |  Branch (558:9): [True: 215, False: 0]
  |  Branch (558:23): [True: 145, False: 70]
  ------------------
  559|    145|      size_ = pos->size();  // direct data
  560|    215|  }
  561|       |
  562|  76.2k|  if (size_ == 0)
  ------------------
  |  Branch (562:7): [True: 76.0k, False: 145]
  ------------------
  563|  76.0k|    return;
  564|       |
  565|    145|  valid_ = true;
  566|    145|}
preview.cpp:_ZNK12_GLOBAL__N_118LoaderExifDataJpeg13getPropertiesEv:
  572|     58|PreviewProperties LoaderExifDataJpeg::getProperties() const {
  573|     58|  PreviewProperties prop = Loader::getProperties();
  574|     58|  prop.mimeType_ = "image/jpeg";
  575|     58|  prop.extension_ = ".jpg";
  576|     58|  return prop;
  577|     58|}
preview.cpp:_ZNK12_GLOBAL__N_118LoaderExifDataJpeg7getDataEv:
  579|    203|DataBuf LoaderExifDataJpeg::getData() const {
  580|    203|  DataBuf buf;
  581|       |
  582|    203|  if (!valid())
  ------------------
  |  Branch (582:7): [True: 0, False: 203]
  ------------------
  583|      0|    return buf;
  584|       |
  585|    203|  if (auto pos = image_.exifData().findKey(dataKey_); pos != image_.exifData().end()) {
  ------------------
  |  Branch (585:55): [True: 203, False: 0]
  ------------------
  586|    203|    buf = pos->dataArea();  // indirect data
  587|       |
  588|    203|    if (buf.empty()) {  // direct data
  ------------------
  |  Branch (588:9): [True: 203, False: 0]
  ------------------
  589|    203|      buf = DataBuf(pos->size());
  590|    203|      pos->copy(buf.data(), invalidByteOrder);
  591|    203|    }
  592|       |
  593|    203|    buf.write_uint8(0, 0xff);  // fix Minolta thumbnails with invalid jpeg header
  594|    203|    return buf;
  595|    203|  }
  596|       |
  597|      0|  return buf;
  598|    203|}
preview.cpp:_ZN12_GLOBAL__N_118LoaderExifDataJpeg14readDimensionsEv:
  600|     90|bool LoaderExifDataJpeg::readDimensions() {
  601|     90|  if (!valid())
  ------------------
  |  Branch (601:7): [True: 0, False: 90]
  ------------------
  602|      0|    return false;
  603|       |
  604|     90|  DataBuf buf = getData();
  605|     90|  if (buf.empty())
  ------------------
  |  Branch (605:7): [True: 0, False: 90]
  ------------------
  606|      0|    return false;
  607|       |
  608|     90|  try {
  609|     90|    auto image = ImageFactory::open(buf.c_data(), buf.size());
  610|     90|    if (!image)
  ------------------
  |  Branch (610:9): [True: 0, False: 90]
  ------------------
  611|      0|      return false;
  612|     90|    image->readMetadata();
  613|       |
  614|     90|    width_ = image->pixelWidth();
  615|     90|    height_ = image->pixelHeight();
  616|     90|  } catch (const Error& /* error */) {
  617|     32|    return false;
  618|     32|  }
  619|       |
  620|     58|  return true;
  621|     90|}
preview.cpp:_ZN12_GLOBAL__N_116createLoaderTiffEiRKN5Exiv25ImageEi:
  681|  44.0k|Loader::UniquePtr createLoaderTiff(PreviewId id, const Image& image, int parIdx) {
  682|  44.0k|  return std::make_unique<LoaderTiff>(id, image, parIdx);
  683|  44.0k|}
preview.cpp:_ZN12_GLOBAL__N_110LoaderTiffC2EiRKN5Exiv25ImageEi:
  624|  44.0k|    Loader(id, image), group_(param_[parIdx].group_) {
  625|  44.0k|  const ExifData& exifData = image_.exifData();
  626|       |
  627|  44.0k|  size_t offsetCount = 0;
  628|  44.0k|  ExifData::const_iterator pos;
  629|       |
  630|       |  // check if the group_ contains a preview image
  631|  44.0k|  if (param_[parIdx].checkTag_) {
  ------------------
  |  Branch (631:7): [True: 37.8k, False: 6.23k]
  ------------------
  632|  37.8k|    pos = exifData.findKey(ExifKey(param_[parIdx].checkTag_));
  633|  37.8k|    if (pos == exifData.end())
  ------------------
  |  Branch (633:9): [True: 35.1k, False: 2.70k]
  ------------------
  634|  35.1k|      return;
  635|  2.70k|    if (param_[parIdx].checkValue_ && pos->toString() != param_[parIdx].checkValue_)
  ------------------
  |  Branch (635:9): [True: 2.70k, False: 0]
  |  Branch (635:9): [True: 610, False: 2.09k]
  |  Branch (635:39): [True: 610, False: 2.09k]
  ------------------
  636|    610|      return;
  637|  2.70k|  }
  638|       |
  639|  8.32k|  pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".StripOffsets"));
  640|  8.32k|  if (pos != exifData.end()) {
  ------------------
  |  Branch (640:7): [True: 1.85k, False: 6.46k]
  ------------------
  641|  1.85k|    offsetTag_ = "StripOffsets";
  642|  1.85k|    sizeTag_ = "StripByteCounts";
  643|  1.85k|    offsetCount = pos->value().count();
  644|  6.46k|  } else {
  645|  6.46k|    pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".TileOffsets"));
  646|  6.46k|    if (pos == exifData.end())
  ------------------
  |  Branch (646:9): [True: 6.31k, False: 150]
  ------------------
  647|  6.31k|      return;
  648|    150|    offsetTag_ = "TileOffsets";
  649|    150|    sizeTag_ = "TileByteCounts";
  650|    150|    offsetCount = pos->value().count();
  651|    150|  }
  652|       |
  653|  2.00k|  pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + '.' + sizeTag_));
  654|  2.00k|  if (pos == exifData.end())
  ------------------
  |  Branch (654:7): [True: 66, False: 1.94k]
  ------------------
  655|     66|    return;
  656|  1.94k|  if (offsetCount != pos->value().count())
  ------------------
  |  Branch (656:7): [True: 54, False: 1.88k]
  ------------------
  657|     54|    return;
  658|  12.1k|  for (size_t i = 0; i < offsetCount; i++) {
  ------------------
  |  Branch (658:22): [True: 10.2k, False: 1.88k]
  ------------------
  659|  10.2k|    size_ += pos->toUint32(i);
  660|  10.2k|  }
  661|       |
  662|  1.88k|  if (size_ == 0)
  ------------------
  |  Branch (662:7): [True: 42, False: 1.84k]
  ------------------
  663|     42|    return;
  664|       |
  665|  1.84k|  pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageWidth"));
  666|  1.84k|  if (pos != exifData.end() && pos->count() > 0) {
  ------------------
  |  Branch (666:7): [True: 1.77k, False: 67]
  |  Branch (666:7): [True: 1.68k, False: 155]
  |  Branch (666:32): [True: 1.68k, False: 88]
  ------------------
  667|  1.68k|    width_ = pos->toUint32();
  668|  1.68k|  }
  669|       |
  670|  1.84k|  pos = exifData.findKey(ExifKey(std::string("Exif.") + group_ + ".ImageLength"));
  671|  1.84k|  if (pos != exifData.end() && pos->count() > 0) {
  ------------------
  |  Branch (671:7): [True: 1.69k, False: 148]
  |  Branch (671:7): [True: 1.66k, False: 179]
  |  Branch (671:32): [True: 1.66k, False: 31]
  ------------------
  672|  1.66k|    height_ = pos->toUint32();
  673|  1.66k|  }
  674|       |
  675|  1.84k|  if (width_ == 0 || height_ == 0)
  ------------------
  |  Branch (675:7): [True: 199, False: 1.64k]
  |  Branch (675:22): [True: 90, False: 1.55k]
  ------------------
  676|    238|    return;
  677|       |
  678|  1.60k|  valid_ = true;
  679|  1.60k|}
preview.cpp:_ZNK12_GLOBAL__N_110LoaderTiff13getPropertiesEv:
  685|  1.43k|PreviewProperties LoaderTiff::getProperties() const {
  686|  1.43k|  PreviewProperties prop = Loader::getProperties();
  687|  1.43k|  prop.mimeType_ = "image/tiff";
  688|  1.43k|  prop.extension_ = ".tif";
  689|  1.43k|  return prop;
  690|  1.43k|}
preview.cpp:_ZNK12_GLOBAL__N_110LoaderTiff7getDataEv:
  692|  1.55k|DataBuf LoaderTiff::getData() const {
  693|  1.55k|  const ExifData& exifData = image_.exifData();
  694|       |
  695|  1.55k|  ExifData preview;
  696|       |
  697|       |  // copy tags
  698|   215k|  for (auto&& pos : exifData) {
  ------------------
  |  Branch (698:19): [True: 215k, False: 1.55k]
  ------------------
  699|   215k|    if (pos.groupName() == group_) {
  ------------------
  |  Branch (699:9): [True: 52.1k, False: 162k]
  ------------------
  700|       |      /*
  701|       |         Write only the necessary TIFF image tags
  702|       |         tags that especially could cause problems are:
  703|       |         "NewSubfileType" - the result is no longer a thumbnail, it is a standalone image
  704|       |         "Orientation" - this tag typically appears only in the "Image" group. Deleting it ensures
  705|       |                         consistent result for all previews, including JPEG
  706|       |      */
  707|  52.1k|      uint16_t tag = pos.tag();
  708|  52.1k|      if (tag != 0x00fe && tag != 0x00ff && Internal::isTiffImageTag(tag, IfdId::ifd0Id)) {
  ------------------
  |  Branch (708:11): [True: 50.4k, False: 1.73k]
  |  Branch (708:28): [True: 49.9k, False: 433]
  |  Branch (708:45): [True: 16.6k, False: 33.3k]
  ------------------
  709|  16.6k|        preview.add(ExifKey(tag, "Image"), &pos.value());
  710|  16.6k|      }
  711|  52.1k|    }
  712|   215k|  }
  713|       |
  714|  1.55k|  auto& dataValue = const_cast<Value&>(preview["Exif.Image." + offsetTag_].value());
  715|       |
  716|  1.55k|  if (dataValue.sizeDataArea() == 0) {
  ------------------
  |  Branch (716:7): [True: 1.55k, False: 0]
  ------------------
  717|       |    // image data are not available via exifData, read them from image_.io()
  718|  1.55k|    BasicIo& io = image_.io();
  719|       |
  720|  1.55k|    if (io.open() != 0) {
  ------------------
  |  Branch (720:9): [True: 0, False: 1.55k]
  ------------------
  721|      0|      throw Error(ErrorCode::kerDataSourceOpenFailed, io.path(), strError());
  722|      0|    }
  723|  1.55k|    IoCloser closer(io);
  724|       |
  725|  1.55k|    const Exiv2::byte* base = io.mmap();
  726|       |
  727|  1.55k|    const Value& sizes = preview["Exif.Image." + sizeTag_].value();
  728|       |
  729|  1.55k|    if (sizes.count() == dataValue.count()) {
  ------------------
  |  Branch (729:9): [True: 1.55k, False: 0]
  ------------------
  730|  1.55k|      if (sizes.count() == 1) {
  ------------------
  |  Branch (730:11): [True: 1.37k, False: 178]
  ------------------
  731|       |        // this saves one copying of the buffer
  732|  1.37k|        uint32_t offset = dataValue.toUint32(0);
  733|  1.37k|        uint32_t size = sizes.toUint32(0);
  734|  1.37k|        if (Safe::add(offset, size) <= static_cast<uint32_t>(io.size()))
  ------------------
  |  Branch (734:13): [True: 217, False: 1.16k]
  ------------------
  735|    217|          dataValue.setDataArea(base + offset, size);
  736|  1.37k|      } else {
  737|       |        // FIXME: the buffer is probably copied twice, it should be optimized
  738|    178|        Internal::enforce(size_ <= io.size(), ErrorCode::kerCorruptedMetadata);
  739|    178|        DataBuf buf(size_);
  740|    178|        uint32_t idxBuf = 0;
  741|  4.25k|        for (size_t i = 0; i < sizes.count(); i++) {
  ------------------
  |  Branch (741:28): [True: 4.07k, False: 178]
  ------------------
  742|  4.07k|          uint32_t offset = dataValue.toUint32(i);
  743|  4.07k|          uint32_t size = sizes.toUint32(i);
  744|       |
  745|       |          // the size_ parameter is originally computed by summing all values inside sizes
  746|       |          // see the constructor of LoaderTiff
  747|       |          // But e.g in malicious files some of these values could be negative
  748|       |          // That's why we check again for each step here to really make sure we don't overstep
  749|  4.07k|          Internal::enforce(Safe::add(idxBuf, size) <= size_, ErrorCode::kerCorruptedMetadata);
  750|  4.07k|          if (size != 0 && Safe::add(offset, size) <= static_cast<uint32_t>(io.size())) {
  ------------------
  |  Branch (750:15): [True: 1.07k, False: 3.00k]
  |  Branch (750:28): [True: 518, False: 552]
  ------------------
  751|    518|            std::copy_n(base + offset, size, buf.begin() + idxBuf);
  752|    518|          }
  753|       |
  754|  4.07k|          idxBuf += size;
  755|  4.07k|        }
  756|    178|        dataValue.setDataArea(buf.c_data(), buf.size());
  757|    178|      }
  758|  1.55k|    }
  759|  1.55k|  }
  760|       |
  761|       |  // Fix compression value in the CR2 IFD2 image
  762|  1.55k|  if (0 == strcmp(group_, "Image2") && image_.mimeType() == "image/x-canon-cr2") {
  ------------------
  |  Branch (762:7): [True: 0, False: 1.55k]
  |  Branch (762:7): [True: 0, False: 1.55k]
  |  Branch (762:40): [True: 0, False: 0]
  ------------------
  763|      0|    preview["Exif.Image.Compression"] = std::uint16_t{1};
  764|      0|  }
  765|       |
  766|       |  // write new image
  767|  1.55k|  MemIo mio;
  768|  1.55k|  IptcData emptyIptc;
  769|  1.55k|  XmpData emptyXmp;
  770|  1.55k|  TiffParser::encode(mio, nullptr, 0, Exiv2::littleEndian, preview, emptyIptc, emptyXmp);
  771|  1.55k|  return {mio.mmap(), mio.size()};
  772|  1.55k|}
preview.cpp:_ZN12_GLOBAL__N_120createLoaderExifJpegEiRKN5Exiv25ImageEi:
  496|  50.8k|Loader::UniquePtr createLoaderExifJpeg(PreviewId id, const Image& image, int parIdx) {
  497|  50.8k|  return std::make_unique<LoaderExifJpeg>(id, image, parIdx);
  498|  50.8k|}
preview.cpp:_ZN12_GLOBAL__N_114LoaderExifJpegC2EiRKN5Exiv25ImageEi:
  467|  50.8k|LoaderExifJpeg::LoaderExifJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image) {
  468|  50.8k|  const ExifData& exifData = image_.exifData();
  469|  50.8k|  auto pos = exifData.findKey(ExifKey(param_[parIdx].offsetKey_));
  470|  50.8k|  if (pos != exifData.end() && pos->count() > 0) {
  ------------------
  |  Branch (470:7): [True: 14.0k, False: 36.8k]
  |  Branch (470:7): [True: 13.7k, False: 37.0k]
  |  Branch (470:32): [True: 13.7k, False: 272]
  ------------------
  471|  13.7k|    offset_ = pos->toUint32();
  472|  13.7k|  }
  473|       |
  474|  50.8k|  size_ = 0;
  475|  50.8k|  pos = exifData.findKey(ExifKey(param_[parIdx].sizeKey_));
  476|  50.8k|  if (pos != exifData.end() && pos->count() > 0) {
  ------------------
  |  Branch (476:7): [True: 14.3k, False: 36.5k]
  |  Branch (476:7): [True: 13.6k, False: 37.2k]
  |  Branch (476:32): [True: 13.6k, False: 682]
  ------------------
  477|  13.6k|    size_ = pos->toUint32();
  478|  13.6k|  }
  479|       |
  480|  50.8k|  if (offset_ == 0 || size_ == 0)
  ------------------
  |  Branch (480:7): [True: 37.2k, False: 13.6k]
  |  Branch (480:23): [True: 286, False: 13.3k]
  ------------------
  481|  37.4k|    return;
  482|       |
  483|  13.3k|  if (param_[parIdx].baseOffsetKey_) {
  ------------------
  |  Branch (483:7): [True: 0, False: 13.3k]
  ------------------
  484|      0|    pos = exifData.findKey(ExifKey(param_[parIdx].baseOffsetKey_));
  485|      0|    if (pos != exifData.end() && pos->count() > 0) {
  ------------------
  |  Branch (485:9): [True: 0, False: 0]
  |  Branch (485:9): [True: 0, False: 0]
  |  Branch (485:34): [True: 0, False: 0]
  ------------------
  486|      0|      offset_ += pos->toUint32();
  487|      0|    }
  488|      0|  }
  489|       |
  490|  13.3k|  if (Safe::add(offset_, size_) > image_.io().size())
  ------------------
  |  Branch (490:7): [True: 151, False: 13.2k]
  ------------------
  491|    151|    return;
  492|       |
  493|  13.2k|  valid_ = true;
  494|  13.2k|}
preview.cpp:_ZNK12_GLOBAL__N_114LoaderExifJpeg13getPropertiesEv:
  500|  6.13k|PreviewProperties LoaderExifJpeg::getProperties() const {
  501|  6.13k|  PreviewProperties prop = Loader::getProperties();
  502|  6.13k|  prop.mimeType_ = "image/jpeg";
  503|  6.13k|  prop.extension_ = ".jpg";
  504|  6.13k|  return prop;
  505|  6.13k|}
preview.cpp:_ZNK12_GLOBAL__N_114LoaderExifJpeg7getDataEv:
  507|  7.33k|DataBuf LoaderExifJpeg::getData() const {
  508|  7.33k|  if (!valid())
  ------------------
  |  Branch (508:7): [True: 0, False: 7.33k]
  ------------------
  509|      0|    return {};
  510|  7.33k|  BasicIo& io = image_.io();
  511|       |
  512|  7.33k|  if (io.open() != 0) {
  ------------------
  |  Branch (512:7): [True: 0, False: 7.33k]
  ------------------
  513|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io.path(), strError());
  514|      0|  }
  515|  7.33k|  IoCloser closer(io);
  516|       |
  517|  7.33k|  const Exiv2::byte* base = io.mmap();
  518|       |
  519|  7.33k|  return {base + offset_, size_};
  520|  7.33k|}
preview.cpp:_ZN12_GLOBAL__N_114LoaderExifJpeg14readDimensionsEv:
  522|  12.0k|bool LoaderExifJpeg::readDimensions() {
  523|  12.0k|  if (!valid())
  ------------------
  |  Branch (523:7): [True: 0, False: 12.0k]
  ------------------
  524|      0|    return false;
  525|  12.0k|  if (width_ || height_)
  ------------------
  |  Branch (525:7): [True: 0, False: 12.0k]
  |  Branch (525:17): [True: 0, False: 12.0k]
  ------------------
  526|      0|    return true;
  527|       |
  528|  12.0k|  BasicIo& io = image_.io();
  529|       |
  530|  12.0k|  if (io.open() != 0) {
  ------------------
  |  Branch (530:7): [True: 0, False: 12.0k]
  ------------------
  531|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io.path(), strError());
  532|      0|  }
  533|  12.0k|  IoCloser closer(io);
  534|  12.0k|  const Exiv2::byte* base = io.mmap();
  535|       |
  536|  12.0k|  try {
  537|  12.0k|    auto image = ImageFactory::open(base + offset_, size_);
  538|  12.0k|    if (!image)
  ------------------
  |  Branch (538:9): [True: 0, False: 12.0k]
  ------------------
  539|      0|      return false;
  540|  12.0k|    image->readMetadata();
  541|       |
  542|  12.0k|    width_ = image->pixelWidth();
  543|  12.0k|    height_ = image->pixelHeight();
  544|  12.0k|  } catch (const Error& /* error */) {
  545|  5.86k|#ifndef SUPPRESS_WARNINGS
  546|  5.86k|    EXV_WARNING << "Invalid JPEG preview image.\n";
  ------------------
  |  |  138|  5.86k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 5.86k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  5.86k|  LogMsg(LogMsg::warn).os()
  ------------------
  547|  5.86k|#endif
  548|  5.86k|    return false;
  549|  5.86k|  }
  550|       |
  551|  6.13k|  return true;
  552|  12.0k|}
preview.cpp:_ZN12_GLOBAL__N_119createLoaderXmpJpegEiRKN5Exiv25ImageEi:
  807|  6.19k|Loader::UniquePtr createLoaderXmpJpeg(PreviewId id, const Image& image, int parIdx) {
  808|  6.19k|  return std::make_unique<LoaderXmpJpeg>(id, image, parIdx);
  809|  6.19k|}
preview.cpp:_ZN12_GLOBAL__N_113LoaderXmpJpegC2EiRKN5Exiv25ImageEi:
  774|  6.19k|LoaderXmpJpeg::LoaderXmpJpeg(PreviewId id, const Image& image, int parIdx) : Loader(id, image) {
  775|  6.19k|  (void)parIdx;
  776|       |
  777|  6.19k|  const XmpData& xmpData = image_.xmpData();
  778|       |
  779|  6.19k|  std::string prefix = "xmpGImg";
  780|  6.19k|  if (xmpData.findKey(XmpKey("Xmp.xmp.Thumbnails[1]/xapGImg:image")) != xmpData.end()) {
  ------------------
  |  Branch (780:7): [True: 0, False: 6.19k]
  ------------------
  781|      0|    prefix = "xapGImg";
  782|      0|  }
  783|       |
  784|  6.19k|  auto imageDatum = xmpData.findKey(XmpKey("Xmp.xmp.Thumbnails[1]/" + prefix + ":image"));
  785|  6.19k|  if (imageDatum == xmpData.end())
  ------------------
  |  Branch (785:7): [True: 6.19k, False: 0]
  ------------------
  786|  6.19k|    return;
  787|      0|  auto formatDatum = xmpData.findKey(XmpKey("Xmp.xmp.Thumbnails[1]/" + prefix + ":format"));
  788|      0|  if (formatDatum == xmpData.end())
  ------------------
  |  Branch (788:7): [True: 0, False: 0]
  ------------------
  789|      0|    return;
  790|      0|  auto widthDatum = xmpData.findKey(XmpKey("Xmp.xmp.Thumbnails[1]/" + prefix + ":width"));
  791|      0|  if (widthDatum == xmpData.end())
  ------------------
  |  Branch (791:7): [True: 0, False: 0]
  ------------------
  792|      0|    return;
  793|      0|  auto heightDatum = xmpData.findKey(XmpKey("Xmp.xmp.Thumbnails[1]/" + prefix + ":height"));
  794|      0|  if (heightDatum == xmpData.end())
  ------------------
  |  Branch (794:7): [True: 0, False: 0]
  ------------------
  795|      0|    return;
  796|       |
  797|      0|  if (formatDatum->toString() != "JPEG")
  ------------------
  |  Branch (797:7): [True: 0, False: 0]
  ------------------
  798|      0|    return;
  799|       |
  800|      0|  width_ = widthDatum->toUint32();
  801|      0|  height_ = heightDatum->toUint32();
  802|      0|  preview_ = decodeBase64(imageDatum->toString());
  803|      0|  size_ = preview_.size();
  804|      0|  valid_ = true;
  805|      0|}
preview.cpp:_ZN12_GLOBAL__N_16Loader6createEiRKN5Exiv25ImageE:
  328|   215k|Loader::UniquePtr Loader::create(PreviewId id, const Image& image) {
  329|   215k|  Loader::UniquePtr loader;
  330|   215k|  if (id < 0 || id >= Loader::getNumLoaders())
  ------------------
  |  Branch (330:7): [True: 0, False: 215k]
  |  Branch (330:17): [True: 0, False: 215k]
  ------------------
  331|      0|    return loader;
  332|       |
  333|   215k|  if (loaderList_[id].imageMimeType_ && std::string(loaderList_[id].imageMimeType_) != image.mimeType())
  ------------------
  |  Branch (333:7): [True: 18.8k, False: 196k]
  |  Branch (333:7): [True: 12.4k, False: 202k]
  |  Branch (333:41): [True: 12.4k, False: 6.40k]
  ------------------
  334|  12.4k|    return loader;
  335|       |
  336|   202k|  loader = loaderList_[id].create_(id, image, loaderList_[id].parIdx_);
  337|   202k|  if (!loader->valid())
  ------------------
  |  Branch (337:7): [True: 187k, False: 14.9k]
  ------------------
  338|   187k|    loader = nullptr;
  339|       |
  340|   202k|  return loader;
  341|   215k|}
preview.cpp:_ZZNK5Exiv214PreviewManager20getPreviewPropertiesEvENK3$_0clINS_17PreviewPropertiesES3_EEDaRKT_RKT0_:
 1061|  5.48k|            [](const auto& lhs, const auto& rhs) { return lhs.width_ * lhs.height_ < rhs.width_ * rhs.height_; });

_ZNK5Exiv29XmpNsInfoeqERKNS0_2NsE:
 4939|  1.37M|bool XmpNsInfo::operator==(const XmpNsInfo::Ns& ns) const {
 4940|  1.37M|  return ns_ == ns.ns_;
 4941|  1.37M|}
_ZNK5Exiv29XmpNsInfoeqERKNS0_6PrefixE:
 4943|  81.1M|bool XmpNsInfo::operator==(const XmpNsInfo::Prefix& prefix) const {
 4944|  81.1M|  return prefix_ == prefix.prefix_;
 4945|  81.1M|}
_ZN5Exiv213XmpProperties8getMutexEv:
 4952|  2.06M|std::mutex& XmpProperties::getMutex() {
 4953|  2.06M|  static std::mutex m;
 4954|  2.06M|  return m;
 4955|  2.06M|}
_ZN5Exiv213XmpProperties24lookupNsRegistryUnlockedERKNS_9XmpNsInfo6PrefixERKNS0_7XmpLockE:
 4963|  2.17M|const XmpNsInfo* XmpProperties::lookupNsRegistryUnlocked(const XmpNsInfo::Prefix& prefix, const XmpLock&) {
 4964|  52.2M|  for (const auto& [_, p] : nsRegistry_) {
  ------------------
  |  Branch (4964:27): [True: 52.2M, False: 2.14M]
  ------------------
 4965|  52.2M|    if (p == prefix)
  ------------------
  |  Branch (4965:9): [True: 29.4k, False: 52.1M]
  ------------------
 4966|  29.4k|      return &p;
 4967|  52.2M|  }
 4968|  2.14M|  return nullptr;
 4969|  2.17M|}
_ZN5Exiv213XmpProperties18registerNsUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS0_7XmpLockE:
 4976|     29|void XmpProperties::registerNsUnlocked(const std::string& ns, const std::string& prefix, const XmpLock& lock) {
 4977|     29|  if (ns.empty())
  ------------------
  |  Branch (4977:7): [True: 0, False: 29]
  ------------------
 4978|      0|    return;
 4979|     29|  std::string ns2 = ns;
 4980|     29|  if (ns2.back() != '/' && ns2.back() != '#')
  ------------------
  |  Branch (4980:7): [True: 8, False: 21]
  |  Branch (4980:28): [True: 8, False: 0]
  ------------------
 4981|      8|    ns2 += '/';
 4982|       |
 4983|       |  // 1. Check if this URI is already registered with this exact prefix
 4984|     29|  auto it = nsRegistry_.find(ns2);
 4985|     29|  if (it != nsRegistry_.end() && std::strcmp(it->second.prefix_, prefix.c_str()) == 0) {
  ------------------
  |  Branch (4985:7): [True: 0, False: 29]
  |  Branch (4985:7): [True: 0, False: 29]
  |  Branch (4985:34): [True: 0, False: 0]
  ------------------
 4986|      0|    return;  // Already registered with this prefix
 4987|      0|  }
 4988|       |
 4989|       |  // 2. Check if this prefix is already registered with a DIFFERENT URI
 4990|     29|  if (auto xnp = lookupNsRegistryUnlocked(XmpNsInfo::Prefix{prefix}, lock)) {
  ------------------
  |  Branch (4990:12): [True: 0, False: 29]
  ------------------
 4991|      0|#ifndef SUPPRESS_WARNINGS
 4992|      0|    if (ns2 != xnp->ns_)
  ------------------
  |  Branch (4992:9): [True: 0, False: 0]
  ------------------
 4993|      0|      EXV_WARNING << "Updating namespace URI for " << prefix << " from " << xnp->ns_ << " to " << ns2 << "\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
 4994|      0|#endif
 4995|      0|    unregisterNsUnlocked(xnp->ns_, lock);
 4996|      0|  }
 4997|       |
 4998|       |  // 3. Ensure the URI is unregistered if it's currently used with a different prefix
 4999|       |  // (This handles the case where prefix changed for the same URI, preventing memory leak)
 5000|     29|  unregisterNsUnlocked(ns2, lock);
 5001|       |  // Allocated memory is freed when the namespace is unregistered.
 5002|       |  // Using malloc/free for better system compatibility in case
 5003|       |  // users don't unregister their namespaces explicitly.
 5004|     29|  XmpNsInfo xn;
 5005|     29|  auto c = new char[ns2.size() + 1];
 5006|     29|  std::strcpy(c, ns2.c_str());
 5007|     29|  xn.ns_ = c;
 5008|     29|  c = new char[prefix.size() + 1];
 5009|     29|  std::strcpy(c, prefix.c_str());
 5010|     29|  xn.prefix_ = c;
 5011|     29|  xn.xmpPropertyInfo_ = nullptr;
 5012|     29|  xn.desc_ = "";
 5013|     29|  nsRegistry_[ns2] = xn;
 5014|     29|}
_ZN5Exiv213XmpProperties20unregisterNsUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5021|     29|void XmpProperties::unregisterNsUnlocked(const std::string& ns, const XmpLock&) {
 5022|     29|  unregisterNsNoLock(ns, LifetimeKey{});
 5023|     29|}
_ZN5Exiv213XmpProperties18unregisterNsNoLockERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS0_11LifetimeKeyE:
 5025|     58|void XmpProperties::unregisterNsNoLock(const std::string& ns, LifetimeKey) {
 5026|     58|  auto i = nsRegistry_.find(ns);
 5027|     58|  if (i != nsRegistry_.end()) {
  ------------------
  |  Branch (5027:7): [True: 29, False: 29]
  ------------------
 5028|     29|    delete[] i->second.prefix_;
 5029|     29|    delete[] i->second.ns_;
 5030|     29|    nsRegistry_.erase(i);
 5031|     29|  }
 5032|     58|}
_ZN5Exiv213XmpProperties21unregisterAllNsNoLockENS0_11LifetimeKeyE:
 5042|      1|void XmpProperties::unregisterAllNsNoLock(LifetimeKey) {
 5043|       |  /// \todo check if we are not unregistering the first NS
 5044|      1|  auto i = nsRegistry_.begin();
 5045|     30|  while (i != nsRegistry_.end()) {
  ------------------
  |  Branch (5045:10): [True: 29, False: 1]
  ------------------
 5046|     29|    auto kill = i++;
 5047|     29|    unregisterNsNoLock(kill->first, LifetimeKey{});
 5048|     29|  }
 5049|      1|}
_ZN5Exiv213XmpProperties14prefixUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5056|  74.8k|std::string XmpProperties::prefixUnlocked(const std::string& ns, const XmpLock&) {
 5057|  74.8k|  std::string ns2 = ns;
 5058|  74.8k|  if (ns2.back() != '/' && ns2.back() != '#')
  ------------------
  |  Branch (5058:7): [True: 13.2k, False: 61.5k]
  |  Branch (5058:28): [True: 8.57k, False: 4.63k]
  ------------------
 5059|  8.57k|    ns2 += '/';
 5060|       |
 5061|  74.8k|  auto i = nsRegistry_.find(ns2);
 5062|  74.8k|  std::string p;
 5063|  74.8k|  if (i != nsRegistry_.end())
  ------------------
  |  Branch (5063:7): [True: 7.30k, False: 67.5k]
  ------------------
 5064|  7.30k|    p = i->second.prefix_;
 5065|  67.5k|  else if (auto xn = Exiv2::find(xmpNsInfo, XmpNsInfo::Ns{std::move(ns2)}))
  ------------------
  |  Branch (5065:17): [True: 44.0k, False: 23.4k]
  ------------------
 5066|  44.0k|    p = std::string(xn->prefix_);
 5067|  74.8k|  return p;
 5068|  74.8k|}
_ZN5Exiv213XmpProperties10nsUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5075|  1.08M|std::string XmpProperties::nsUnlocked(const std::string& prefix, const XmpLock& lock) {
 5076|  1.08M|  if (auto xn = lookupNsRegistryUnlocked(XmpNsInfo::Prefix{prefix}, lock))
  ------------------
  |  Branch (5076:12): [True: 27.2k, False: 1.05M]
  ------------------
 5077|  27.2k|    return xn->ns_;
 5078|  1.05M|  return nsInfoUnlocked(prefix, lock)->ns_;
 5079|  1.08M|}
_ZN5Exiv213XmpProperties21prefixIsBoundUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5081|  5.04k|bool XmpProperties::prefixIsBoundUnlocked(const std::string& prefix, const XmpLock& lock) {
 5082|  5.04k|  const auto pf = XmpNsInfo::Prefix{prefix};
 5083|  5.04k|  return lookupNsRegistryUnlocked(pf, lock) != nullptr || Exiv2::find(xmpNsInfo, pf) != nullptr;
  ------------------
  |  Branch (5083:10): [True: 2.29k, False: 2.75k]
  |  Branch (5083:59): [True: 2.72k, False: 29]
  ------------------
 5084|  5.04k|}
_ZN5Exiv213XmpProperties20propertyTypeUnlockedERKNS_6XmpKeyERKNS0_7XmpLockE:
 5111|  34.0k|TypeId XmpProperties::propertyTypeUnlocked(const XmpKey& key, const XmpLock& lock) {
 5112|  34.0k|  const XmpPropertyInfo* pi = propertyInfoUnlocked(key, lock);
 5113|  34.0k|  return pi ? pi->typeId_ : xmpText;
  ------------------
  |  Branch (5113:10): [True: 32.9k, False: 1.07k]
  ------------------
 5114|  34.0k|}
_ZN5Exiv213XmpProperties20propertyInfoUnlockedERKNS_6XmpKeyERKNS0_7XmpLockE:
 5121|  34.0k|const XmpPropertyInfo* XmpProperties::propertyInfoUnlocked(const XmpKey& key, const XmpLock& lock) {
 5122|  34.0k|  std::string prefix = key.groupName();
 5123|  34.0k|  std::string property = key.tagName();
 5124|       |  // If property is a path for a nested property, determines the innermost element
 5125|  34.0k|  if (auto i = property.find_last_of('/'); i != std::string::npos) {
  ------------------
  |  Branch (5125:44): [True: 0, False: 34.0k]
  ------------------
 5126|      0|    i = std::distance(property.begin(), std::find_if(property.begin() + i, property.end(), isalpha));
 5127|      0|    property = property.substr(i);
 5128|      0|    i = property.find_first_of(':');
 5129|      0|    if (i != std::string::npos) {
  ------------------
  |  Branch (5129:9): [True: 0, False: 0]
  ------------------
 5130|      0|      prefix = property.substr(0, i);
 5131|      0|      property = property.substr(i + 1);
 5132|      0|    }
 5133|       |#ifdef EXIV2_DEBUG_MESSAGES
 5134|       |    std::cout << "Nested key: " << key.key() << ", prefix: " << prefix << ", property: " << property << "\n";
 5135|       |#endif
 5136|      0|  }
 5137|  34.0k|  if (auto pl = propertyListUnlocked(prefix, lock)) {
  ------------------
  |  Branch (5137:12): [True: 34.0k, False: 0]
  ------------------
 5138|  4.36M|    for (size_t j = 0; pl[j].name_; ++j) {
  ------------------
  |  Branch (5138:24): [True: 4.36M, False: 1.07k]
  ------------------
 5139|  4.36M|      if (property == pl[j].name_) {
  ------------------
  |  Branch (5139:11): [True: 32.9k, False: 4.33M]
  ------------------
 5140|  32.9k|        return pl + j;
 5141|  32.9k|      }
 5142|  4.36M|    }
 5143|  34.0k|  }
 5144|  1.07k|  return nullptr;
 5145|  34.0k|}
_ZN5Exiv213XmpProperties20propertyListUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5162|  34.0k|const XmpPropertyInfo* XmpProperties::propertyListUnlocked(const std::string& prefix, const XmpLock& lock) {
 5163|  34.0k|  return nsInfoUnlocked(prefix, lock)->xmpPropertyInfo_;
 5164|  34.0k|}
_ZN5Exiv213XmpProperties14nsInfoUnlockedERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS0_7XmpLockE:
 5171|  1.08M|const XmpNsInfo* XmpProperties::nsInfoUnlocked(const std::string& prefix, const XmpLock& lock) {
 5172|  1.08M|  const auto pf = XmpNsInfo::Prefix{prefix};
 5173|  1.08M|  const XmpNsInfo* xn = lookupNsRegistryUnlocked(pf, lock);
 5174|  1.08M|  if (!xn)
  ------------------
  |  Branch (5174:7): [True: 1.08M, False: 0]
  ------------------
 5175|  1.08M|    xn = Exiv2::find(xmpNsInfo, pf);
 5176|  1.08M|  if (!xn)
  ------------------
  |  Branch (5176:7): [True: 72, False: 1.08M]
  ------------------
 5177|     72|    throw Error(ErrorCode::kerNoNamespaceInfoForXmpPrefix, prefix);
 5178|  1.08M|  return xn;
 5179|  1.08M|}
_ZN5Exiv26XmpKey4ImplC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_RKNS_13XmpProperties7XmpLockE:
 5250|  68.6k|XmpKey::Impl::Impl(const std::string& prefix, const std::string& property, const XmpProperties::XmpLock& lock) {
 5251|       |  // Validate prefix unlocked (must hold lock)
 5252|  68.6k|  if (XmpProperties::nsUnlocked(prefix, lock).empty())
  ------------------
  |  Branch (5252:7): [True: 0, False: 68.6k]
  ------------------
 5253|      0|    throw Error(ErrorCode::kerNoNamespaceForPrefix, prefix);
 5254|       |
 5255|  68.6k|  property_ = property;
 5256|  68.6k|  prefix_ = prefix;
 5257|  68.6k|}
_ZN5Exiv26XmpKeyC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 5259|   224k|XmpKey::XmpKey(const std::string& key) : p_(std::make_unique<Impl>()) {
 5260|   224k|  p_->decomposeKey(key);
 5261|   224k|}
_ZN5Exiv26XmpKeyC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_13XmpProperties7XmpLockE:
 5263|   788k|XmpKey::XmpKey(const std::string& key, const XmpProperties::XmpLock& lock) : p_(std::make_unique<Impl>()) {
 5264|   788k|  p_->decomposeKeyUnlocked(key, lock);
 5265|   788k|}
_ZN5Exiv26XmpKeyC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS_13XmpProperties7XmpLockE:
 5271|  68.6k|    p_(std::make_unique<Impl>(prefix, property, lock)) {
 5272|  68.6k|}
_ZN5Exiv26XmpKeyD2Ev:
 5274|  1.34M|XmpKey::~XmpKey() = default;
_ZN5Exiv26XmpKeyC2ERKS0_:
 5276|   258k|XmpKey::XmpKey(const XmpKey& rhs) : p_(std::make_unique<Impl>(*rhs.p_)) {
 5277|   258k|}
_ZNK5Exiv26XmpKey5cloneEv:
 5286|   258k|XmpKey::UniquePtr XmpKey::clone() const {
 5287|   258k|  return UniquePtr(clone_());
 5288|   258k|}
_ZNK5Exiv26XmpKey6clone_Ev:
 5290|   258k|XmpKey* XmpKey::clone_() const {
 5291|   258k|  return new XmpKey(*this);
 5292|   258k|}
_ZNK5Exiv26XmpKey3keyEv:
 5294|  12.6M|std::string XmpKey::key() const {
 5295|  12.6M|  return std::string(Exiv2::XmpKey::Impl::familyName_) + "." + p_->prefix_ + "." + p_->property_;
 5296|  12.6M|}
_ZNK5Exiv26XmpKey9groupNameEv:
 5302|  97.2k|std::string XmpKey::groupName() const {
 5303|  97.2k|  return p_->prefix_;
 5304|  97.2k|}
_ZNK5Exiv26XmpKey7tagNameEv:
 5306|   195k|std::string XmpKey::tagName() const {
 5307|   195k|  return p_->property_;
 5308|   195k|}
_ZN5Exiv26XmpKey4Impl12decomposeKeyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 5335|   224k|void XmpKey::Impl::decomposeKey(const std::string& key) {
 5336|   224k|  XmpProperties::XmpLock lock;
 5337|   224k|  decomposeKeyUnlocked(key, lock);
 5338|   224k|}  // XmpKey::Impl::decomposeKey
_ZN5Exiv26XmpKey4Impl20decomposeKeyUnlockedERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKNS_13XmpProperties7XmpLockE:
 5340|  1.01M|void XmpKey::Impl::decomposeKeyUnlocked(const std::string& key, const XmpProperties::XmpLock& lock) {
 5341|       |  // Get the family name, prefix and property name parts of the key
 5342|  1.01M|  if (!key.starts_with(familyName_))
  ------------------
  |  Branch (5342:7): [True: 183, False: 1.01M]
  ------------------
 5343|    183|    throw Error(ErrorCode::kerInvalidKey, key);
 5344|  1.01M|  std::string::size_type pos1 = key.find('.');
 5345|  1.01M|  std::string::size_type pos0 = pos1 + 1;
 5346|  1.01M|  pos1 = key.find('.', pos0);
 5347|  1.01M|  if (pos1 == std::string::npos)
  ------------------
  |  Branch (5347:7): [True: 0, False: 1.01M]
  ------------------
 5348|      0|    throw Error(ErrorCode::kerInvalidKey, key);
 5349|  1.01M|  std::string prefix = key.substr(pos0, pos1 - pos0);
 5350|  1.01M|  if (prefix.empty())
  ------------------
  |  Branch (5350:7): [True: 0, False: 1.01M]
  ------------------
 5351|      0|    throw Error(ErrorCode::kerInvalidKey, key);
 5352|  1.01M|  std::string property = key.substr(pos1 + 1);
 5353|  1.01M|  if (property.empty())
  ------------------
  |  Branch (5353:7): [True: 0, False: 1.01M]
  ------------------
 5354|      0|    throw Error(ErrorCode::kerInvalidKey, key);
 5355|       |
 5356|       |  // Validate prefix unlocked (must hold lock)
 5357|  1.01M|  if (XmpProperties::nsUnlocked(prefix, lock).empty())
  ------------------
  |  Branch (5357:7): [True: 0, False: 1.01M]
  ------------------
 5358|      0|    throw Error(ErrorCode::kerNoNamespaceForPrefix, prefix);
 5359|       |
 5360|  1.01M|  property_ = std::move(property);
 5361|  1.01M|  prefix_ = std::move(prefix);
 5362|  1.01M|}  // XmpKey::Impl::decomposeKeyUnlocked
_ZN5Exiv26XmpKey4ImplC2Ev:
 5224|  1.01M|  Impl() = default;                                                                             //!< Default constructor

_ZN5Exiv28PsdImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  103|    724|    Image(ImageType::psd, mdExif | mdIptc | mdXmp, std::move(io), params) {
  104|    724|}  // PsdImage::PsdImage
_ZN5Exiv28PsdImage12readMetadataEv:
  115|    715|void PsdImage::readMetadata() {
  116|       |#ifdef EXIV2_DEBUG_MESSAGES
  117|       |  std::cerr << "Exiv2::PsdImage::readMetadata: Reading Photoshop file " << io_->path() << "\n";
  118|       |#endif
  119|    715|  if (io_->open() != 0) {
  ------------------
  |  Branch (119:7): [True: 0, False: 715]
  ------------------
  120|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  121|      0|  }
  122|    715|  IoCloser closer(*io_);
  123|       |  // Ensure that this is the correct image type
  124|    715|  if (!isPsdType(*io_, false)) {
  ------------------
  |  Branch (124:7): [True: 0, False: 715]
  ------------------
  125|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (125:9): [True: 0, False: 0]
  |  Branch (125:25): [True: 0, False: 0]
  ------------------
  126|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  127|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  128|      0|  }
  129|    715|  clearMetadata();
  130|       |
  131|       |  /*
  132|       |    The Photoshop header goes as follows -- all numbers are in big-endian byte order:
  133|       |
  134|       |    offset  length   name       description
  135|       |    ======  =======  =========  =========
  136|       |     0      4 bytes  signature  always '8BPS'
  137|       |     4      2 bytes  version    always equal to 1
  138|       |     6      6 bytes  reserved   must be zero
  139|       |    12      2 bytes  channels   number of channels in the image, including alpha channels (1 to 24)
  140|       |    14      4 bytes  rows       the height of the image in pixels
  141|       |    18      4 bytes  columns    the width of the image in pixels
  142|       |    22      2 bytes  depth      the number of bits per channel
  143|       |    24      2 bytes  mode       the color mode of the file; Supported values are: Bitmap=0; Grayscale=1;
  144|       |    Indexed=2; RGB=3; CMYK=4; Multichannel=7; Duotone=8; Lab=9
  145|       |  */
  146|    715|  byte buf[26];
  147|    715|  if (io_->read(buf, 26) != 26) {
  ------------------
  |  Branch (147:7): [True: 0, False: 715]
  ------------------
  148|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  149|      0|  }
  150|    715|  pixelWidth_ = getLong(buf + 18, bigEndian);
  151|    715|  pixelHeight_ = getLong(buf + 14, bigEndian);
  152|       |
  153|       |  // immediately following the image header is the color mode data section,
  154|       |  // the first four bytes of which specify the byte size of the whole section
  155|    715|  if (io_->read(buf, 4) != 4) {
  ------------------
  |  Branch (155:7): [True: 0, False: 715]
  ------------------
  156|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  157|      0|  }
  158|       |
  159|       |  // skip it
  160|    715|  if (io_->seek(getULong(buf, bigEndian), BasicIo::cur)) {
  ------------------
  |  Branch (160:7): [True: 31, False: 684]
  ------------------
  161|     31|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  162|     31|  }
  163|       |
  164|       |  // after the color data section, comes a list of resource blocks, preceded by the total byte size
  165|    684|  if (io_->read(buf, 4) != 4) {
  ------------------
  |  Branch (165:7): [True: 5, False: 679]
  ------------------
  166|      5|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  167|      5|  }
  168|    679|  uint32_t resourcesLength = getULong(buf, bigEndian);
  169|    679|  Internal::enforce(resourcesLength < io_->size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  170|       |
  171|  1.47k|  while (resourcesLength > 0) {
  ------------------
  |  Branch (171:10): [True: 1.12k, False: 353]
  ------------------
  172|  1.12k|    Internal::enforce(resourcesLength >= 8, Exiv2::ErrorCode::kerCorruptedMetadata);
  173|  1.12k|    resourcesLength -= 8;
  174|  1.12k|    if (io_->read(buf, 8) != 8) {
  ------------------
  |  Branch (174:9): [True: 24, False: 1.09k]
  ------------------
  175|     24|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  176|     24|    }
  177|       |
  178|  1.09k|    if (!Photoshop::isIrb(buf)) {
  ------------------
  |  Branch (178:9): [True: 295, False: 803]
  ------------------
  179|    295|      break;  // bad resource type
  180|    295|    }
  181|    803|    uint16_t resourceId = getUShort(buf + 4, bigEndian);
  182|    803|    uint32_t resourceNameLength = buf[6] & ~1;
  183|       |
  184|       |    // skip the resource name, plus any padding
  185|    803|    Internal::enforce(resourceNameLength <= resourcesLength, Exiv2::ErrorCode::kerCorruptedMetadata);
  186|    803|    resourcesLength -= resourceNameLength;
  187|    803|    io_->seek(resourceNameLength, BasicIo::cur);
  188|       |
  189|       |    // read resource size
  190|    803|    Internal::enforce(resourcesLength >= 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  191|    803|    resourcesLength -= 4;
  192|    803|    if (io_->read(buf, 4) != 4) {
  ------------------
  |  Branch (192:9): [True: 7, False: 796]
  ------------------
  193|      7|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  194|      7|    }
  195|    796|    uint32_t resourceSize = getULong(buf, bigEndian);
  196|    796|    const size_t curOffset = io_->tell();
  197|       |
  198|       |#ifdef EXIV2_DEBUG_MESSAGES
  199|       |    std::cerr << std::hex << "resourceId: " << resourceId << std::dec << " length: " << resourceSize << std::hex
  200|       |              << "\n";
  201|       |#endif
  202|       |
  203|    796|    Internal::enforce(resourceSize <= resourcesLength, Exiv2::ErrorCode::kerCorruptedMetadata);
  204|    796|    readResourceBlock(resourceId, resourceSize);
  205|    796|    resourceSize = (resourceSize + 1) & ~1;  // pad to even
  206|    796|    Internal::enforce(resourceSize <= resourcesLength, Exiv2::ErrorCode::kerCorruptedMetadata);
  207|    796|    resourcesLength -= resourceSize;
  208|    796|    io_->seek(curOffset + resourceSize, BasicIo::beg);
  209|    796|  }
  210|       |
  211|    679|}  // PsdImage::readMetadata
_ZN5Exiv28PsdImage17readResourceBlockEtj:
  213|    701|void PsdImage::readResourceBlock(uint16_t resourceId, uint32_t resourceSize) {
  214|    701|  switch (resourceId) {
  215|    231|    case kPhotoshopResourceID::IPTC_NAA: {
  ------------------
  |  Branch (215:5): [True: 231, False: 470]
  ------------------
  216|    231|      DataBuf rawIPTC(resourceSize);
  217|    231|      io_->read(rawIPTC.data(), rawIPTC.size());
  218|    231|      if (io_->error() || io_->eof())
  ------------------
  |  Branch (218:11): [True: 0, False: 231]
  |  Branch (218:27): [True: 25, False: 206]
  ------------------
  219|     25|        throw Error(ErrorCode::kerFailedToReadImageData);
  220|    206|      if (IptcParser::decode(iptcData_, rawIPTC.c_data(), rawIPTC.size())) {
  ------------------
  |  Branch (220:11): [True: 44, False: 162]
  ------------------
  221|     44|#ifndef SUPPRESS_WARNINGS
  222|     44|        EXV_WARNING << "Failed to decode IPTC metadata.\n";
  ------------------
  |  |  138|     44|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 44]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     44|  LogMsg(LogMsg::warn).os()
  ------------------
  223|     44|#endif
  224|     44|        iptcData_.clear();
  225|     44|      }
  226|    206|      break;
  227|    231|    }
  228|       |
  229|     36|    case kPhotoshopResourceID::ExifInfo: {
  ------------------
  |  Branch (229:5): [True: 36, False: 665]
  ------------------
  230|     36|      DataBuf rawExif(resourceSize);
  231|     36|      io_->read(rawExif.data(), rawExif.size());
  232|     36|      if (io_->error() || io_->eof())
  ------------------
  |  Branch (232:11): [True: 0, False: 36]
  |  Branch (232:27): [True: 6, False: 30]
  ------------------
  233|      6|        throw Error(ErrorCode::kerFailedToReadImageData);
  234|     30|      const DecodeParams dp(max_recursion_depth_);
  235|     30|      ByteOrder bo = ExifParser::decode(exifData_, rawExif.c_data(), rawExif.size(), dp);
  236|     30|      setByteOrder(bo);
  237|     30|      if (!rawExif.empty() && byteOrder() == invalidByteOrder) {
  ------------------
  |  Branch (237:11): [True: 2, False: 28]
  |  Branch (237:31): [True: 0, False: 2]
  ------------------
  238|      0|#ifndef SUPPRESS_WARNINGS
  239|      0|        EXV_WARNING << "Failed to decode Exif metadata.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  240|      0|#endif
  241|      0|        exifData_.clear();
  242|      0|      }
  243|     30|      break;
  244|     36|    }
  245|       |
  246|     57|    case kPhotoshopResourceID::XMPPacket: {
  ------------------
  |  Branch (246:5): [True: 57, False: 644]
  ------------------
  247|     57|      DataBuf xmpPacket(resourceSize);
  248|     57|      io_->read(xmpPacket.data(), xmpPacket.size());
  249|     57|      if (io_->error() || io_->eof())
  ------------------
  |  Branch (249:11): [True: 0, False: 57]
  |  Branch (249:27): [True: 8, False: 49]
  ------------------
  250|      8|        throw Error(ErrorCode::kerFailedToReadImageData);
  251|     49|      xmpPacket_.assign(xmpPacket.c_str(), xmpPacket.size());
  252|     49|      const DecodeParams dp(max_recursion_depth_);
  253|     49|      if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp)) {
  ------------------
  |  Branch (253:11): [True: 28, False: 21]
  |  Branch (253:34): [True: 26, False: 2]
  ------------------
  254|     26|#ifndef SUPPRESS_WARNINGS
  255|     26|        EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|     26|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 26]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     26|  LogMsg(LogMsg::warn).os()
  ------------------
  256|     26|#endif
  257|     26|      }
  258|     49|      break;
  259|     57|    }
  260|       |
  261|       |    // - PS 4.0 preview data is fetched from ThumbnailResource
  262|       |    // - PS >= 5.0 preview data is fetched from ThumbnailResource2
  263|    109|    case kPhotoshopResourceID::ThumbnailResource:
  ------------------
  |  Branch (263:5): [True: 109, False: 592]
  ------------------
  264|    118|    case kPhotoshopResourceID::ThumbnailResource2: {
  ------------------
  |  Branch (264:5): [True: 9, False: 692]
  ------------------
  265|       |      /*
  266|       |        Photoshop thumbnail resource header
  267|       |
  268|       |        offset  length    name            description
  269|       |        ======  ========  ====            ===========
  270|       |         0      4 bytes   format          = 1 (kJpegRGB). Also supports kRawRGB (0).
  271|       |         4      4 bytes   width           Width of thumbnail in pixels.
  272|       |         8      4 bytes   height          Height of thumbnail in pixels.
  273|       |        12      4 bytes   widthbytes      Padded row bytes as (width * bitspixel + 31) / 32 * 4.
  274|       |        16      4 bytes   size            Total size as widthbytes * height * planes
  275|       |        20      4 bytes   compressedsize  Size after compression. Used for consistency check.
  276|       |        24      2 bytes   bitspixel       = 24. Bits per pixel.
  277|       |        26      2 bytes   planes          = 1. Number of planes.
  278|       |        28      variable  data            JFIF data in RGB format.
  279|       |                                          Note: For resource ID 1033 the data is in BGR format.
  280|       |      */
  281|    118|      byte buf[28];
  282|    118|      if (io_->read(buf, 28) != 28) {
  ------------------
  |  Branch (282:11): [True: 6, False: 112]
  ------------------
  283|      6|        throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  284|      6|      }
  285|    112|      NativePreview nativePreview;
  286|    112|      nativePreview.position_ = io_->tell();
  287|    112|      nativePreview.size_ = getLong(buf + 20, bigEndian);  // compressedsize
  288|    112|      nativePreview.width_ = getLong(buf + 4, bigEndian);
  289|    112|      nativePreview.height_ = getLong(buf + 8, bigEndian);
  290|    112|      const uint32_t format = getLong(buf + 0, bigEndian);
  291|       |
  292|    112|      Internal::enforce(nativePreview.size_ <= static_cast<size_t>(std::numeric_limits<long>::max()),
  293|    112|                        Exiv2::ErrorCode::kerCorruptedMetadata);
  294|       |
  295|    112|      if (nativePreview.size_ > 0 && nativePreview.position_ > 0) {
  ------------------
  |  Branch (295:11): [True: 54, False: 58]
  |  Branch (295:38): [True: 54, False: 0]
  ------------------
  296|     54|        io_->seek(static_cast<long>(nativePreview.size_), BasicIo::cur);
  297|     54|        if (io_->error() || io_->eof())
  ------------------
  |  Branch (297:13): [True: 0, False: 54]
  |  Branch (297:29): [True: 26, False: 28]
  ------------------
  298|     26|          throw Error(ErrorCode::kerFailedToReadImageData);
  299|       |
  300|       |        // unsupported format of native preview
  301|     28|        if (format != 1)
  ------------------
  |  Branch (301:13): [True: 28, False: 0]
  ------------------
  302|     28|          break;
  303|      0|        nativePreview.filter_ = "";
  304|      0|        nativePreview.mimeType_ = "image/jpeg";
  305|      0|        nativePreviews_.push_back(std::move(nativePreview));
  306|      0|      }
  307|     58|      break;
  308|    112|    }
  309|       |
  310|    259|    default:
  ------------------
  |  Branch (310:5): [True: 259, False: 442]
  ------------------
  311|    259|      break;
  312|    701|  }
  313|    701|}  // PsdImage::readResourceBlock
_ZN5Exiv28PsdImage13writeMetadataEv:
  315|     80|void PsdImage::writeMetadata() {
  316|     80|  if (io_->open() != 0) {
  ------------------
  |  Branch (316:7): [True: 0, False: 80]
  ------------------
  317|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  318|      0|  }
  319|     80|  IoCloser closer(*io_);
  320|     80|  MemIo tempIo;
  321|       |
  322|     80|  doWriteMetadata(tempIo);  // may throw
  323|     80|  io_->close();
  324|     80|  io_->transfer(tempIo);  // may throw
  325|       |
  326|     80|}  // PsdImage::writeMetadata
_ZN5Exiv28PsdImage15doWriteMetadataERNS_7BasicIoE:
  328|     80|void PsdImage::doWriteMetadata(BasicIo& outIo) {
  329|     80|  if (!io_->isopen())
  ------------------
  |  Branch (329:7): [True: 0, False: 80]
  ------------------
  330|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  331|     80|  if (!outIo.isopen())
  ------------------
  |  Branch (331:7): [True: 0, False: 80]
  ------------------
  332|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  333|       |
  334|       |#ifdef EXIV2_DEBUG_MESSAGES
  335|       |  std::cout << "Exiv2::PsdImage::doWriteMetadata: Writing PSD file " << io_->path() << "\n";
  336|       |  std::cout << "Exiv2::PsdImage::doWriteMetadata: tmp file created " << outIo.path() << "\n";
  337|       |#endif
  338|       |
  339|       |  // Ensure that this is the correct image type
  340|     80|  if (!isPsdType(*io_, true)) {
  ------------------
  |  Branch (340:7): [True: 0, False: 80]
  ------------------
  341|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (341:9): [True: 0, False: 0]
  |  Branch (341:25): [True: 0, False: 0]
  ------------------
  342|      0|      throw Error(ErrorCode::kerInputDataReadFailed);
  343|      0|    throw Error(ErrorCode::kerNoImageInInputData);
  344|      0|  }
  345|       |
  346|     80|  io_->seek(0, BasicIo::beg);  // rewind
  347|       |
  348|     80|  DataBuf lbuf(4096);
  349|     80|  byte buf[8];
  350|       |
  351|       |  // Get Photoshop header from original file
  352|     80|  byte psd_head[26];
  353|     80|  if (io_->read(psd_head, 26) != 26)
  ------------------
  |  Branch (353:7): [True: 0, False: 80]
  ------------------
  354|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  355|       |
  356|       |  // Write Photoshop header data out to new PSD file
  357|     80|  if (outIo.write(psd_head, 26) != 26)
  ------------------
  |  Branch (357:7): [True: 0, False: 80]
  ------------------
  358|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  359|       |
  360|       |  // Read colorDataLength from original PSD
  361|     80|  if (io_->read(buf, 4) != 4)
  ------------------
  |  Branch (361:7): [True: 0, False: 80]
  ------------------
  362|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  363|       |
  364|     80|  uint32_t colorDataLength = getULong(buf, bigEndian);
  365|       |
  366|       |  // Write colorDataLength
  367|     80|  ul2Data(buf, colorDataLength, bigEndian);
  368|     80|  if (outIo.write(buf, 4) != 4)
  ------------------
  |  Branch (368:7): [True: 0, False: 80]
  ------------------
  369|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  370|       |#ifdef EXIV2_DEBUG_MESSAGES
  371|       |  std::cerr << std::dec << "colorDataLength: " << colorDataLength << "\n";
  372|       |#endif
  373|       |  // Copy colorData
  374|     80|  size_t readTotal = 0;
  375|    117|  while (readTotal < colorDataLength) {
  ------------------
  |  Branch (375:10): [True: 37, False: 80]
  ------------------
  376|     37|    auto toRead = std::min<size_t>(colorDataLength - readTotal, lbuf.size());
  377|     37|    if (io_->read(lbuf.data(), toRead) != toRead)
  ------------------
  |  Branch (377:9): [True: 0, False: 37]
  ------------------
  378|      0|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  379|     37|    readTotal += toRead;
  380|     37|    if (outIo.write(lbuf.c_data(), toRead) != toRead)
  ------------------
  |  Branch (380:9): [True: 0, False: 37]
  ------------------
  381|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  382|     37|  }
  383|     80|  if (outIo.error())
  ------------------
  |  Branch (383:7): [True: 0, False: 80]
  ------------------
  384|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  385|       |
  386|     80|  const size_t resLenOffset = io_->tell();  // remember for later update
  387|       |
  388|       |  // Read length of all resource blocks from original PSD
  389|     80|  if (io_->read(buf, 4) != 4)
  ------------------
  |  Branch (389:7): [True: 0, False: 80]
  ------------------
  390|      0|    throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  391|       |
  392|     80|  uint32_t oldResLength = getULong(buf, bigEndian);
  393|     80|  uint32_t newResLength = 0;
  394|       |
  395|       |  // Write oldResLength (will be updated later)
  396|     80|  ul2Data(buf, oldResLength, bigEndian);
  397|     80|  if (outIo.write(buf, 4) != 4)
  ------------------
  |  Branch (397:7): [True: 0, False: 80]
  ------------------
  398|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  399|       |
  400|       |#ifdef EXIV2_DEBUG_MESSAGES
  401|       |  std::cerr << std::dec << "oldResLength: " << oldResLength << "\n";
  402|       |#endif
  403|       |
  404|       |  // Iterate over original resource blocks.
  405|       |  // Replace or insert IPTC, EXIF and XMP
  406|       |  // Original resource blocks assumed to be sorted ASC
  407|       |
  408|     80|  bool iptcDone = false;
  409|     80|  bool exifDone = false;
  410|     80|  bool xmpDone = false;
  411|    208|  while (oldResLength > 0) {
  ------------------
  |  Branch (411:10): [True: 190, False: 18]
  ------------------
  412|    190|    if (io_->read(buf, 8) != 8)
  ------------------
  |  Branch (412:9): [True: 0, False: 190]
  ------------------
  413|      0|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  414|       |
  415|       |    // read resource type and ID
  416|    190|    uint32_t resourceType = getULong(buf, bigEndian);
  417|       |
  418|    190|    if (!Photoshop::isIrb(buf)) {
  ------------------
  |  Branch (418:9): [True: 54, False: 136]
  ------------------
  419|     54|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");  // bad resource type
  420|     54|    }
  421|    136|    uint16_t resourceId = getUShort(buf + 4, bigEndian);
  422|    136|    uint32_t resourceNameLength = buf[6];
  423|    136|    uint32_t adjResourceNameLen = resourceNameLength & ~1;
  424|    136|    unsigned char resourceNameFirstChar = buf[7];
  425|       |
  426|       |    // read rest of resource name, plus any padding
  427|    136|    DataBuf resName(256);
  428|    136|    if (io_->read(resName.data(), adjResourceNameLen) != adjResourceNameLen)
  ------------------
  |  Branch (428:9): [True: 6, False: 130]
  ------------------
  429|      6|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  430|       |
  431|       |    // read resource size (actual length w/o padding!)
  432|    130|    if (io_->read(buf, 4) != 4)
  ------------------
  |  Branch (432:9): [True: 0, False: 130]
  ------------------
  433|      0|      throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  434|       |
  435|    130|    uint32_t resourceSize = getULong(buf, bigEndian);
  436|    130|    uint32_t pResourceSize = (resourceSize + 1) & ~1;  // padded resource size
  437|    130|    const size_t curOffset = io_->tell();
  438|       |
  439|       |    // Write IPTC_NAA resource block
  440|    130|    if (resourceId >= kPhotoshopResourceID::IPTC_NAA && !iptcDone) {
  ------------------
  |  Branch (440:9): [True: 121, False: 9]
  |  Branch (440:57): [True: 60, False: 61]
  ------------------
  441|     60|      newResLength += writeIptcData(iptcData_, outIo);
  442|     60|      iptcDone = true;
  443|     60|    }
  444|       |
  445|       |    // Write ExifInfo resource block
  446|     70|    else if (resourceId >= kPhotoshopResourceID::ExifInfo && !exifDone) {
  ------------------
  |  Branch (446:14): [True: 32, False: 38]
  |  Branch (446:62): [True: 16, False: 16]
  ------------------
  447|     16|      newResLength += writeExifData(exifData_, outIo);
  448|     16|      exifDone = true;
  449|     16|    }
  450|       |
  451|       |    // Write XMPpacket resource block
  452|     54|    else if (resourceId >= kPhotoshopResourceID::XMPPacket && !xmpDone) {
  ------------------
  |  Branch (452:14): [True: 13, False: 41]
  |  Branch (452:63): [True: 12, False: 1]
  ------------------
  453|     12|      newResLength += writeXmpData(xmpData_, outIo);
  454|     12|      xmpDone = true;
  455|     12|    }
  456|       |
  457|       |    // Copy all other resource blocks
  458|    130|    if (resourceId != kPhotoshopResourceID::IPTC_NAA && resourceId != kPhotoshopResourceID::ExifInfo &&
  ------------------
  |  Branch (458:9): [True: 88, False: 42]
  |  Branch (458:57): [True: 76, False: 12]
  ------------------
  459|     76|        resourceId != kPhotoshopResourceID::XMPPacket) {
  ------------------
  |  Branch (459:9): [True: 65, False: 11]
  ------------------
  460|       |#ifdef EXIV2_DEBUG_MESSAGES
  461|       |      std::cerr << std::hex << "copy : resourceType: " << resourceType << "\n";
  462|       |      std::cerr << std::hex << "copy : resourceId: " << resourceId << "\n";
  463|       |      std::cerr << std::dec;
  464|       |#endif
  465|       |      // Copy resource block to new PSD file
  466|     65|      ul2Data(buf, resourceType, bigEndian);
  467|     65|      if (outIo.write(buf, 4) != 4)
  ------------------
  |  Branch (467:11): [True: 0, False: 65]
  ------------------
  468|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  469|     65|      us2Data(buf, resourceId, bigEndian);
  470|     65|      if (outIo.write(buf, 2) != 2)
  ------------------
  |  Branch (470:11): [True: 0, False: 65]
  ------------------
  471|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  472|       |      // Write resource name as Pascal string
  473|     65|      buf[0] = resourceNameLength & 0x00ff;
  474|     65|      if (outIo.write(buf, 1) != 1)
  ------------------
  |  Branch (474:11): [True: 0, False: 65]
  ------------------
  475|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  476|     65|      buf[0] = resourceNameFirstChar;
  477|     65|      if (outIo.write(buf, 1) != 1)
  ------------------
  |  Branch (477:11): [True: 0, False: 65]
  ------------------
  478|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  479|     65|      if (outIo.write(resName.c_data(), adjResourceNameLen) != static_cast<size_t>(adjResourceNameLen))
  ------------------
  |  Branch (479:11): [True: 0, False: 65]
  ------------------
  480|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  481|     65|      ul2Data(buf, resourceSize, bigEndian);
  482|     65|      if (outIo.write(buf, 4) != 4)
  ------------------
  |  Branch (482:11): [True: 0, False: 65]
  ------------------
  483|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  484|       |
  485|     65|      readTotal = 0;
  486|     83|      while (readTotal < pResourceSize) {
  ------------------
  |  Branch (486:14): [True: 20, False: 63]
  ------------------
  487|       |        /// \todo almost same code as in lines 403-410. Factor out & reuse!
  488|     20|        auto toRead = std::min<size_t>(pResourceSize - readTotal, lbuf.size());
  489|     20|        if (io_->read(lbuf.data(), toRead) != toRead) {
  ------------------
  |  Branch (489:13): [True: 2, False: 18]
  ------------------
  490|      2|          throw Error(ErrorCode::kerNotAnImage, "Photoshop");
  491|      2|        }
  492|     18|        readTotal += toRead;
  493|     18|        if (outIo.write(lbuf.c_data(), toRead) != toRead)
  ------------------
  |  Branch (493:13): [True: 0, False: 18]
  ------------------
  494|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  495|     18|      }
  496|     63|      if (outIo.error())
  ------------------
  |  Branch (496:11): [True: 0, False: 63]
  ------------------
  497|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  498|     63|      newResLength += pResourceSize + adjResourceNameLen + 12;
  499|     63|    }
  500|       |
  501|    128|    io_->seek(curOffset + pResourceSize, BasicIo::beg);
  502|    128|    oldResLength -= (12 + adjResourceNameLen + pResourceSize);
  503|    128|  }
  504|       |
  505|       |  // Append IPTC_NAA resource block, if not yet written
  506|     18|  if (!iptcDone) {
  ------------------
  |  Branch (506:7): [True: 11, False: 7]
  ------------------
  507|     11|    newResLength += writeIptcData(iptcData_, outIo);
  508|     11|    iptcDone = true;
  509|     11|  }
  510|       |
  511|       |  // Append ExifInfo resource block, if not yet written
  512|     18|  if (!exifDone) {
  ------------------
  |  Branch (512:7): [True: 16, False: 2]
  ------------------
  513|     16|    newResLength += writeExifData(exifData_, outIo);
  514|     16|  }
  515|       |
  516|       |  // Append XmpPacket resource block, if not yet written
  517|     18|  if (!xmpDone) {
  ------------------
  |  Branch (517:7): [True: 17, False: 1]
  ------------------
  518|     17|    newResLength += writeXmpData(xmpData_, outIo);
  519|     17|  }
  520|       |
  521|       |  // Populate the fake data, only make sense for remoteio, httpio and sshio.
  522|       |  // it avoids allocating memory for parts of the file that contain image-date.
  523|     18|  io_->populateFakeData();
  524|       |
  525|       |  // Copy remaining data
  526|     18|  size_t readSize = io_->read(lbuf.data(), lbuf.size());
  527|     34|  while (readSize != 0) {
  ------------------
  |  Branch (527:10): [True: 16, False: 18]
  ------------------
  528|     16|    if (outIo.write(lbuf.c_data(), readSize) != readSize)
  ------------------
  |  Branch (528:9): [True: 0, False: 16]
  ------------------
  529|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  530|     16|    readSize = io_->read(lbuf.data(), lbuf.size());
  531|     16|  }
  532|     18|  if (outIo.error())
  ------------------
  |  Branch (532:7): [True: 0, False: 18]
  ------------------
  533|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  534|       |
  535|       |    // Update length of resources
  536|       |#ifdef EXIV2_DEBUG_MESSAGES
  537|       |  std::cerr << "newResLength: " << newResLength << "\n";
  538|       |#endif
  539|     18|  outIo.seek(resLenOffset, BasicIo::beg);
  540|     18|  ul2Data(buf, newResLength, bigEndian);
  541|     18|  if (outIo.write(buf, 4) != 4)
  ------------------
  |  Branch (541:7): [True: 0, False: 18]
  ------------------
  542|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  543|       |
  544|     18|}  // PsdImage::doWriteMetadata
_ZN5Exiv28PsdImage13writeIptcDataERKNS_8IptcDataERNS_7BasicIoE:
  546|     71|uint32_t PsdImage::writeIptcData(const IptcData& iptcData, BasicIo& out) {
  547|     71|  uint32_t resLength = 0;
  548|     71|  byte buf[8];
  549|       |
  550|     71|  if (!iptcData.empty()) {
  ------------------
  |  Branch (550:7): [True: 9, False: 62]
  ------------------
  551|      9|    DataBuf rawIptc = IptcParser::encode(iptcData);
  552|      9|    if (!rawIptc.empty()) {
  ------------------
  |  Branch (552:9): [True: 9, False: 0]
  ------------------
  553|       |#ifdef EXIV2_DEBUG_MESSAGES
  554|       |      std::cerr << std::hex << "write: resourceId: " << kPhotoshopResourceID::IPTC_NAA << "\n";
  555|       |      std::cerr << std::dec << "Writing IPTC_NAA: size: " << rawIptc.size() << "\n";
  556|       |#endif
  557|      9|      if (out.write(reinterpret_cast<const byte*>(Photoshop::irbId_[0]), 4) != 4)
  ------------------
  |  Branch (557:11): [True: 0, False: 9]
  ------------------
  558|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  559|      9|      us2Data(buf, kPhotoshopResourceID::IPTC_NAA, bigEndian);
  560|      9|      if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (560:11): [True: 0, False: 9]
  ------------------
  561|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  562|      9|      us2Data(buf, 0, bigEndian);  // NULL resource name
  563|      9|      if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (563:11): [True: 0, False: 9]
  ------------------
  564|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  565|      9|      ul2Data(buf, static_cast<uint32_t>(rawIptc.size()), bigEndian);
  566|      9|      if (out.write(buf, 4) != 4)
  ------------------
  |  Branch (566:11): [True: 0, False: 9]
  ------------------
  567|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  568|       |      // Write encoded Iptc data
  569|      9|      if (out.write(rawIptc.c_data(), rawIptc.size()) != rawIptc.size())
  ------------------
  |  Branch (569:11): [True: 0, False: 9]
  ------------------
  570|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  571|      9|      resLength += static_cast<uint32_t>(rawIptc.size()) + 12;
  572|      9|      if (rawIptc.size() & 1)  // even padding
  ------------------
  |  Branch (572:11): [True: 8, False: 1]
  ------------------
  573|      8|      {
  574|      8|        buf[0] = 0;
  575|      8|        if (out.write(buf, 1) != 1)
  ------------------
  |  Branch (575:13): [True: 0, False: 8]
  ------------------
  576|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  577|      8|        resLength++;
  578|      8|      }
  579|      9|    }
  580|      9|  }
  581|     71|  return resLength;
  582|     71|}  // PsdImage::writeIptcData
_ZN5Exiv28PsdImage13writeExifDataERNS_8ExifDataERNS_7BasicIoE:
  584|     32|uint32_t PsdImage::writeExifData(ExifData& exifData, BasicIo& out) {
  585|     32|  uint32_t resLength = 0;
  586|     32|  byte buf[8];
  587|       |
  588|     32|  if (!exifData.empty()) {
  ------------------
  |  Branch (588:7): [True: 2, False: 30]
  ------------------
  589|      2|    Blob blob;
  590|      2|    ByteOrder bo = byteOrder();
  591|      2|    if (bo == invalidByteOrder) {
  ------------------
  |  Branch (591:9): [True: 0, False: 2]
  ------------------
  592|      0|      bo = littleEndian;
  593|      0|      setByteOrder(bo);
  594|      0|    }
  595|      2|    ExifParser::encode(blob, bo, exifData);
  596|       |
  597|      2|    if (!blob.empty()) {
  ------------------
  |  Branch (597:9): [True: 1, False: 1]
  ------------------
  598|       |#ifdef EXIV2_DEBUG_MESSAGES
  599|       |      std::cerr << std::hex << "write: resourceId: " << kPhotoshopResourceID::ExifInfo << "\n";
  600|       |      std::cerr << std::dec << "Writing ExifInfo: size: " << blob.size() << "\n";
  601|       |#endif
  602|      1|      if (out.write(reinterpret_cast<const byte*>(Photoshop::irbId_[0]), 4) != 4)
  ------------------
  |  Branch (602:11): [True: 0, False: 1]
  ------------------
  603|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  604|      1|      us2Data(buf, kPhotoshopResourceID::ExifInfo, bigEndian);
  605|      1|      if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (605:11): [True: 0, False: 1]
  ------------------
  606|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  607|      1|      us2Data(buf, 0, bigEndian);  // NULL resource name
  608|      1|      if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (608:11): [True: 0, False: 1]
  ------------------
  609|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  610|      1|      ul2Data(buf, static_cast<uint32_t>(blob.size()), bigEndian);
  611|      1|      if (out.write(buf, 4) != 4)
  ------------------
  |  Branch (611:11): [True: 0, False: 1]
  ------------------
  612|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  613|       |      // Write encoded Exif data
  614|      1|      if (out.write(blob.data(), blob.size()) != blob.size())
  ------------------
  |  Branch (614:11): [True: 0, False: 1]
  ------------------
  615|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  616|      1|      resLength += static_cast<long>(blob.size()) + 12;
  617|      1|      if (blob.size() & 1)  // even padding
  ------------------
  |  Branch (617:11): [True: 0, False: 1]
  ------------------
  618|      0|      {
  619|      0|        buf[0] = 0;
  620|      0|        if (out.write(buf, 1) != 1)
  ------------------
  |  Branch (620:13): [True: 0, False: 0]
  ------------------
  621|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  622|      0|        resLength++;
  623|      0|      }
  624|      1|    }
  625|      2|  }
  626|     32|  return resLength;
  627|     32|}  // PsdImage::writeExifData
_ZNK5Exiv28PsdImage12writeXmpDataERKNS_7XmpDataERNS_7BasicIoE:
  629|     29|uint32_t PsdImage::writeXmpData(const XmpData& xmpData, BasicIo& out) const {
  630|     29|  std::string xmpPacket;
  631|     29|  uint32_t resLength = 0;
  632|     29|  byte buf[8];
  633|       |
  634|       |#ifdef EXIV2_DEBUG_MESSAGES
  635|       |  std::cerr << "writeXmpFromPacket(): " << writeXmpFromPacket() << "\n";
  636|       |#endif
  637|       |  //        writeXmpFromPacket(true);
  638|     29|  if (!writeXmpFromPacket() && XmpParser::encode(xmpPacket, xmpData) > 1) {
  ------------------
  |  Branch (638:7): [True: 29, False: 0]
  |  Branch (638:32): [True: 0, False: 29]
  ------------------
  639|      0|#ifndef SUPPRESS_WARNINGS
  640|      0|    EXV_ERROR << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  641|      0|#endif
  642|      0|  }
  643|       |
  644|     29|  if (!xmpPacket.empty()) {
  ------------------
  |  Branch (644:7): [True: 2, False: 27]
  ------------------
  645|       |#ifdef EXIV2_DEBUG_MESSAGES
  646|       |    std::cerr << std::hex << "write: resourceId: " << kPhotoshopResourceID::XMPPacket << "\n";
  647|       |    std::cerr << std::dec << "Writing XMPPacket: size: " << xmpPacket.size() << "\n";
  648|       |#endif
  649|      2|    if (out.write(reinterpret_cast<const byte*>(Photoshop::irbId_[0]), 4) != 4)
  ------------------
  |  Branch (649:9): [True: 0, False: 2]
  ------------------
  650|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  651|      2|    us2Data(buf, kPhotoshopResourceID::XMPPacket, bigEndian);
  652|      2|    if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (652:9): [True: 0, False: 2]
  ------------------
  653|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  654|      2|    us2Data(buf, 0, bigEndian);  // NULL resource name
  655|      2|    if (out.write(buf, 2) != 2)
  ------------------
  |  Branch (655:9): [True: 0, False: 2]
  ------------------
  656|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  657|      2|    ul2Data(buf, static_cast<uint32_t>(xmpPacket.size()), bigEndian);
  658|      2|    if (out.write(buf, 4) != 4)
  ------------------
  |  Branch (658:9): [True: 0, False: 2]
  ------------------
  659|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  660|       |    // Write XMPPacket
  661|      2|    if (out.write(reinterpret_cast<const byte*>(xmpPacket.data()), xmpPacket.size()) != xmpPacket.size())
  ------------------
  |  Branch (661:9): [True: 0, False: 2]
  ------------------
  662|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  663|      2|    if (out.error())
  ------------------
  |  Branch (663:9): [True: 0, False: 2]
  ------------------
  664|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  665|      2|    resLength += static_cast<uint32_t>(xmpPacket.size()) + 12;
  666|      2|    if (xmpPacket.size() & 1)  // even padding
  ------------------
  |  Branch (666:9): [True: 1, False: 1]
  ------------------
  667|      1|    {
  668|      1|      buf[0] = 0;
  669|      1|      if (out.write(buf, 1) != 1)
  ------------------
  |  Branch (669:11): [True: 0, False: 1]
  ------------------
  670|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  671|      1|      resLength++;
  672|      1|    }
  673|      2|  }
  674|     29|  return resLength;
  675|     29|}  // PsdImage::writeXmpData
_ZN5Exiv214newPsdInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  679|    724|Image::UniquePtr newPsdInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  680|    724|  auto image = std::make_unique<PsdImage>(std::move(io), params);
  681|    724|  if (!image->good()) {
  ------------------
  |  Branch (681:7): [True: 9, False: 715]
  ------------------
  682|      9|    return nullptr;
  683|      9|  }
  684|    715|  return image;
  685|    724|}
_ZN5Exiv29isPsdTypeERNS_7BasicIoEb:
  687|  13.0k|bool isPsdType(BasicIo& iIo, bool advance) {
  688|  13.0k|  const int32_t len = 6;
  689|  13.0k|  const std::array<byte, len> PsdHeader{'8', 'B', 'P', 'S', 0, 1};
  690|  13.0k|  std::array<byte, len> buf;
  691|  13.0k|  iIo.read(buf.data(), len);
  692|  13.0k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (692:7): [True: 0, False: 13.0k]
  |  Branch (692:22): [True: 246, False: 12.7k]
  ------------------
  693|    246|    return false;
  694|    246|  }
  695|  12.7k|  bool matched = buf == PsdHeader;
  696|  12.7k|  if (!advance || !matched) {
  ------------------
  |  Branch (696:7): [True: 12.6k, False: 80]
  |  Branch (696:19): [True: 0, False: 80]
  ------------------
  697|  12.6k|    iIo.seek(-len, BasicIo::cur);
  698|  12.6k|  }
  699|       |
  700|  12.7k|  return matched;
  701|  13.0k|}

_ZN5Exiv214QuickTimeVideoC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  540|  2.77k|    Image(ImageType::qtime, mdNone, std::move(io), params), mvhdTimeScale_(1), mdhdTimeScale_(1), currentStream_(Null) {
  541|  2.77k|}  // QuickTimeVideo::QuickTimeVideo
_ZNK5Exiv214QuickTimeVideo8mimeTypeEv:
  543|  2.76k|std::string QuickTimeVideo::mimeType() const {
  544|  2.76k|  return "video/quicktime";
  545|  2.76k|}
_ZN5Exiv214QuickTimeVideo13writeMetadataEv:
  547|    188|void QuickTimeVideo::writeMetadata() {
  548|    188|}
_ZN5Exiv214QuickTimeVideo12readMetadataEv:
  550|  2.76k|void QuickTimeVideo::readMetadata() {
  551|  2.76k|  if (io_->open() != 0)
  ------------------
  |  Branch (551:7): [True: 0, False: 2.76k]
  ------------------
  552|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  553|       |
  554|       |  // Ensure that this is the correct image type
  555|  2.76k|  if (!isQTimeType(*io_, false)) {
  ------------------
  |  Branch (555:7): [True: 0, False: 2.76k]
  ------------------
  556|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (556:9): [True: 0, False: 0]
  |  Branch (556:25): [True: 0, False: 0]
  ------------------
  557|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  558|      0|    throw Error(ErrorCode::kerNotAnImage, "QuickTime");
  559|      0|  }
  560|       |
  561|  2.76k|  IoCloser closer(*io_);
  562|  2.76k|  clearMetadata();
  563|  2.76k|  continueTraversing_ = true;
  564|  2.76k|  height_ = width_ = 1;
  565|       |
  566|  2.76k|  xmpData_["Xmp.video.FileSize"] = static_cast<double>(io_->size()) / 1048576.0;
  567|  2.76k|  xmpData_["Xmp.video.MimeType"] = mimeType();
  568|       |
  569|  37.6k|  while (continueTraversing_)
  ------------------
  |  Branch (569:10): [True: 34.8k, False: 2.76k]
  ------------------
  570|  34.8k|    decodeBlock(0);
  571|       |
  572|  2.76k|  xmpData_["Xmp.video.AspectRatio"] = getAspectRatio(width_, height_);
  573|  2.76k|}  // QuickTimeVideo::readMetadata
_ZN5Exiv214QuickTimeVideo11decodeBlockEmRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  575|  41.5k|void QuickTimeVideo::decodeBlock(size_t recursion_depth, std::string const& entered_from) {
  576|  41.5k|  enforce(recursion_depth < max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata);
  577|       |
  578|  41.5k|  const long bufMinSize = 4;
  579|  41.5k|  DataBuf buf(bufMinSize + 1);
  580|  41.5k|  uint64_t size = 0;
  581|  41.5k|  buf.data()[4] = '\0';
  582|       |
  583|  41.5k|  io_->read(buf.data(), 4);
  584|  41.5k|  if (io_->eof()) {
  ------------------
  |  Branch (584:7): [True: 304, False: 41.2k]
  ------------------
  585|    304|    continueTraversing_ = false;
  586|    304|    return;
  587|    304|  }
  588|       |
  589|  41.2k|  size = buf.read_uint32(0, bigEndian);
  590|       |
  591|  41.2k|  io_->readOrThrow(buf.data(), 4);
  592|       |
  593|       |  // we have read 2x 4 bytes
  594|  41.2k|  size_t hdrsize = 8;
  595|       |
  596|  41.2k|  if (size == 1) {
  ------------------
  |  Branch (596:7): [True: 101, False: 41.1k]
  ------------------
  597|       |    // The box size is encoded as a uint64_t, so we need to read another 8 bytes.
  598|    101|    DataBuf data(8);
  599|    101|    hdrsize += 8;
  600|    101|    io_->readOrThrow(data.data(), data.size());
  601|    101|    size = data.read_uint64(0, bigEndian);
  602|  41.1k|  } else if (size == 0 && entered_from == "meta") {
  ------------------
  |  Branch (602:14): [True: 1.59k, False: 39.5k]
  |  Branch (602:27): [True: 1.49k, False: 100]
  ------------------
  603|  1.49k|    size = buf.read_uint32(0, bigEndian);
  604|  1.49k|    io_->readOrThrow(buf.data(), 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  605|  1.49k|  }
  606|       |
  607|  41.2k|  enforce(size >= hdrsize, Exiv2::ErrorCode::kerCorruptedMetadata);
  608|  41.2k|  enforce(size - hdrsize <= io_->size() - io_->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  609|  41.2k|  enforce(size - hdrsize <= std::numeric_limits<size_t>::max(), Exiv2::ErrorCode::kerCorruptedMetadata);
  610|       |
  611|       |  // std::cerr<<"Tag=>"<<buf.data()<<"     size=>"<<size-hdrsize << '\n';
  612|  41.2k|  const auto newsize = static_cast<size_t>(size - hdrsize);
  613|  41.2k|  if (ignoreList(buf)) {
  ------------------
  |  Branch (613:7): [True: 4.49k, False: 36.7k]
  ------------------
  614|  4.49k|    discard(newsize);
  615|  4.49k|    return;
  616|  4.49k|  }
  617|  36.7k|  tagDecoder(buf, newsize, recursion_depth + 1);
  618|  36.7k|}  // QuickTimeVideo::decodeBlock
_ZN5Exiv214QuickTimeVideo10tagDecoderERNS_7DataBufEmm:
  628|  36.8k|void QuickTimeVideo::tagDecoder(Exiv2::DataBuf& buf, size_t size, size_t recursion_depth) {
  629|  36.8k|  enforce(recursion_depth < max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata);
  630|  36.8k|  assert(buf.size() > 4);
  631|       |
  632|  36.8k|  if (ignoreList(buf))
  ------------------
  |  Branch (632:7): [True: 0, False: 36.8k]
  ------------------
  633|      0|    discard(size);
  634|       |
  635|  36.8k|  else if (dataIgnoreList(buf)) {
  ------------------
  |  Branch (635:12): [True: 4.00k, False: 32.8k]
  ------------------
  636|  4.00k|    decodeBlock(recursion_depth + 1, Exiv2::toString(buf.data()));
  637|  32.8k|  } else if (equalsQTimeTag(buf, "ftyp"))
  ------------------
  |  Branch (637:14): [True: 2.79k, False: 30.0k]
  ------------------
  638|  2.79k|    fileTypeDecoder(size);
  639|       |
  640|  30.0k|  else if (equalsQTimeTag(buf, "trak"))
  ------------------
  |  Branch (640:12): [True: 2.87k, False: 27.1k]
  ------------------
  641|  2.87k|    setMediaStream(size);
  642|       |
  643|  27.1k|  else if (equalsQTimeTag(buf, "mvhd"))
  ------------------
  |  Branch (643:12): [True: 57, False: 27.0k]
  ------------------
  644|     57|    movieHeaderDecoder(size);
  645|       |
  646|  27.0k|  else if (equalsQTimeTag(buf, "tkhd"))
  ------------------
  |  Branch (646:12): [True: 568, False: 26.5k]
  ------------------
  647|    568|    trackHeaderDecoder(size);
  648|       |
  649|  26.5k|  else if (equalsQTimeTag(buf, "mdhd"))
  ------------------
  |  Branch (649:12): [True: 683, False: 25.8k]
  ------------------
  650|    683|    mediaHeaderDecoder(size);
  651|       |
  652|  25.8k|  else if (equalsQTimeTag(buf, "hdlr"))
  ------------------
  |  Branch (652:12): [True: 3.15k, False: 22.6k]
  ------------------
  653|  3.15k|    handlerDecoder(size);
  654|       |
  655|  22.6k|  else if (equalsQTimeTag(buf, "vmhd"))
  ------------------
  |  Branch (655:12): [True: 2.54k, False: 20.1k]
  ------------------
  656|  2.54k|    videoHeaderDecoder(size);
  657|       |
  658|  20.1k|  else if (equalsQTimeTag(buf, "udta"))
  ------------------
  |  Branch (658:12): [True: 5.72k, False: 14.4k]
  ------------------
  659|  5.72k|    userDataDecoder(size, recursion_depth + 1);
  660|       |
  661|  14.4k|  else if (equalsQTimeTag(buf, "dref"))
  ------------------
  |  Branch (661:12): [True: 2.24k, False: 12.1k]
  ------------------
  662|  2.24k|    multipleEntriesDecoder(recursion_depth + 1);
  663|       |
  664|  12.1k|  else if (equalsQTimeTag(buf, "stsd"))
  ------------------
  |  Branch (664:12): [True: 808, False: 11.3k]
  ------------------
  665|    808|    sampleDesc(size);
  666|       |
  667|  11.3k|  else if (equalsQTimeTag(buf, "stts"))
  ------------------
  |  Branch (667:12): [True: 998, False: 10.3k]
  ------------------
  668|    998|    timeToSampleDecoder();
  669|       |
  670|  10.3k|  else if (equalsQTimeTag(buf, "pnot"))
  ------------------
  |  Branch (670:12): [True: 967, False: 9.39k]
  ------------------
  671|    967|    previewTagDecoder(size);
  672|       |
  673|  9.39k|  else if (equalsQTimeTag(buf, "tapt"))
  ------------------
  |  Branch (673:12): [True: 581, False: 8.81k]
  ------------------
  674|    581|    trackApertureTagDecoder(size);
  675|       |
  676|  8.81k|  else if (equalsQTimeTag(buf, "keys"))
  ------------------
  |  Branch (676:12): [True: 260, False: 8.55k]
  ------------------
  677|    260|    keysTagDecoder(size);
  678|       |
  679|  8.55k|  else if (equalsQTimeTag(buf, "url ")) {
  ------------------
  |  Branch (679:12): [True: 335, False: 8.21k]
  ------------------
  680|    335|    if (currentStream_ == Video)
  ------------------
  |  Branch (680:9): [True: 142, False: 193]
  ------------------
  681|    142|      xmpData_["Xmp.video.URL"] = readString(*io_, size);
  682|    193|    else if (currentStream_ == Audio)
  ------------------
  |  Branch (682:14): [True: 113, False: 80]
  ------------------
  683|    113|      xmpData_["Xmp.audio.URL"] = readString(*io_, size);
  684|     80|    else
  685|     80|      discard(size);
  686|    335|  }
  687|       |
  688|  8.21k|  else if (equalsQTimeTag(buf, "urn ")) {
  ------------------
  |  Branch (688:12): [True: 573, False: 7.64k]
  ------------------
  689|    573|    if (currentStream_ == Video)
  ------------------
  |  Branch (689:9): [True: 190, False: 383]
  ------------------
  690|    190|      xmpData_["Xmp.video.URN"] = readString(*io_, size);
  691|    383|    else if (currentStream_ == Audio)
  ------------------
  |  Branch (691:14): [True: 322, False: 61]
  ------------------
  692|    322|      xmpData_["Xmp.audio.URN"] = readString(*io_, size);
  693|     61|    else
  694|     61|      discard(size);
  695|    573|  }
  696|       |
  697|  7.64k|  else if (equalsQTimeTag(buf, "dcom")) {
  ------------------
  |  Branch (697:12): [True: 208, False: 7.43k]
  ------------------
  698|    208|    xmpData_["Xmp.video.Compressor"] = readString(*io_, size);
  699|    208|  }
  700|       |
  701|  7.43k|  else if (equalsQTimeTag(buf, "smhd")) {
  ------------------
  |  Branch (701:12): [True: 99, False: 7.33k]
  ------------------
  702|     99|    io_->readOrThrow(buf.data(), 4);
  703|     99|    io_->readOrThrow(buf.data(), 4);
  704|     99|    xmpData_["Xmp.audio.Balance"] = buf.read_uint16(0, bigEndian);
  705|     99|  }
  706|       |
  707|  7.33k|  else {
  708|  7.33k|    discard(size);
  709|  7.33k|  }
  710|  36.8k|}  // QuickTimeVideo::tagDecoder
_ZN5Exiv214QuickTimeVideo7discardEm:
  712|  11.9k|void QuickTimeVideo::discard(size_t size) {
  713|  11.9k|  size_t cur_pos = io_->tell();
  714|  11.9k|  io_->seek(cur_pos + size, BasicIo::beg);
  715|  11.9k|}  // QuickTimeVideo::discard
_ZN5Exiv214QuickTimeVideo17previewTagDecoderEm:
  717|    967|void QuickTimeVideo::previewTagDecoder(size_t size) {
  718|    967|  DataBuf buf(5);
  719|    967|  size_t cur_pos = io_->tell();
  720|    967|  io_->readOrThrow(buf.data(), 4);
  721|    967|  xmpData_["Xmp.video.PreviewDate"] = buf.read_uint32(0, bigEndian);
  722|    967|  io_->readOrThrow(buf.data(), 2);
  723|    967|  xmpData_["Xmp.video.PreviewVersion"] = getShort(buf.data(), bigEndian);
  724|       |
  725|    967|  io_->readOrThrow(buf.data(), 4);
  726|    967|  buf.write_uint8(4, 0);  // nul-terminate string
  727|    967|  if (equalsQTimeTag(buf, "PICT"))
  ------------------
  |  Branch (727:7): [True: 3, False: 964]
  ------------------
  728|      3|    xmpData_["Xmp.video.PreviewAtomType"] = "QuickDraw Picture";
  729|    964|  else
  730|    964|    xmpData_["Xmp.video.PreviewAtomType"] = buf.data();
  731|       |
  732|    967|  io_->seek(cur_pos + size, BasicIo::beg);
  733|    967|}  // QuickTimeVideo::previewTagDecoder
_ZN5Exiv214QuickTimeVideo14keysTagDecoderEm:
  735|    260|void QuickTimeVideo::keysTagDecoder(size_t size) {
  736|    260|  DataBuf buf(5);
  737|    260|  size_t cur_pos = io_->tell();
  738|    260|  io_->readOrThrow(buf.data(), 4);
  739|    260|  xmpData_["Xmp.video.PreviewDate"] = buf.read_uint32(0, bigEndian);
  740|    260|  io_->readOrThrow(buf.data(), 2);
  741|    260|  xmpData_["Xmp.video.PreviewVersion"] = getShort(buf.data(), bigEndian);
  742|       |
  743|    260|  io_->readOrThrow(buf.data(), 4);
  744|    260|  buf.write_uint8(4, 0);  // nul-terminate string
  745|    260|  if (equalsQTimeTag(buf, "PICT"))
  ------------------
  |  Branch (745:7): [True: 35, False: 225]
  ------------------
  746|     35|    xmpData_["Xmp.video.PreviewAtomType"] = "QuickDraw Picture";
  747|    225|  else
  748|    225|    xmpData_["Xmp.video.PreviewAtomType"] = buf.data();
  749|       |
  750|    260|  io_->seek(cur_pos + size, BasicIo::beg);
  751|    260|}  // QuickTimeVideo::keysTagDecoder
_ZN5Exiv214QuickTimeVideo23trackApertureTagDecoderEm:
  753|    581|void QuickTimeVideo::trackApertureTagDecoder(size_t size) {
  754|    581|  DataBuf buf(4);
  755|    581|  DataBuf buf2(2);
  756|    581|  size_t cur_pos = io_->tell();
  757|    581|  byte n = 3;
  758|       |
  759|  2.31k|  while (n--) {
  ------------------
  |  Branch (759:10): [True: 1.73k, False: 581]
  ------------------
  760|  1.73k|    io_->seek(4L, BasicIo::cur);
  761|  1.73k|    io_->readOrThrow(buf.data(), 4);
  762|       |
  763|  1.73k|    if (equalsQTimeTag(buf, "clef")) {
  ------------------
  |  Branch (763:9): [True: 21, False: 1.71k]
  ------------------
  764|     21|      io_->seek(4L, BasicIo::cur);
  765|     21|      io_->readOrThrow(buf.data(), 2);
  766|     21|      io_->readOrThrow(buf2.data(), 2);
  767|     21|      xmpData_["Xmp.video.CleanApertureWidth"] =
  768|     21|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     21|#define stringFormat std::format
  ------------------
  769|     21|      io_->readOrThrow(buf.data(), 2);
  770|     21|      io_->readOrThrow(buf2.data(), 2);
  771|     21|      xmpData_["Xmp.video.CleanApertureHeight"] =
  772|     21|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     21|#define stringFormat std::format
  ------------------
  773|     21|    }
  774|       |
  775|  1.71k|    else if (equalsQTimeTag(buf, "prof")) {
  ------------------
  |  Branch (775:14): [True: 72, False: 1.63k]
  ------------------
  776|     72|      io_->seek(4L, BasicIo::cur);
  777|     72|      io_->readOrThrow(buf.data(), 2);
  778|     72|      io_->readOrThrow(buf2.data(), 2);
  779|     72|      xmpData_["Xmp.video.ProductionApertureWidth"] =
  780|     72|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     72|#define stringFormat std::format
  ------------------
  781|     72|      io_->readOrThrow(buf.data(), 2);
  782|     72|      io_->readOrThrow(buf2.data(), 2);
  783|     72|      xmpData_["Xmp.video.ProductionApertureHeight"] =
  784|     72|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     72|#define stringFormat std::format
  ------------------
  785|     72|    }
  786|       |
  787|  1.63k|    else if (equalsQTimeTag(buf, "enof")) {
  ------------------
  |  Branch (787:14): [True: 62, False: 1.57k]
  ------------------
  788|     62|      io_->seek(4L, BasicIo::cur);
  789|     62|      io_->readOrThrow(buf.data(), 2);
  790|     62|      io_->readOrThrow(buf2.data(), 2);
  791|     62|      xmpData_["Xmp.video.EncodedPixelsWidth"] =
  792|     62|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     62|#define stringFormat std::format
  ------------------
  793|     62|      io_->readOrThrow(buf.data(), 2);
  794|     62|      io_->readOrThrow(buf2.data(), 2);
  795|     62|      xmpData_["Xmp.video.EncodedPixelsHeight"] =
  796|     62|          stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|     62|#define stringFormat std::format
  ------------------
  797|     62|    }
  798|  1.73k|  }
  799|    581|  io_->seek(cur_pos + size, BasicIo::beg);
  800|    581|}  // QuickTimeVideo::trackApertureTagDecoder
_ZN5Exiv214QuickTimeVideo17CameraTagsDecoderEm:
  802|  1.15k|void QuickTimeVideo::CameraTagsDecoder(size_t size) {
  803|  1.15k|  size_t cur_pos = io_->tell();
  804|  1.15k|  DataBuf buf(49);
  805|  1.15k|  DataBuf buf2(4);
  806|       |
  807|  1.15k|  io_->readOrThrow(buf.data(), 4);
  808|  1.15k|  if (equalsQTimeTag(buf, "NIKO")) {
  ------------------
  |  Branch (808:7): [True: 892, False: 264]
  ------------------
  809|    892|    io_->seek(cur_pos, BasicIo::beg);
  810|       |
  811|    892|    io_->readOrThrow(buf.data(), 24);
  812|    892|    buf.write_uint8(24, 0);  // nul-terminate string
  813|    892|    xmpData_["Xmp.video.Make"] = buf.data();
  814|    892|    io_->readOrThrow(buf.data(), 14);
  815|    892|    buf.write_uint8(14, 0);  // nul-terminate string
  816|    892|    xmpData_["Xmp.video.Model"] = buf.data();
  817|    892|    io_->readOrThrow(buf.data(), 4);
  818|    892|    xmpData_["Xmp.video.ExposureTime"] = stringFormat("1/{}", std::ceil(buf.read_uint32(0, littleEndian) / 10.0));
  ------------------
  |  |   18|    892|#define stringFormat std::format
  ------------------
  819|    892|    io_->readOrThrow(buf.data(), 4);
  820|    892|    io_->readOrThrow(buf2.data(), 4);
  821|    892|    xmpData_["Xmp.video.FNumber"] =
  822|    892|        buf.read_uint32(0, littleEndian) / static_cast<double>(buf2.read_uint32(0, littleEndian));
  823|    892|    io_->readOrThrow(buf.data(), 4);
  824|    892|    io_->readOrThrow(buf2.data(), 4);
  825|    892|    xmpData_["Xmp.video.ExposureCompensation"] =
  826|    892|        buf.read_uint32(0, littleEndian) / static_cast<double>(buf2.read_uint32(0, littleEndian));
  827|    892|    io_->readOrThrow(buf.data(), 10);
  828|    892|    io_->readOrThrow(buf.data(), 4);
  829|    892|    if (auto td = Exiv2::find(whiteBalance, buf.read_uint32(0, littleEndian)))
  ------------------
  |  Branch (829:14): [True: 130, False: 762]
  ------------------
  830|    130|      xmpData_["Xmp.video.WhiteBalance"] = _(td->label_);
  ------------------
  |  |   40|    130|#define _(String) (String)
  ------------------
  831|    892|    io_->readOrThrow(buf.data(), 4);
  832|    892|    io_->readOrThrow(buf2.data(), 4);
  833|    892|    xmpData_["Xmp.video.FocalLength"] =
  834|    892|        buf.read_uint32(0, littleEndian) / static_cast<double>(buf2.read_uint32(0, littleEndian));
  835|    892|    io_->seek(95L, BasicIo::cur);
  836|    892|    io_->readOrThrow(buf.data(), 48);
  837|    892|    buf.write_uint8(48, 0);
  838|    892|    xmpData_["Xmp.video.Software"] = buf.data();
  839|    892|    io_->readOrThrow(buf.data(), 4);
  840|    892|    xmpData_["Xmp.video.ISO"] = buf.read_uint32(0, littleEndian);
  841|    892|  }
  842|       |
  843|  1.15k|  io_->seek(cur_pos + size, BasicIo::beg);
  844|  1.15k|}  // QuickTimeVideo::CameraTagsDecoder
_ZN5Exiv214QuickTimeVideo15userDataDecoderEmm:
  846|  6.00k|void QuickTimeVideo::userDataDecoder(size_t outer_size, size_t recursion_depth) {
  847|  6.00k|  enforce(recursion_depth < max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata);
  848|  6.00k|  const size_t start_pos = io_->tell();
  849|  6.00k|  const TagVocabulary* td;
  850|  6.00k|  const TagVocabulary* tv;
  851|  6.00k|  const TagVocabulary* tv_internal;
  852|       |
  853|  6.00k|  const long bufMinSize = 100;
  854|  6.00k|  DataBuf buf(bufMinSize);
  855|  6.00k|  size_t size_internal = outer_size;
  856|  6.00k|  std::memset(buf.data(), 0x0, buf.size());
  857|       |
  858|  11.4k|  while ((size_internal / 4 != 0) && (size_internal > 0)) {
  ------------------
  |  Branch (858:10): [True: 7.66k, False: 3.75k]
  |  Branch (858:38): [True: 7.66k, False: 0]
  ------------------
  859|  7.66k|    const size_t loop_start_pos = io_->tell();
  860|  7.66k|    buf.data()[4] = '\0';
  861|  7.66k|    io_->readOrThrow(buf.data(), 4);
  862|  7.66k|    const size_t size = buf.read_uint32(0, bigEndian);
  863|  7.66k|    if (size > size_internal)
  ------------------
  |  Branch (863:9): [True: 1.79k, False: 5.86k]
  ------------------
  864|  1.79k|      break;
  865|  5.86k|    size_internal -= size;
  866|  5.86k|    io_->readOrThrow(buf.data(), 4);
  867|       |
  868|  5.86k|    if (buf.data()[0] == 169)
  ------------------
  |  Branch (868:9): [True: 9, False: 5.85k]
  ------------------
  869|      9|      buf.data()[0] = ' ';
  870|  5.86k|    td = Exiv2::find(userDatatags, Exiv2::toString(buf.data()));
  871|       |
  872|  5.86k|    tv = Exiv2::find(userDataReferencetags, Exiv2::toString(buf.data()));
  873|       |
  874|  5.86k|    if (size <= 12)
  ------------------
  |  Branch (874:9): [True: 451, False: 5.41k]
  ------------------
  875|    451|      break;
  876|       |
  877|  5.41k|    if (equalsQTimeTag(buf, "DcMD") || equalsQTimeTag(buf, "NCDT"))
  ------------------
  |  Branch (877:9): [True: 180, False: 5.23k]
  |  Branch (877:40): [True: 96, False: 5.14k]
  ------------------
  878|    276|      userDataDecoder(size - 8, recursion_depth + 1);
  879|       |
  880|  5.14k|    else if (equalsQTimeTag(buf, "NCTG"))
  ------------------
  |  Branch (880:14): [True: 993, False: 4.14k]
  ------------------
  881|    993|      NikonTagsDecoder(size - 8);
  882|       |
  883|  4.14k|    else if (equalsQTimeTag(buf, "TAGS"))
  ------------------
  |  Branch (883:14): [True: 1.15k, False: 2.99k]
  ------------------
  884|  1.15k|      CameraTagsDecoder(size - 8);
  885|       |
  886|  2.99k|    else if (equalsQTimeTag(buf, "CNCV") || equalsQTimeTag(buf, "CNFV") || equalsQTimeTag(buf, "CNMN") ||
  ------------------
  |  Branch (886:14): [True: 6, False: 2.98k]
  |  Branch (886:45): [True: 15, False: 2.97k]
  |  Branch (886:76): [True: 34, False: 2.93k]
  ------------------
  887|  2.93k|             equalsQTimeTag(buf, "NCHD") || equalsQTimeTag(buf, "FFMV")) {
  ------------------
  |  Branch (887:14): [True: 210, False: 2.72k]
  |  Branch (887:45): [True: 51, False: 2.67k]
  ------------------
  888|    316|      enforce(tv, Exiv2::ErrorCode::kerCorruptedMetadata);
  889|    316|      xmpData_[_(tv->label_)] = readString(*io_, size - 8);
  ------------------
  |  |   40|    316|#define _(String) (String)
  ------------------
  890|    316|    }
  891|       |
  892|  2.67k|    else if (equalsQTimeTag(buf, "CMbo") || equalsQTimeTag(buf, "Cmbo")) {
  ------------------
  |  Branch (892:14): [True: 58, False: 2.61k]
  |  Branch (892:45): [True: 0, False: 2.61k]
  ------------------
  893|     58|      enforce(tv, Exiv2::ErrorCode::kerCorruptedMetadata);
  894|     58|      io_->readOrThrow(buf.data(), 2);
  895|     58|      buf.data()[2] = '\0';
  896|     58|      tv_internal = Exiv2::find(cameraByteOrderTags, Exiv2::toString(buf.data()));
  897|       |
  898|     58|      if (tv_internal)
  ------------------
  |  Branch (898:11): [True: 18, False: 40]
  ------------------
  899|     18|        xmpData_[_(tv->label_)] = _(tv_internal->label_);
  ------------------
  |  |   40|     18|#define _(String) (String)
  ------------------
                      xmpData_[_(tv->label_)] = _(tv_internal->label_);
  ------------------
  |  |   40|     18|#define _(String) (String)
  ------------------
  900|     40|      else
  901|     40|        xmpData_[_(tv->label_)] = buf.data();
  ------------------
  |  |   40|     40|#define _(String) (String)
  ------------------
  902|     58|    }
  903|       |
  904|  2.61k|    else if (tv) {
  ------------------
  |  Branch (904:14): [True: 173, False: 2.44k]
  ------------------
  905|    173|      io_->readOrThrow(buf.data(), 4);
  906|    173|      xmpData_[_(tv->label_)] = readString(*io_, size - 12);
  ------------------
  |  |   40|    173|#define _(String) (String)
  ------------------
  907|    173|    }
  908|       |
  909|  2.44k|    else if (td)
  ------------------
  |  Branch (909:14): [True: 1.48k, False: 956]
  ------------------
  910|  1.48k|      tagDecoder(buf, size - 8, recursion_depth + 1);
  911|       |
  912|  5.41k|    enforce(io_->tell() <= loop_start_pos + size, Exiv2::ErrorCode::kerCorruptedMetadata);
  913|  5.41k|  }
  914|       |
  915|  6.00k|  io_->seek(start_pos + outer_size, BasicIo::beg);
  916|  6.00k|}  // QuickTimeVideo::userDataDecoder
_ZN5Exiv214QuickTimeVideo16NikonTagsDecoderEm:
  918|    993|void QuickTimeVideo::NikonTagsDecoder(size_t size) {
  919|    993|  size_t cur_pos = io_->tell();
  920|    993|  DataBuf buf(201);
  921|    993|  DataBuf buf2(4 + 1);
  922|    993|  uint32_t TagID = 0;
  923|    993|  uint16_t dataLength = 0;
  924|    993|  uint16_t dataType = 2;
  925|    993|  const TagDetails* td;
  926|    993|  const TagDetails* td2;
  927|       |
  928|  67.5k|  for (int i = 0; i < 100; i++) {
  ------------------
  |  Branch (928:19): [True: 66.6k, False: 993]
  ------------------
  929|  66.6k|    io_->readOrThrow(buf.data(), 4);
  930|  66.6k|    TagID = buf.read_uint32(0, bigEndian);
  931|  66.6k|    td = Exiv2::find(NikonNCTGTags, TagID);
  932|       |
  933|  66.6k|    io_->readOrThrow(buf.data(), 2);
  934|  66.6k|    dataType = buf.read_uint16(0, bigEndian);
  935|       |
  936|  66.6k|    std::memset(buf.data(), 0x0, buf.size());
  937|  66.6k|    io_->readOrThrow(buf.data(), 2);
  938|       |
  939|  66.6k|    if (TagID == 0x2000023) {
  ------------------
  |  Branch (939:9): [True: 2.20k, False: 64.4k]
  ------------------
  940|  2.20k|      size_t local_pos = io_->tell();
  941|  2.20k|      dataLength = buf.read_uint16(0, bigEndian);
  942|  2.20k|      std::memset(buf.data(), 0x0, buf.size());
  943|       |
  944|  2.20k|      io_->readOrThrow(buf.data(), 4);
  945|  2.20k|      xmpData_["Xmp.video.PictureControlVersion"] = buf.data();
  946|  2.20k|      io_->readOrThrow(buf.data(), 20);
  947|  2.20k|      xmpData_["Xmp.video.PictureControlName"] = buf.data();
  948|  2.20k|      io_->readOrThrow(buf.data(), 20);
  949|  2.20k|      xmpData_["Xmp.video.PictureControlBase"] = buf.data();
  950|  2.20k|      io_->readOrThrow(buf.data(), 4);
  951|  2.20k|      std::memset(buf.data(), 0x0, buf.size());
  952|       |
  953|  2.20k|      io_->readOrThrow(buf.data(), 1);
  954|  2.20k|      td2 = Exiv2::find(PictureControlAdjust, static_cast<int>(buf.data()[0]) & 7);
  955|  2.20k|      if (td2)
  ------------------
  |  Branch (955:11): [True: 1.36k, False: 836]
  ------------------
  956|  1.36k|        xmpData_["Xmp.video.PictureControlAdjust"] = _(td2->label_);
  ------------------
  |  |   40|  1.36k|#define _(String) (String)
  ------------------
  957|    836|      else
  958|    836|        xmpData_["Xmp.video.PictureControlAdjust"] = static_cast<int>(buf.data()[0]) & 7;
  959|       |
  960|  2.20k|      io_->readOrThrow(buf.data(), 1);
  961|  2.20k|      td2 = Exiv2::find(NormalSoftHard, static_cast<int>(buf.data()[0]) & 7);
  962|  2.20k|      if (td2)
  ------------------
  |  Branch (962:11): [True: 1.40k, False: 798]
  ------------------
  963|  1.40k|        xmpData_["Xmp.video.PictureControlQuickAdjust"] = _(td2->label_);
  ------------------
  |  |   40|  1.40k|#define _(String) (String)
  ------------------
  964|       |
  965|  2.20k|      io_->readOrThrow(buf.data(), 1);
  966|  2.20k|      td2 = Exiv2::find(NormalSoftHard, static_cast<int>(buf.data()[0]) & 7);
  967|  2.20k|      if (td2)
  ------------------
  |  Branch (967:11): [True: 1.45k, False: 749]
  ------------------
  968|  1.45k|        xmpData_["Xmp.video.Sharpness"] = _(td2->label_);
  ------------------
  |  |   40|  1.45k|#define _(String) (String)
  ------------------
  969|    749|      else
  970|    749|        xmpData_["Xmp.video.Sharpness"] = static_cast<int>(buf.data()[0]) & 7;
  971|       |
  972|  2.20k|      io_->readOrThrow(buf.data(), 1);
  973|  2.20k|      td2 = Exiv2::find(NormalSoftHard, static_cast<int>(buf.data()[0]) & 7);
  974|  2.20k|      if (td2)
  ------------------
  |  Branch (974:11): [True: 1.00k, False: 1.19k]
  ------------------
  975|  1.00k|        xmpData_["Xmp.video.Contrast"] = _(td2->label_);
  ------------------
  |  |   40|  1.00k|#define _(String) (String)
  ------------------
  976|  1.19k|      else
  977|  1.19k|        xmpData_["Xmp.video.Contrast"] = static_cast<int>(buf.data()[0]) & 7;
  978|       |
  979|  2.20k|      io_->readOrThrow(buf.data(), 1);
  980|  2.20k|      td2 = Exiv2::find(NormalSoftHard, static_cast<int>(buf.data()[0]) & 7);
  981|  2.20k|      if (td2)
  ------------------
  |  Branch (981:11): [True: 1.36k, False: 841]
  ------------------
  982|  1.36k|        xmpData_["Xmp.video.Brightness"] = _(td2->label_);
  ------------------
  |  |   40|  1.36k|#define _(String) (String)
  ------------------
  983|    841|      else
  984|    841|        xmpData_["Xmp.video.Brightness"] = static_cast<int>(buf.data()[0]) & 7;
  985|       |
  986|  2.20k|      io_->readOrThrow(buf.data(), 1);
  987|  2.20k|      td2 = Exiv2::find(Saturation, static_cast<int>(buf.data()[0]) & 7);
  988|  2.20k|      if (td2)
  ------------------
  |  Branch (988:11): [True: 1.21k, False: 987]
  ------------------
  989|  1.21k|        xmpData_["Xmp.video.Saturation"] = _(td2->label_);
  ------------------
  |  |   40|  1.21k|#define _(String) (String)
  ------------------
  990|    987|      else
  991|    987|        xmpData_["Xmp.video.Saturation"] = static_cast<int>(buf.data()[0]) & 7;
  992|       |
  993|  2.20k|      io_->readOrThrow(buf.data(), 1);
  994|  2.20k|      xmpData_["Xmp.video.HueAdjustment"] = static_cast<int>(buf.data()[0]) & 7;
  995|       |
  996|  2.20k|      io_->readOrThrow(buf.data(), 1);
  997|  2.20k|      td2 = Exiv2::find(FilterEffect, static_cast<int>(buf.data()[0]));
  998|  2.20k|      if (td2)
  ------------------
  |  Branch (998:11): [True: 589, False: 1.61k]
  ------------------
  999|    589|        xmpData_["Xmp.video.FilterEffect"] = _(td2->label_);
  ------------------
  |  |   40|    589|#define _(String) (String)
  ------------------
 1000|  1.61k|      else
 1001|  1.61k|        xmpData_["Xmp.video.FilterEffect"] = static_cast<int>(buf.data()[0]);
 1002|       |
 1003|  2.20k|      io_->readOrThrow(buf.data(), 1);
 1004|  2.20k|      td2 = Exiv2::find(ToningEffect, static_cast<int>(buf.data()[0]));
 1005|  2.20k|      if (td2)
  ------------------
  |  Branch (1005:11): [True: 845, False: 1.35k]
  ------------------
 1006|    845|        xmpData_["Xmp.video.ToningEffect"] = _(td2->label_);
  ------------------
  |  |   40|    845|#define _(String) (String)
  ------------------
 1007|  1.35k|      else
 1008|  1.35k|        xmpData_["Xmp.video.ToningEffect"] = static_cast<int>(buf.data()[0]);
 1009|       |
 1010|  2.20k|      io_->readOrThrow(buf.data(), 1);
 1011|  2.20k|      xmpData_["Xmp.video.ToningSaturation"] = static_cast<int>(buf.data()[0]);
 1012|       |
 1013|  2.20k|      io_->seek(local_pos + dataLength, BasicIo::beg);
 1014|  2.20k|    }
 1015|       |
 1016|  64.4k|    else if (TagID == 0x2000024) {
  ------------------
  |  Branch (1016:14): [True: 361, False: 64.0k]
  ------------------
 1017|    361|      size_t local_pos = io_->tell();
 1018|    361|      dataLength = buf.read_uint16(0, bigEndian);
 1019|    361|      std::memset(buf.data(), 0x0, buf.size());
 1020|       |
 1021|    361|      io_->readOrThrow(buf.data(), 2);
 1022|    361|      xmpData_["Xmp.video.TimeZone"] = Exiv2::getShort(buf.data(), bigEndian);
 1023|    361|      io_->readOrThrow(buf.data(), 1);
 1024|    361|      td2 = Exiv2::find(YesNo, static_cast<int>(buf.data()[0]));
 1025|    361|      if (td2)
  ------------------
  |  Branch (1025:11): [True: 208, False: 153]
  ------------------
 1026|    208|        xmpData_["Xmp.video.DayLightSavings"] = _(td2->label_);
  ------------------
  |  |   40|    208|#define _(String) (String)
  ------------------
 1027|       |
 1028|    361|      io_->readOrThrow(buf.data(), 1);
 1029|    361|      td2 = Exiv2::find(DateDisplayFormat, static_cast<int>(buf.data()[0]));
 1030|    361|      if (td2)
  ------------------
  |  Branch (1030:11): [True: 147, False: 214]
  ------------------
 1031|    147|        xmpData_["Xmp.video.DateDisplayFormat"] = _(td2->label_);
  ------------------
  |  |   40|    147|#define _(String) (String)
  ------------------
 1032|       |
 1033|    361|      io_->seek(local_pos + dataLength, BasicIo::beg);
 1034|    361|    }
 1035|       |
 1036|  64.0k|    else if (dataType == 2 || dataType == 7) {
  ------------------
  |  Branch (1036:14): [True: 1.59k, False: 62.4k]
  |  Branch (1036:31): [True: 195, False: 62.2k]
  ------------------
 1037|  1.43k|      dataLength = buf.read_uint16(0, bigEndian);
 1038|  1.43k|      std::memset(buf.data(), 0x0, buf.size());
 1039|       |
 1040|       |      // Sanity check with an "unreasonably" large number
 1041|  1.43k|      if (dataLength >= buf.size()) {
  ------------------
  |  Branch (1041:11): [True: 758, False: 677]
  ------------------
 1042|    758|#ifndef SUPPRESS_WARNINGS
 1043|    758|        EXV_ERROR << "Xmp.video Nikon Tags, dataLength was found to be larger than 200."
  ------------------
  |  |  142|    758|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 758]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    758|  LogMsg(LogMsg::error).os()
  ------------------
 1044|      0|                  << " Entries considered invalid. Not Processed.\n";
 1045|    758|#endif
 1046|    758|        io_->seek(io_->tell() + dataLength, BasicIo::beg);
 1047|    758|        buf.data()[0] = '\0';
 1048|    758|      } else {
 1049|    677|        io_->readOrThrow(buf.data(), dataLength);
 1050|    677|        buf.data()[dataLength] = '\0';
 1051|    677|      }
 1052|       |
 1053|  1.43k|      if (td) {
  ------------------
  |  Branch (1053:11): [True: 493, False: 942]
  ------------------
 1054|    493|        xmpData_[_(td->label_)] = buf.data();
  ------------------
  |  |   40|    493|#define _(String) (String)
  ------------------
 1055|    493|      }
 1056|  62.6k|    } else if (dataType == 4) {
  ------------------
  |  Branch (1056:16): [True: 814, False: 61.7k]
  ------------------
 1057|    814|      dataLength = buf.read_uint16(0, bigEndian) * 4;
 1058|    814|      std::memset(buf.data(), 0x0, buf.size());
 1059|    814|      io_->readOrThrow(buf.data(), 4);
 1060|    814|      if (td)
  ------------------
  |  Branch (1060:11): [True: 436, False: 378]
  ------------------
 1061|    436|        xmpData_[_(td->label_)] = buf.read_uint32(0, bigEndian);
  ------------------
  |  |   40|    436|#define _(String) (String)
  ------------------
 1062|       |
 1063|       |      // Sanity check with an "unreasonably" large number
 1064|    814|      if (dataLength > 200 || dataLength < 4) {
  ------------------
  |  Branch (1064:11): [True: 364, False: 450]
  |  Branch (1064:31): [True: 161, False: 289]
  ------------------
 1065|    524|#ifndef SUPPRESS_WARNINGS
 1066|    524|        EXV_ERROR << "Xmp.video Nikon Tags, dataLength was found to be of inappropriate size."
  ------------------
  |  |  142|    524|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 524]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    524|  LogMsg(LogMsg::error).os()
  ------------------
 1067|      0|                  << " Entries considered invalid. Not Processed.\n";
 1068|    524|#endif
 1069|    524|        io_->seek(io_->tell() + dataLength - 4, BasicIo::beg);
 1070|    524|      } else
 1071|    290|        io_->readOrThrow(buf.data(), dataLength - 4);
 1072|  61.7k|    } else if (dataType == 3) {
  ------------------
  |  Branch (1072:16): [True: 1.91k, False: 59.8k]
  ------------------
 1073|  1.91k|      dataLength = buf.read_uint16(0, bigEndian) * 2;
 1074|  1.91k|      std::memset(buf.data(), 0x0, buf.size());
 1075|  1.91k|      io_->readOrThrow(buf.data(), 2);
 1076|  1.91k|      if (td)
  ------------------
  |  Branch (1076:11): [True: 922, False: 996]
  ------------------
 1077|    922|        xmpData_[_(td->label_)] = buf.read_uint16(0, bigEndian);
  ------------------
  |  |   40|    922|#define _(String) (String)
  ------------------
 1078|       |
 1079|       |      // Sanity check with an "unreasonably" large number
 1080|  1.91k|      if (dataLength > 200 || dataLength < 2) {
  ------------------
  |  Branch (1080:11): [True: 1.57k, False: 347]
  |  Branch (1080:31): [True: 170, False: 177]
  ------------------
 1081|  1.73k|#ifndef SUPPRESS_WARNINGS
 1082|  1.73k|        EXV_ERROR << "Xmp.video Nikon Tags, dataLength was found to be of inappropriate size."
  ------------------
  |  |  142|  1.73k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 1.73k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  1.73k|  LogMsg(LogMsg::error).os()
  ------------------
 1083|      0|                  << " Entries considered invalid. Not Processed.\n";
 1084|  1.73k|#endif
 1085|  1.73k|        io_->seek(io_->tell() + dataLength - 2, BasicIo::beg);
 1086|  1.73k|      } else
 1087|    179|        io_->readOrThrow(buf.data(), dataLength - 2);
 1088|  59.8k|    } else if (dataType == 5) {
  ------------------
  |  Branch (1088:16): [True: 411, False: 59.4k]
  ------------------
 1089|    411|      dataLength = buf.read_uint16(0, bigEndian) * 8;
 1090|    411|      std::memset(buf.data(), 0x0, buf.size());
 1091|    411|      io_->readOrThrow(buf.data(), 4);
 1092|    411|      io_->readOrThrow(buf2.data(), 4);
 1093|    411|      if (td)
  ------------------
  |  Branch (1093:11): [True: 224, False: 187]
  ------------------
 1094|    224|        xmpData_[_(td->label_)] =
  ------------------
  |  |   40|    224|#define _(String) (String)
  ------------------
 1095|    224|            static_cast<double>(buf.read_uint32(0, bigEndian)) / static_cast<double>(buf2.read_uint32(0, bigEndian));
 1096|       |
 1097|       |      // Sanity check with an "unreasonably" large number
 1098|    411|      if (dataLength > 200 || dataLength < 8) {
  ------------------
  |  Branch (1098:11): [True: 221, False: 190]
  |  Branch (1098:31): [True: 120, False: 70]
  ------------------
 1099|    340|#ifndef SUPPRESS_WARNINGS
 1100|    340|        EXV_ERROR << "Xmp.video Nikon Tags, dataLength was found to be of inappropriate size."
  ------------------
  |  |  142|    340|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 340]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    340|  LogMsg(LogMsg::error).os()
  ------------------
 1101|      0|                  << " Entries considered invalid. Not Processed.\n";
 1102|    340|#endif
 1103|    340|        io_->seek(io_->tell() + dataLength - 8, BasicIo::beg);
 1104|    340|      } else
 1105|     71|        io_->readOrThrow(buf.data(), dataLength - 8);
 1106|  59.4k|    } else if (dataType == 8) {
  ------------------
  |  Branch (1106:16): [True: 787, False: 58.6k]
  ------------------
 1107|    787|      dataLength = buf.read_uint16(0, bigEndian) * 2;
 1108|    787|      std::memset(buf.data(), 0x0, buf.size());
 1109|    787|      io_->readOrThrow(buf.data(), 2);
 1110|    787|      io_->readOrThrow(buf2.data(), 2);
 1111|    787|      if (td)
  ------------------
  |  Branch (1111:11): [True: 187, False: 600]
  ------------------
 1112|    187|        xmpData_[_(td->label_)] = stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   40|    187|#define _(String) (String)
  ------------------
                      xmpData_[_(td->label_)] = stringFormat("{}.{}", buf.read_uint16(0, bigEndian), buf2.read_uint16(0, bigEndian));
  ------------------
  |  |   18|    187|#define stringFormat std::format
  ------------------
 1113|       |
 1114|       |      // Sanity check with an "unreasonably" large number
 1115|    787|      if (dataLength > 200 || dataLength < 4) {
  ------------------
  |  Branch (1115:11): [True: 293, False: 494]
  |  Branch (1115:31): [True: 141, False: 353]
  ------------------
 1116|    433|#ifndef SUPPRESS_WARNINGS
 1117|    433|        EXV_ERROR << "Xmp.video Nikon Tags, dataLength was found to be of inappropriate size."
  ------------------
  |  |  142|    433|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 433]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    433|  LogMsg(LogMsg::error).os()
  ------------------
 1118|      0|                  << " Entries considered invalid. Not Processed.\n";
 1119|    433|#endif
 1120|    433|        io_->seek(io_->tell() + dataLength - 4, BasicIo::beg);
 1121|    433|      } else
 1122|    354|        io_->readOrThrow(buf.data(), dataLength - 4);
 1123|    787|    }
 1124|  66.6k|  }
 1125|       |
 1126|    993|  io_->seek(cur_pos + size, BasicIo::beg);
 1127|    993|}  // QuickTimeVideo::NikonTagsDecoder
_ZN5Exiv214QuickTimeVideo14setMediaStreamEm:
 1129|  2.87k|void QuickTimeVideo::setMediaStream(size_t atom_size) {
 1130|  2.87k|  size_t current_position = io_->tell();
 1131|  2.87k|  size_t search_end = Safe::add(current_position, atom_size);
 1132|  2.87k|  if (search_end > io_->size())
  ------------------
  |  Branch (1132:7): [True: 0, False: 2.87k]
  ------------------
 1133|      0|    search_end = io_->size();
 1134|  2.87k|  DataBuf buf(4 + 1);
 1135|       |
 1136|  34.5k|  while (!io_->eof() && Safe::add(io_->tell(), size_t{4}) <= search_end) {
  ------------------
  |  Branch (1136:10): [True: 34.5k, False: 0]
  |  Branch (1136:25): [True: 33.6k, False: 899]
  ------------------
 1137|  33.6k|    io_->readOrThrow(buf.data(), 4);
 1138|  33.6k|    if (equalsQTimeTag(buf, "hdlr")) {
  ------------------
  |  Branch (1138:9): [True: 1.98k, False: 31.6k]
  ------------------
 1139|  1.98k|      if (Safe::add(io_->tell(), size_t{12}) > search_end)
  ------------------
  |  Branch (1139:11): [True: 23, False: 1.95k]
  ------------------
 1140|     23|        break;
 1141|  1.95k|      io_->readOrThrow(buf.data(), 4);
 1142|  1.95k|      io_->readOrThrow(buf.data(), 4);
 1143|  1.95k|      io_->readOrThrow(buf.data(), 4);
 1144|       |
 1145|  1.95k|      if (equalsQTimeTag(buf, "vide"))
  ------------------
  |  Branch (1145:11): [True: 40, False: 1.91k]
  ------------------
 1146|     40|        currentStream_ = Video;
 1147|  1.91k|      else if (equalsQTimeTag(buf, "soun"))
  ------------------
  |  Branch (1147:16): [True: 416, False: 1.50k]
  ------------------
 1148|    416|        currentStream_ = Audio;
 1149|  1.50k|      else if (equalsQTimeTag(buf, "hint"))
  ------------------
  |  Branch (1149:16): [True: 53, False: 1.44k]
  ------------------
 1150|     53|        currentStream_ = Hint;
 1151|  1.44k|      else
 1152|  1.44k|        currentStream_ = GenMediaHeader;
 1153|  1.95k|      break;
 1154|  1.98k|    }
 1155|  33.6k|  }
 1156|       |
 1157|  2.87k|  io_->seek(current_position, BasicIo::beg);
 1158|  2.87k|}  // QuickTimeVideo::setMediaStream
_ZN5Exiv214QuickTimeVideo19timeToSampleDecoderEv:
 1160|    998|void QuickTimeVideo::timeToSampleDecoder() {
 1161|    998|  DataBuf buf(4 + 1);
 1162|    998|  io_->readOrThrow(buf.data(), 4);
 1163|    998|  io_->readOrThrow(buf.data(), 4);
 1164|    998|  uint64_t totalframes = 0;
 1165|    998|  uint64_t timeOfFrames = 0;
 1166|    998|  const uint32_t noOfEntries = buf.read_uint32(0, bigEndian);
 1167|       |
 1168|  2.47k|  for (uint32_t i = 0; i < noOfEntries; i++) {
  ------------------
  |  Branch (1168:24): [True: 1.48k, False: 998]
  ------------------
 1169|  1.48k|    io_->readOrThrow(buf.data(), 4);
 1170|  1.48k|    const uint64_t temp = buf.read_uint32(0, bigEndian);
 1171|  1.48k|    totalframes = Safe::add(totalframes, temp);
 1172|  1.48k|    io_->readOrThrow(buf.data(), 4);
 1173|  1.48k|    timeOfFrames = Safe::add(timeOfFrames, temp * buf.read_uint32(0, bigEndian));
 1174|  1.48k|  }
 1175|    998|  if (currentStream_ == Video) {
  ------------------
  |  Branch (1175:7): [True: 559, False: 439]
  ------------------
 1176|    559|    if (timeOfFrames == 0)
  ------------------
  |  Branch (1176:9): [True: 294, False: 265]
  ------------------
 1177|    294|      timeOfFrames = 1;
 1178|    559|    xmpData_["Xmp.video.FrameRate"] =
 1179|    559|        static_cast<double>(totalframes) * static_cast<double>(mdhdTimeScale_) / static_cast<double>(timeOfFrames);
 1180|    559|  }
 1181|    998|}  // QuickTimeVideo::timeToSampleDecoder
_ZN5Exiv214QuickTimeVideo10sampleDescEm:
 1183|    808|void QuickTimeVideo::sampleDesc(size_t size) {
 1184|    808|  DataBuf buf(100);
 1185|    808|  size_t cur_pos = io_->tell();
 1186|    808|  io_->readOrThrow(buf.data(), 4);
 1187|    808|  io_->readOrThrow(buf.data(), 4);
 1188|    808|  const uint32_t noOfEntries = buf.read_uint32(0, bigEndian);
 1189|       |
 1190|   118k|  for (uint32_t i = 0; i < noOfEntries; i++) {
  ------------------
  |  Branch (1190:24): [True: 118k, False: 625]
  ------------------
 1191|   118k|    if (currentStream_ == Video)
  ------------------
  |  Branch (1191:9): [True: 53.3k, False: 65.0k]
  ------------------
 1192|  53.3k|      imageDescDecoder();
 1193|  65.0k|    else if (currentStream_ == Audio)
  ------------------
  |  Branch (1193:14): [True: 64.8k, False: 183]
  ------------------
 1194|  64.8k|      audioDescDecoder();
 1195|    183|    else
 1196|    183|      break;
 1197|   118k|  }
 1198|    808|  io_->seek(Safe::add(cur_pos, size), BasicIo::beg);
 1199|    808|}  // QuickTimeVideo::sampleDesc
_ZN5Exiv214QuickTimeVideo16audioDescDecoderEv:
 1201|  64.8k|void QuickTimeVideo::audioDescDecoder() {
 1202|  64.8k|  DataBuf buf(40);
 1203|  64.8k|  std::memset(buf.data(), 0x0, buf.size());
 1204|  64.8k|  buf.data()[4] = '\0';
 1205|  64.8k|  io_->readOrThrow(buf.data(), 4);
 1206|  64.8k|  size_t size = 82;
 1207|       |
 1208|  64.8k|  const TagVocabulary* td;
 1209|       |
 1210|  1.36M|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1210:19): [True: 1.29M, False: 64.7k]
  ------------------
 1211|  1.29M|    io_->readOrThrow(buf.data(), 4);
 1212|  1.29M|    switch (i) {
 1213|  64.8k|      case AudioFormat:
  ------------------
  |  Branch (1213:7): [True: 64.8k, False: 1.23M]
  ------------------
 1214|  64.8k|        td = Exiv2::find(qTimeFileType, Exiv2::toString(buf.data()));
 1215|  64.8k|        if (td)
  ------------------
  |  Branch (1215:13): [True: 372, False: 64.4k]
  ------------------
 1216|    372|          xmpData_["Xmp.audio.Compressor"] = _(td->label_);
  ------------------
  |  |   40|    372|#define _(String) (String)
  ------------------
 1217|  64.4k|        else
 1218|  64.4k|          xmpData_["Xmp.audio.Compressor"] = buf.data();
 1219|  64.8k|        break;
 1220|  64.8k|      case AudioVendorID:
  ------------------
  |  Branch (1220:7): [True: 64.8k, False: 1.23M]
  ------------------
 1221|  64.8k|        td = Exiv2::find(vendorIDTags, Exiv2::toString(buf.data()));
 1222|  64.8k|        if (td)
  ------------------
  |  Branch (1222:13): [True: 794, False: 64.0k]
  ------------------
 1223|    794|          xmpData_["Xmp.audio.VendorID"] = _(td->label_);
  ------------------
  |  |   40|    794|#define _(String) (String)
  ------------------
 1224|  64.8k|        break;
 1225|  64.8k|      case AudioChannels:
  ------------------
  |  Branch (1225:7): [True: 64.8k, False: 1.23M]
  ------------------
 1226|  64.8k|        xmpData_["Xmp.audio.ChannelType"] = buf.read_uint16(0, bigEndian);
 1227|  64.8k|        xmpData_["Xmp.audio.BitsPerSample"] = ((buf.data()[2] * 256) + buf.data()[3]);
 1228|  64.8k|        break;
 1229|  64.7k|      case AudioSampleRate:
  ------------------
  |  Branch (1229:7): [True: 64.7k, False: 1.23M]
  ------------------
 1230|  64.7k|        xmpData_["Xmp.audio.SampleRate"] =
 1231|  64.7k|            buf.read_uint16(0, bigEndian) + ((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1232|  64.7k|        break;
 1233|  1.03M|      default:
  ------------------
  |  Branch (1233:7): [True: 1.03M, False: 259k]
  ------------------
 1234|  1.03M|        break;
 1235|  1.29M|    }
 1236|  1.29M|  }
 1237|  64.7k|  io_->readOrThrow(buf.data(), static_cast<long>(size % 4));  // cause size is so small, this cast should be right.
 1238|  64.7k|}  // QuickTimeVideo::audioDescDecoder
_ZN5Exiv214QuickTimeVideo16imageDescDecoderEv:
 1240|  53.3k|void QuickTimeVideo::imageDescDecoder() {
 1241|  53.3k|  DataBuf buf(40);
 1242|  53.3k|  std::memset(buf.data(), 0x0, buf.size());
 1243|  53.3k|  buf.data()[4] = '\0';
 1244|  53.3k|  io_->readOrThrow(buf.data(), 4);
 1245|  53.3k|  size_t size = 82;
 1246|       |
 1247|  53.3k|  const TagVocabulary* td;
 1248|       |
 1249|   639k|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1249:19): [True: 586k, False: 53.2k]
  ------------------
 1250|   586k|    io_->readOrThrow(buf.data(), 4);
 1251|   586k|    buf.write_uint8(4, 0);  // nul-terminate string
 1252|       |
 1253|   586k|    switch (i) {
 1254|  53.3k|      case codec:
  ------------------
  |  Branch (1254:7): [True: 53.3k, False: 532k]
  ------------------
 1255|  53.3k|        td = Exiv2::find(qTimeFileType, Exiv2::toString(buf.data()));
 1256|  53.3k|        if (td)
  ------------------
  |  Branch (1256:13): [True: 321, False: 52.9k]
  ------------------
 1257|    321|          xmpData_["Xmp.video.Codec"] = _(td->label_);
  ------------------
  |  |   40|    321|#define _(String) (String)
  ------------------
 1258|  52.9k|        else
 1259|  52.9k|          xmpData_["Xmp.video.Codec"] = buf.data();
 1260|  53.3k|        break;
 1261|  53.2k|      case VendorID:
  ------------------
  |  Branch (1261:7): [True: 53.2k, False: 532k]
  ------------------
 1262|  53.2k|        td = Exiv2::find(vendorIDTags, Exiv2::toString(buf.data()));
 1263|  53.2k|        if (td)
  ------------------
  |  Branch (1263:13): [True: 715, False: 52.5k]
  ------------------
 1264|    715|          xmpData_["Xmp.video.VendorID"] = _(td->label_);
  ------------------
  |  |   40|    715|#define _(String) (String)
  ------------------
 1265|  53.2k|        break;
 1266|  53.2k|      case SourceImageWidth_Height:
  ------------------
  |  Branch (1266:7): [True: 53.2k, False: 532k]
  ------------------
 1267|  53.2k|        xmpData_["Xmp.video.SourceImageWidth"] = buf.read_uint16(0, bigEndian);
 1268|  53.2k|        xmpData_["Xmp.video.SourceImageHeight"] = ((buf.data()[2] * 256) + buf.data()[3]);
 1269|  53.2k|        break;
 1270|  53.2k|      case XResolution:
  ------------------
  |  Branch (1270:7): [True: 53.2k, False: 532k]
  ------------------
 1271|  53.2k|        xmpData_["Xmp.video.XResolution"] =
 1272|  53.2k|            buf.read_uint16(0, bigEndian) + ((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1273|  53.2k|        break;
 1274|  53.2k|      case YResolution:
  ------------------
  |  Branch (1274:7): [True: 53.2k, False: 532k]
  ------------------
 1275|  53.2k|        xmpData_["Xmp.video.YResolution"] =
 1276|  53.2k|            buf.read_uint16(0, bigEndian) + ((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1277|  53.2k|        io_->readOrThrow(buf.data(), 3);
 1278|  53.2k|        size -= 3;
 1279|  53.2k|        break;
 1280|  53.2k|      case CompressorName:
  ------------------
  |  Branch (1280:7): [True: 53.2k, False: 532k]
  ------------------
 1281|  53.2k|        io_->readOrThrow(buf.data(), 32);
 1282|  53.2k|        size -= 32;
 1283|  53.2k|        xmpData_["Xmp.video.Compressor"] = buf.data();
 1284|  53.2k|        break;
 1285|   266k|      default:
  ------------------
  |  Branch (1285:7): [True: 266k, False: 319k]
  ------------------
 1286|   266k|        break;
 1287|   586k|    }
 1288|   586k|  }
 1289|  53.2k|  io_->readOrThrow(buf.data(), static_cast<long>(size % 4));
 1290|  53.2k|  xmpData_["Xmp.video.BitDepth"] = static_cast<int>(buf.read_uint8(0));
 1291|  53.2k|}  // QuickTimeVideo::imageDescDecoder
_ZN5Exiv214QuickTimeVideo22multipleEntriesDecoderEm:
 1293|  2.24k|void QuickTimeVideo::multipleEntriesDecoder(size_t recursion_depth) {
 1294|  2.24k|  enforce(recursion_depth < max_recursion_depth_, Exiv2::ErrorCode::kerCorruptedMetadata);
 1295|  2.24k|  DataBuf buf(4 + 1);
 1296|  2.24k|  io_->readOrThrow(buf.data(), 4);
 1297|  2.24k|  io_->readOrThrow(buf.data(), 4);
 1298|  2.24k|  uint32_t noOfEntries;
 1299|       |
 1300|  2.24k|  noOfEntries = buf.read_uint32(0, bigEndian);
 1301|       |
 1302|  4.86k|  for (uint32_t i = 0; i < noOfEntries && continueTraversing_; i++) {
  ------------------
  |  Branch (1302:24): [True: 2.89k, False: 1.96k]
  |  Branch (1302:43): [True: 2.61k, False: 280]
  ------------------
 1303|  2.61k|    decodeBlock(recursion_depth + 1);
 1304|  2.61k|  }
 1305|  2.24k|}  // QuickTimeVideo::multipleEntriesDecoder
_ZN5Exiv214QuickTimeVideo18videoHeaderDecoderEm:
 1307|  2.54k|void QuickTimeVideo::videoHeaderDecoder(size_t size) {
 1308|  2.54k|  DataBuf buf(3);
 1309|  2.54k|  std::memset(buf.data(), 0x0, buf.size());
 1310|  2.54k|  buf.data()[2] = '\0';
 1311|  2.54k|  currentStream_ = Video;
 1312|       |
 1313|  2.54k|  const TagDetails* td;
 1314|       |
 1315|  15.9k|  for (int i = 0; size / 2 != 0; size -= 2, i++) {
  ------------------
  |  Branch (1315:19): [True: 13.3k, False: 2.54k]
  ------------------
 1316|  13.3k|    io_->readOrThrow(buf.data(), 2);
 1317|       |
 1318|  13.3k|    switch (i) {
 1319|  2.44k|      case GraphicsMode:
  ------------------
  |  Branch (1319:7): [True: 2.44k, False: 10.9k]
  ------------------
 1320|  2.44k|        td = Exiv2::find(graphicsModetags, buf.read_uint16(0, bigEndian));
 1321|  2.44k|        if (td)
  ------------------
  |  Branch (1321:13): [True: 2.05k, False: 392]
  ------------------
 1322|  2.05k|          xmpData_["Xmp.video.GraphicsMode"] = _(td->label_);
  ------------------
  |  |   40|  2.05k|#define _(String) (String)
  ------------------
 1323|  2.44k|        break;
 1324|  2.44k|      case OpColor:
  ------------------
  |  Branch (1324:7): [True: 2.44k, False: 10.9k]
  ------------------
 1325|  2.44k|        xmpData_["Xmp.video.OpColor"] = buf.read_uint16(0, bigEndian);
 1326|  2.44k|        break;
 1327|  8.46k|      default:
  ------------------
  |  Branch (1327:7): [True: 8.46k, False: 4.89k]
  ------------------
 1328|  8.46k|        break;
 1329|  13.3k|    }
 1330|  13.3k|  }
 1331|  2.54k|  io_->readOrThrow(buf.data(), size % 2);
 1332|  2.54k|}  // QuickTimeVideo::videoHeaderDecoder
_ZN5Exiv214QuickTimeVideo14handlerDecoderEm:
 1334|  3.15k|void QuickTimeVideo::handlerDecoder(size_t size) {
 1335|  3.15k|  size_t cur_pos = io_->tell();
 1336|  3.15k|  DataBuf buf(5);
 1337|  3.15k|  std::memset(buf.data(), 0x0, buf.size());
 1338|  3.15k|  buf.data()[4] = '\0';
 1339|       |
 1340|  3.15k|  const TagVocabulary* tv;
 1341|       |
 1342|  18.9k|  for (int i = 0; i < 5; i++) {
  ------------------
  |  Branch (1342:19): [True: 15.7k, False: 3.15k]
  ------------------
 1343|  15.7k|    io_->readOrThrow(buf.data(), 4);
 1344|       |
 1345|  15.7k|    switch (i) {
  ------------------
  |  Branch (1345:13): [True: 9.46k, False: 6.31k]
  ------------------
 1346|  3.15k|      case HandlerClass:
  ------------------
  |  Branch (1346:7): [True: 3.15k, False: 12.6k]
  ------------------
 1347|  3.15k|        tv = Exiv2::find(handlerClassTags, Exiv2::toString(buf.data()));
 1348|  3.15k|        if (tv) {
  ------------------
  |  Branch (1348:13): [True: 1.01k, False: 2.13k]
  ------------------
 1349|  1.01k|          if (currentStream_ == Video)
  ------------------
  |  Branch (1349:15): [True: 246, False: 771]
  ------------------
 1350|    246|            xmpData_["Xmp.video.HandlerClass"] = _(tv->label_);
  ------------------
  |  |   40|    246|#define _(String) (String)
  ------------------
 1351|    771|          else if (currentStream_ == Audio)
  ------------------
  |  Branch (1351:20): [True: 245, False: 526]
  ------------------
 1352|    245|            xmpData_["Xmp.audio.HandlerClass"] = _(tv->label_);
  ------------------
  |  |   40|    245|#define _(String) (String)
  ------------------
 1353|  1.01k|        }
 1354|  3.15k|        break;
 1355|  3.15k|      case HandlerType:
  ------------------
  |  Branch (1355:7): [True: 3.15k, False: 12.6k]
  ------------------
 1356|  3.15k|        tv = Exiv2::find(handlerTypeTags, Exiv2::toString(buf.data()));
 1357|  3.15k|        if (tv) {
  ------------------
  |  Branch (1357:13): [True: 1.81k, False: 1.34k]
  ------------------
 1358|  1.81k|          if (currentStream_ == Video)
  ------------------
  |  Branch (1358:15): [True: 423, False: 1.38k]
  ------------------
 1359|    423|            xmpData_["Xmp.video.HandlerType"] = _(tv->label_);
  ------------------
  |  |   40|    423|#define _(String) (String)
  ------------------
 1360|  1.38k|          else if (currentStream_ == Audio)
  ------------------
  |  Branch (1360:20): [True: 489, False: 900]
  ------------------
 1361|    489|            xmpData_["Xmp.audio.HandlerType"] = _(tv->label_);
  ------------------
  |  |   40|    489|#define _(String) (String)
  ------------------
 1362|  1.81k|        }
 1363|  3.15k|        break;
 1364|  3.15k|      case HandlerVendorID:
  ------------------
  |  Branch (1364:7): [True: 3.15k, False: 12.6k]
  ------------------
 1365|  3.15k|        tv = Exiv2::find(vendorIDTags, Exiv2::toString(buf.data()));
 1366|  3.15k|        if (tv) {
  ------------------
  |  Branch (1366:13): [True: 748, False: 2.40k]
  ------------------
 1367|    748|          if (currentStream_ == Video)
  ------------------
  |  Branch (1367:15): [True: 88, False: 660]
  ------------------
 1368|     88|            xmpData_["Xmp.video.HandlerVendorID"] = _(tv->label_);
  ------------------
  |  |   40|     88|#define _(String) (String)
  ------------------
 1369|    660|          else if (currentStream_ == Audio)
  ------------------
  |  Branch (1369:20): [True: 179, False: 481]
  ------------------
 1370|    179|            xmpData_["Xmp.audio.HandlerVendorID"] = _(tv->label_);
  ------------------
  |  |   40|    179|#define _(String) (String)
  ------------------
 1371|    748|        }
 1372|  3.15k|        break;
 1373|  15.7k|    }
 1374|  15.7k|  }
 1375|  3.15k|  io_->seek(cur_pos + size, BasicIo::beg);
 1376|  3.15k|}  // QuickTimeVideo::handlerDecoder
_ZN5Exiv214QuickTimeVideo15fileTypeDecoderEm:
 1378|  2.79k|void QuickTimeVideo::fileTypeDecoder(size_t size) {
 1379|  2.79k|  DataBuf buf(5);
 1380|  2.79k|  std::memset(buf.data(), 0x0, buf.size());
 1381|  2.79k|  buf.data()[4] = '\0';
 1382|  2.79k|  Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpSeq);
 1383|  2.79k|  const TagVocabulary* td;
 1384|       |
 1385|  17.3k|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1385:19): [True: 14.5k, False: 2.79k]
  ------------------
 1386|  14.5k|    io_->readOrThrow(buf.data(), 4);
 1387|  14.5k|    td = Exiv2::find(qTimeFileType, Exiv2::toString(buf.data()));
 1388|       |
 1389|  14.5k|    switch (i) {
 1390|  2.76k|      case 0:
  ------------------
  |  Branch (1390:7): [True: 2.76k, False: 11.7k]
  ------------------
 1391|  2.76k|        if (td)
  ------------------
  |  Branch (1391:13): [True: 1.13k, False: 1.63k]
  ------------------
 1392|  1.13k|          xmpData_["Xmp.video.MajorBrand"] = _(td->label_);
  ------------------
  |  |   40|  1.13k|#define _(String) (String)
  ------------------
 1393|  2.76k|        break;
 1394|  1.04k|      case 1:
  ------------------
  |  Branch (1394:7): [True: 1.04k, False: 13.4k]
  ------------------
 1395|  1.04k|        xmpData_["Xmp.video.MinorVersion"] = buf.read_uint32(0, bigEndian);
 1396|  1.04k|        break;
 1397|  10.7k|      default:
  ------------------
  |  Branch (1397:7): [True: 10.7k, False: 3.81k]
  ------------------
 1398|  10.7k|        if (td)
  ------------------
  |  Branch (1398:13): [True: 654, False: 10.0k]
  ------------------
 1399|    654|          v->read(_(td->label_));
  ------------------
  |  |   40|    654|#define _(String) (String)
  ------------------
 1400|  10.0k|        else
 1401|  10.0k|          v->read(Exiv2::toString(buf.data()));
 1402|  10.7k|        break;
 1403|  14.5k|    }
 1404|  14.5k|  }
 1405|  2.79k|  xmpData_.add(Exiv2::XmpKey("Xmp.video.CompatibleBrands"), v.get());
 1406|  2.79k|  io_->readOrThrow(buf.data(), size % 4);
 1407|  2.79k|}  // QuickTimeVideo::fileTypeDecoder
_ZN5Exiv214QuickTimeVideo18mediaHeaderDecoderEm:
 1409|    683|void QuickTimeVideo::mediaHeaderDecoder(size_t size) {
 1410|    683|  DataBuf buf(5);
 1411|    683|  std::memset(buf.data(), 0x0, buf.size());
 1412|    683|  buf.data()[4] = '\0';
 1413|    683|  int64_t time_scale = 1;
 1414|       |
 1415|  3.06k|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1415:19): [True: 2.38k, False: 683]
  ------------------
 1416|  2.38k|    io_->readOrThrow(buf.data(), 4);
 1417|       |
 1418|  2.38k|    switch (i) {
 1419|    412|      case MediaHeaderVersion:
  ------------------
  |  Branch (1419:7): [True: 412, False: 1.97k]
  ------------------
 1420|    412|        if (currentStream_ == Video)
  ------------------
  |  Branch (1420:13): [True: 114, False: 298]
  ------------------
 1421|    114|          xmpData_["Xmp.video.MediaHeaderVersion"] = static_cast<int>(buf.read_uint8(0));
 1422|    298|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1422:18): [True: 91, False: 207]
  ------------------
 1423|     91|          xmpData_["Xmp.audio.MediaHeaderVersion"] = static_cast<int>(buf.read_uint8(0));
 1424|    412|        break;
 1425|    401|      case MediaCreateDate:
  ------------------
  |  Branch (1425:7): [True: 401, False: 1.98k]
  ------------------
 1426|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1427|    401|        if (currentStream_ == Video)
  ------------------
  |  Branch (1427:13): [True: 103, False: 298]
  ------------------
 1428|    103|          xmpData_["Xmp.video.MediaCreateDate"] = buf.read_uint32(0, bigEndian);
 1429|    298|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1429:18): [True: 91, False: 207]
  ------------------
 1430|     91|          xmpData_["Xmp.audio.MediaCreateDate"] = buf.read_uint32(0, bigEndian);
 1431|    401|        break;
 1432|    313|      case MediaModifyDate:
  ------------------
  |  Branch (1432:7): [True: 313, False: 2.07k]
  ------------------
 1433|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1434|    313|        if (currentStream_ == Video)
  ------------------
  |  Branch (1434:13): [True: 32, False: 281]
  ------------------
 1435|     32|          xmpData_["Xmp.video.MediaModifyDate"] = buf.read_uint32(0, bigEndian);
 1436|    281|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1436:18): [True: 91, False: 190]
  ------------------
 1437|     91|          xmpData_["Xmp.audio.MediaModifyDate"] = buf.read_uint32(0, bigEndian);
 1438|    313|        break;
 1439|    313|      case MediaTimeScale:
  ------------------
  |  Branch (1439:7): [True: 313, False: 2.07k]
  ------------------
 1440|    313|        if (currentStream_ == Video)
  ------------------
  |  Branch (1440:13): [True: 32, False: 281]
  ------------------
 1441|     32|          xmpData_["Xmp.video.MediaTimeScale"] = buf.read_uint32(0, bigEndian);
 1442|    281|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1442:18): [True: 91, False: 190]
  ------------------
 1443|     91|          xmpData_["Xmp.audio.MediaTimeScale"] = buf.read_uint32(0, bigEndian);
 1444|    313|        time_scale = std::max(1U, buf.read_uint32(0, bigEndian));
 1445|    313|        mdhdTimeScale_ = time_scale;
 1446|    313|        break;
 1447|    312|      case MediaDuration:
  ------------------
  |  Branch (1447:7): [True: 312, False: 2.07k]
  ------------------
 1448|    312|        if (currentStream_ == Video)
  ------------------
  |  Branch (1448:13): [True: 31, False: 281]
  ------------------
 1449|     31|          xmpData_["Xmp.video.MediaDuration"] = time_scale ? buf.read_uint32(0, bigEndian) / time_scale : 0;
  ------------------
  |  Branch (1449:49): [True: 31, False: 0]
  ------------------
 1450|    281|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1450:18): [True: 91, False: 190]
  ------------------
 1451|     91|          xmpData_["Xmp.audio.MediaDuration"] = time_scale ? buf.read_uint32(0, bigEndian) / time_scale : 0;
  ------------------
  |  Branch (1451:49): [True: 91, False: 0]
  ------------------
 1452|    312|        break;
 1453|    312|      case MediaLanguageCode:
  ------------------
  |  Branch (1453:7): [True: 312, False: 2.07k]
  ------------------
 1454|    312|        if (currentStream_ == Video)
  ------------------
  |  Branch (1454:13): [True: 31, False: 281]
  ------------------
 1455|     31|          xmpData_["Xmp.video.MediaLangCode"] = buf.read_uint16(0, bigEndian);
 1456|    281|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1456:18): [True: 91, False: 190]
  ------------------
 1457|     91|          xmpData_["Xmp.audio.MediaLangCode"] = buf.read_uint16(0, bigEndian);
 1458|    312|        break;
 1459|       |
 1460|    323|      default:
  ------------------
  |  Branch (1460:7): [True: 323, False: 2.06k]
  ------------------
 1461|    323|        break;
 1462|  2.38k|    }
 1463|  2.38k|  }
 1464|    683|  io_->readOrThrow(buf.data(), size % 4);
 1465|    683|}  // QuickTimeVideo::mediaHeaderDecoder
_ZN5Exiv214QuickTimeVideo18trackHeaderDecoderEm:
 1467|    568|void QuickTimeVideo::trackHeaderDecoder(size_t size) {
 1468|    568|  DataBuf buf(5);
 1469|    568|  std::memset(buf.data(), 0x0, buf.size());
 1470|    568|  buf.data()[4] = '\0';
 1471|    568|  int64_t temp = 0;
 1472|       |
 1473|  7.78k|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1473:19): [True: 7.21k, False: 568]
  ------------------
 1474|  7.21k|    io_->readOrThrow(buf.data(), 4);
 1475|       |
 1476|  7.21k|    switch (i) {
 1477|    365|      case TrackHeaderVersion:
  ------------------
  |  Branch (1477:7): [True: 365, False: 6.85k]
  ------------------
 1478|    365|        if (currentStream_ == Video)
  ------------------
  |  Branch (1478:13): [True: 51, False: 314]
  ------------------
 1479|     51|          xmpData_["Xmp.video.TrackHeaderVersion"] = static_cast<int>(buf.read_uint8(0));
 1480|    314|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1480:18): [True: 124, False: 190]
  ------------------
 1481|    124|          xmpData_["Xmp.audio.TrackHeaderVersion"] = static_cast<int>(buf.read_uint8(0));
 1482|    365|        break;
 1483|    364|      case TrackCreateDate:
  ------------------
  |  Branch (1483:7): [True: 364, False: 6.85k]
  ------------------
 1484|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1485|    364|        if (currentStream_ == Video)
  ------------------
  |  Branch (1485:13): [True: 51, False: 313]
  ------------------
 1486|     51|          xmpData_["Xmp.video.TrackCreateDate"] = buf.read_uint32(0, bigEndian);
 1487|    313|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1487:18): [True: 124, False: 189]
  ------------------
 1488|    124|          xmpData_["Xmp.audio.TrackCreateDate"] = buf.read_uint32(0, bigEndian);
 1489|    364|        break;
 1490|    363|      case TrackModifyDate:
  ------------------
  |  Branch (1490:7): [True: 363, False: 6.85k]
  ------------------
 1491|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1492|    363|        if (currentStream_ == Video)
  ------------------
  |  Branch (1492:13): [True: 51, False: 312]
  ------------------
 1493|     51|          xmpData_["Xmp.video.TrackModifyDate"] = buf.read_uint32(0, bigEndian);
 1494|    312|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1494:18): [True: 124, False: 188]
  ------------------
 1495|    124|          xmpData_["Xmp.audio.TrackModifyDate"] = buf.read_uint32(0, bigEndian);
 1496|    363|        break;
 1497|    362|      case TrackID:
  ------------------
  |  Branch (1497:7): [True: 362, False: 6.85k]
  ------------------
 1498|    362|        if (currentStream_ == Video)
  ------------------
  |  Branch (1498:13): [True: 51, False: 311]
  ------------------
 1499|     51|          xmpData_["Xmp.video.TrackID"] = buf.read_uint32(0, bigEndian);
 1500|    311|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1500:18): [True: 124, False: 187]
  ------------------
 1501|    124|          xmpData_["Xmp.audio.TrackID"] = buf.read_uint32(0, bigEndian);
 1502|    362|        break;
 1503|    360|      case TrackDuration:
  ------------------
  |  Branch (1503:7): [True: 360, False: 6.85k]
  ------------------
 1504|    360|        if (currentStream_ == Video)
  ------------------
  |  Branch (1504:13): [True: 50, False: 310]
  ------------------
 1505|     50|          xmpData_["Xmp.video.TrackDuration"] = mvhdTimeScale_ ? buf.read_uint32(0, bigEndian) / mvhdTimeScale_ : 0;
  ------------------
  |  Branch (1505:49): [True: 50, False: 0]
  ------------------
 1506|    310|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1506:18): [True: 124, False: 186]
  ------------------
 1507|    124|          xmpData_["Xmp.audio.TrackDuration"] = mvhdTimeScale_ ? buf.read_uint32(0, bigEndian) / mvhdTimeScale_ : 0;
  ------------------
  |  Branch (1507:49): [True: 124, False: 0]
  ------------------
 1508|    360|        break;
 1509|    332|      case TrackLayer:
  ------------------
  |  Branch (1509:7): [True: 332, False: 6.88k]
  ------------------
 1510|    332|        if (currentStream_ == Video)
  ------------------
  |  Branch (1510:13): [True: 29, False: 303]
  ------------------
 1511|     29|          xmpData_["Xmp.video.TrackLayer"] = buf.read_uint16(0, bigEndian);
 1512|    303|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1512:18): [True: 124, False: 179]
  ------------------
 1513|    124|          xmpData_["Xmp.audio.TrackLayer"] = buf.read_uint16(0, bigEndian);
 1514|    332|        break;
 1515|    332|      case TrackVolume:
  ------------------
  |  Branch (1515:7): [True: 332, False: 6.88k]
  ------------------
 1516|    332|        if (currentStream_ == Video)
  ------------------
  |  Branch (1516:13): [True: 29, False: 303]
  ------------------
 1517|     29|          xmpData_["Xmp.video.TrackVolume"] = (static_cast<int>(buf.read_uint8(0)) + (buf.data()[2] * 0.1)) * 100;
 1518|    303|        else if (currentStream_ == Audio)
  ------------------
  |  Branch (1518:18): [True: 124, False: 179]
  ------------------
 1519|    124|          xmpData_["Xmp.video.TrackVolume"] = (static_cast<int>(buf.read_uint8(0)) + (buf.data()[2] * 0.1)) * 100;
 1520|    332|        break;
 1521|    328|      case ImageWidth:
  ------------------
  |  Branch (1521:7): [True: 328, False: 6.88k]
  ------------------
 1522|    328|        if (currentStream_ == Video) {
  ------------------
  |  Branch (1522:13): [True: 29, False: 299]
  ------------------
 1523|     29|          temp = buf.read_uint16(0, bigEndian) + static_cast<int64_t>((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1524|     29|          xmpData_["Xmp.video.Width"] = temp;
 1525|     29|          width_ = temp;
 1526|     29|        }
 1527|    328|        break;
 1528|    328|      case ImageHeight:
  ------------------
  |  Branch (1528:7): [True: 328, False: 6.88k]
  ------------------
 1529|    328|        if (currentStream_ == Video) {
  ------------------
  |  Branch (1529:13): [True: 29, False: 299]
  ------------------
 1530|     29|          temp = buf.read_uint16(0, bigEndian) + static_cast<int64_t>((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1531|     29|          xmpData_["Xmp.video.Height"] = temp;
 1532|     29|          height_ = temp;
 1533|     29|        }
 1534|    328|        break;
 1535|  4.08k|      default:
  ------------------
  |  Branch (1535:7): [True: 4.08k, False: 3.13k]
  ------------------
 1536|  4.08k|        break;
 1537|  7.21k|    }
 1538|  7.21k|  }
 1539|    568|  io_->readOrThrow(buf.data(), size % 4);
 1540|    568|}  // QuickTimeVideo::trackHeaderDecoder
_ZN5Exiv214QuickTimeVideo18movieHeaderDecoderEm:
 1542|     57|void QuickTimeVideo::movieHeaderDecoder(size_t size) {
 1543|     57|  DataBuf buf(5);
 1544|     57|  std::memset(buf.data(), 0x0, buf.size());
 1545|     57|  buf.data()[4] = '\0';
 1546|       |
 1547|  1.11k|  for (int i = 0; size / 4 != 0; size -= 4, i++) {
  ------------------
  |  Branch (1547:19): [True: 1.05k, False: 57]
  ------------------
 1548|  1.05k|    io_->readOrThrow(buf.data(), 4);
 1549|       |
 1550|  1.05k|    switch (i) {
 1551|     48|      case MovieHeaderVersion:
  ------------------
  |  Branch (1551:7): [True: 48, False: 1.00k]
  ------------------
 1552|     48|        xmpData_["Xmp.video.MovieHeaderVersion"] = static_cast<int>(buf.read_uint8(0));
 1553|     48|        break;
 1554|     47|      case CreateDate:
  ------------------
  |  Branch (1554:7): [True: 47, False: 1.00k]
  ------------------
 1555|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1556|     47|        xmpData_["Xmp.video.DateUTC"] = buf.read_uint32(0, bigEndian);
 1557|     47|        break;
 1558|     46|      case ModifyDate:
  ------------------
  |  Branch (1558:7): [True: 46, False: 1.01k]
  ------------------
 1559|       |        // A 32-bit integer that specifies (in seconds since midnight, January 1, 1904) when the movie atom was created.
 1560|     46|        xmpData_["Xmp.video.ModificationDate"] = buf.read_uint32(0, bigEndian);
 1561|     46|        break;
 1562|     45|      case TimeScale:
  ------------------
  |  Branch (1562:7): [True: 45, False: 1.01k]
  ------------------
 1563|     45|        xmpData_["Xmp.video.TimeScale"] = buf.read_uint32(0, bigEndian);
 1564|     45|        mvhdTimeScale_ = std::max(1U, buf.read_uint32(0, bigEndian));
 1565|     45|        break;
 1566|     44|      case Duration:
  ------------------
  |  Branch (1566:7): [True: 44, False: 1.01k]
  ------------------
 1567|     44|        if (mvhdTimeScale_ != 0) {  // To prevent division by zero
  ------------------
  |  Branch (1567:13): [True: 44, False: 0]
  ------------------
 1568|     44|          xmpData_["Xmp.video.Duration"] = buf.read_uint32(0, bigEndian) * 1000 / mvhdTimeScale_;
 1569|     44|        }
 1570|     44|        break;
 1571|     44|      case PreferredRate:
  ------------------
  |  Branch (1571:7): [True: 44, False: 1.01k]
  ------------------
 1572|     44|        xmpData_["Xmp.video.PreferredRate"] =
 1573|     44|            buf.read_uint16(0, bigEndian) + ((buf.data()[2] * 256 + buf.data()[3]) * 0.01);
 1574|     44|        break;
 1575|     44|      case PreferredVolume:
  ------------------
  |  Branch (1575:7): [True: 44, False: 1.01k]
  ------------------
 1576|     44|        xmpData_["Xmp.video.PreferredVolume"] = (static_cast<int>(buf.read_uint8(0)) + (buf.data()[2] * 0.1)) * 100;
 1577|     44|        break;
 1578|     26|      case PreviewTime:
  ------------------
  |  Branch (1578:7): [True: 26, False: 1.03k]
  ------------------
 1579|     26|        xmpData_["Xmp.video.PreviewTime"] = buf.read_uint32(0, bigEndian);
 1580|     26|        break;
 1581|     25|      case PreviewDuration:
  ------------------
  |  Branch (1581:7): [True: 25, False: 1.03k]
  ------------------
 1582|     25|        xmpData_["Xmp.video.PreviewDuration"] = buf.read_uint32(0, bigEndian);
 1583|     25|        break;
 1584|     25|      case PosterTime:
  ------------------
  |  Branch (1584:7): [True: 25, False: 1.03k]
  ------------------
 1585|     25|        xmpData_["Xmp.video.PosterTime"] = buf.read_uint32(0, bigEndian);
 1586|     25|        break;
 1587|     25|      case SelectionTime:
  ------------------
  |  Branch (1587:7): [True: 25, False: 1.03k]
  ------------------
 1588|     25|        xmpData_["Xmp.video.SelectionTime"] = buf.read_uint32(0, bigEndian);
 1589|     25|        break;
 1590|     25|      case SelectionDuration:
  ------------------
  |  Branch (1590:7): [True: 25, False: 1.03k]
  ------------------
 1591|     25|        xmpData_["Xmp.video.SelectionDuration"] = buf.read_uint32(0, bigEndian);
 1592|     25|        break;
 1593|     25|      case CurrentTime:
  ------------------
  |  Branch (1593:7): [True: 25, False: 1.03k]
  ------------------
 1594|     25|        xmpData_["Xmp.video.CurrentTime"] = buf.read_uint32(0, bigEndian);
 1595|     25|        break;
 1596|     25|      case NextTrackID:
  ------------------
  |  Branch (1596:7): [True: 25, False: 1.03k]
  ------------------
 1597|     25|        xmpData_["Xmp.video.NextTrackID"] = buf.read_uint32(0, bigEndian);
 1598|     25|        break;
 1599|    562|      default:
  ------------------
  |  Branch (1599:7): [True: 562, False: 494]
  ------------------
 1600|    562|        break;
 1601|  1.05k|    }
 1602|  1.05k|  }
 1603|     57|  io_->readOrThrow(buf.data(), size % 4);
 1604|     57|}  // QuickTimeVideo::movieHeaderDecoder
_ZN5Exiv216newQTimeInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
 1606|  2.77k|Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
 1607|  2.77k|  auto image = std::make_unique<QuickTimeVideo>(std::move(io), params);
 1608|  2.77k|  if (!image->good()) {
  ------------------
  |  Branch (1608:7): [True: 7, False: 2.76k]
  ------------------
 1609|      7|    return nullptr;
 1610|      7|  }
 1611|  2.76k|  return image;
 1612|  2.77k|}
_ZN5Exiv211isQTimeTypeERNS_7BasicIoEb:
 1614|  15.1k|bool isQTimeType(BasicIo& iIo, bool advance) {
 1615|  15.1k|  auto buf = DataBuf(12 + 1);
 1616|  15.1k|  iIo.read(buf.data(), 12);
 1617|  15.1k|  buf.write_uint8(12, 0);  // nul-terminate string
 1618|       |
 1619|  15.1k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (1619:7): [True: 0, False: 15.1k]
  |  Branch (1619:22): [True: 245, False: 14.9k]
  ------------------
 1620|    245|    return false;
 1621|    245|  }
 1622|  14.9k|  auto qTimeTags = std::array{"PICT", "free", "ftyp", "junk", "mdat", "moov", "pict", "pnot", "skip", "uuid", "wide"};
 1623|       |
 1624|  14.9k|  bool matched = false;
 1625|       |
 1626|   109k|  for (auto const& tag : qTimeTags) {
  ------------------
  |  Branch (1626:24): [True: 109k, False: 4.50k]
  ------------------
 1627|   109k|    auto tmp = buf.cmpBytes(4, tag, 4);
 1628|   109k|    if (tmp == 0) {
  ------------------
  |  Branch (1628:9): [True: 10.4k, False: 99.0k]
  ------------------
 1629|       |      // we only match if we actually know the video type. This is done
 1630|       |      // to avoid matching just on ftyp because bmffimage also has that
 1631|       |      // header.
 1632|  10.4k|      if (Exiv2::find(qTimeFileType, Exiv2::toString(buf.data(8)))) {
  ------------------
  |  Branch (1632:11): [True: 8.31k, False: 2.12k]
  ------------------
 1633|  8.31k|        matched = true;
 1634|  8.31k|      }
 1635|  10.4k|      break;
 1636|  10.4k|    }
 1637|   109k|  }
 1638|       |
 1639|  14.9k|  if (!advance || !matched) {
  ------------------
  |  Branch (1639:7): [True: 14.9k, False: 0]
  |  Branch (1639:19): [True: 0, False: 0]
  ------------------
 1640|  14.9k|    iIo.seek(0L, BasicIo::beg);
 1641|  14.9k|  }
 1642|       |
 1643|  14.9k|  return matched;
 1644|  15.1k|}
quicktimevideo.cpp:_ZN5Exiv28InternalL10ignoreListERNS_7DataBufE:
  503|  76.6k|static bool ignoreList(Exiv2::DataBuf& buf) {
  504|  76.6k|  const char ignoreList[13][5] = {
  505|  76.6k|      "mdat", "edts", "junk", "iods", "alis", "stsc", "stsz", "stco", "ctts", "stss", "skip", "wide", "cmvd",
  506|  76.6k|  };
  507|       |
  508|  76.6k|  for (auto i : ignoreList)
  ------------------
  |  Branch (508:15): [True: 970k, False: 72.1k]
  ------------------
  509|   970k|    if (equalsQTimeTag(buf, i))
  ------------------
  |  Branch (509:9): [True: 4.49k, False: 966k]
  ------------------
  510|  4.49k|      return true;
  511|       |
  512|  72.1k|  return false;
  513|  76.6k|}
quicktimevideo.cpp:_ZN5Exiv28InternalL14dataIgnoreListERNS_7DataBufE:
  522|  36.8k|static bool dataIgnoreList(Exiv2::DataBuf& buf) {
  523|  36.8k|  const char ignoreList[8][5] = {
  524|  36.8k|      "moov", "mdia", "minf", "dinf", "alis", "stbl", "cmov", "meta",
  525|  36.8k|  };
  526|       |
  527|  36.8k|  for (auto i : ignoreList)
  ------------------
  |  Branch (527:15): [True: 286k, False: 32.8k]
  ------------------
  528|   286k|    if (equalsQTimeTag(buf, i))
  ------------------
  |  Branch (528:9): [True: 4.00k, False: 282k]
  ------------------
  529|  4.00k|      return true;
  530|       |
  531|  32.8k|  return false;
  532|  36.8k|}
quicktimevideo.cpp:_ZN5Exiv28InternalL14equalsQTimeTagERNS_7DataBufEPKc:
  492|  1.65M|static bool equalsQTimeTag(Exiv2::DataBuf& buf, const char str[5]) {
  493|  1.65M|  return std::equal(buf.begin(), buf.begin() + 4, str,
  494|  1.65M|                    [](auto b, auto s) { return std::tolower(b) == std::tolower(s); });
  495|  1.65M|}
quicktimevideo.cpp:_ZZN5Exiv28InternalL14equalsQTimeTagERNS_7DataBufEPKcENK3$_0clIhcEEDaT_T0_:
  494|  1.93M|                    [](auto b, auto s) { return std::tolower(b) == std::tolower(s); });
quicktimevideo.cpp:_ZN5Exiv2L10readStringERNS_7BasicIoEm:
  620|  1.46k|static std::string readString(BasicIo& io, size_t size) {
  621|  1.46k|  enforce(size <= io.size() - io.tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  622|  1.46k|  Exiv2::DataBuf str(size + 1);
  623|  1.46k|  io.readOrThrow(str.data(), size);
  624|  1.46k|  str.write_uint8(size, 0);  // nul-terminate string
  625|  1.46k|  return Exiv2::toString(str.data());
  626|  1.46k|}

_ZN5Exiv28RafImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   25|    212|    Image(ImageType::raf, mdExif | mdIptc | mdXmp, std::move(io), params) {
   26|    212|}  // RafImage::RafImage
_ZNK5Exiv28RafImage10pixelWidthEv:
   32|     43|uint32_t RafImage::pixelWidth() const {
   33|     43|  if (pixelWidth_ != 0)
  ------------------
  |  Branch (33:7): [True: 0, False: 43]
  ------------------
   34|      0|    return pixelWidth_;
   35|       |
   36|     43|  auto widthIter = exifData_.findKey(Exiv2::ExifKey("Exif.Fujifilm.RawImageFullWidth"));
   37|     43|  if (widthIter == exifData_.end() || widthIter->count() == 0)
  ------------------
  |  Branch (37:7): [True: 43, False: 0]
  |  Branch (37:7): [True: 43, False: 0]
  |  Branch (37:39): [True: 0, False: 0]
  ------------------
   38|     43|    return 0;
   39|      0|  return widthIter->toUint32();
   40|     43|}
_ZNK5Exiv28RafImage11pixelHeightEv:
   42|     43|uint32_t RafImage::pixelHeight() const {
   43|     43|  if (pixelHeight_ != 0)
  ------------------
  |  Branch (43:7): [True: 0, False: 43]
  ------------------
   44|      0|    return pixelHeight_;
   45|       |
   46|     43|  auto heightIter = exifData_.findKey(Exiv2::ExifKey("Exif.Fujifilm.RawImageFullHeight"));
   47|     43|  if (heightIter == exifData_.end() || heightIter->count() == 0)
  ------------------
  |  Branch (47:7): [True: 43, False: 0]
  |  Branch (47:7): [True: 43, False: 0]
  |  Branch (47:40): [True: 0, False: 0]
  ------------------
   48|     43|    return 0;
   49|      0|  return heightIter->toUint32();
   50|     43|}
_ZN5Exiv28RafImage12readMetadataEv:
  252|    212|void RafImage::readMetadata() {
  253|       |#ifdef EXIV2_DEBUG_MESSAGES
  254|       |  std::cerr << "Reading RAF file " << io_->path() << "\n";
  255|       |#endif
  256|    212|  if (io_->open() != 0)
  ------------------
  |  Branch (256:7): [True: 0, False: 212]
  ------------------
  257|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  258|    212|  IoCloser closer(*io_);
  259|       |  // Ensure that this is the correct image type
  260|    212|  if (!isRafType(*io_, false)) {
  ------------------
  |  Branch (260:7): [True: 0, False: 212]
  ------------------
  261|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  |  Branch (261:25): [True: 0, False: 0]
  ------------------
  262|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  263|      0|    throw Error(ErrorCode::kerNotAnImage, "RAF");
  264|      0|  }
  265|       |
  266|    212|  clearMetadata();
  267|       |
  268|    212|  if (io_->seek(84, BasicIo::beg) != 0)
  ------------------
  |  Branch (268:7): [True: 16, False: 196]
  ------------------
  269|     16|    throw Error(ErrorCode::kerFailedToReadImageData);
  270|    196|  byte jpg_img_offset[4];
  271|    196|  if (io_->read(jpg_img_offset, 4) != 4)
  ------------------
  |  Branch (271:7): [True: 3, False: 193]
  ------------------
  272|      3|    throw Error(ErrorCode::kerFailedToReadImageData);
  273|    193|  byte jpg_img_length[4];
  274|    193|  if (io_->read(jpg_img_length, 4) != 4)
  ------------------
  |  Branch (274:7): [True: 11, False: 182]
  ------------------
  275|     11|    throw Error(ErrorCode::kerFailedToReadImageData);
  276|    182|  uint32_t jpg_img_off_u32 = Exiv2::getULong(jpg_img_offset, bigEndian);
  277|    182|  uint32_t jpg_img_len_u32 = Exiv2::getULong(jpg_img_length, bigEndian);
  278|       |
  279|    182|  Internal::enforce(Safe::add(jpg_img_off_u32, jpg_img_len_u32) <= io_->size(), ErrorCode::kerCorruptedMetadata);
  280|       |
  281|    182|  auto jpg_img_off = static_cast<long>(jpg_img_off_u32);
  282|    182|  auto jpg_img_len = static_cast<long>(jpg_img_len_u32);
  283|       |
  284|    182|  Internal::enforce(jpg_img_len >= 12, ErrorCode::kerCorruptedMetadata);
  285|       |
  286|    182|  DataBuf jpg_buf(jpg_img_len);
  287|    182|  if (io_->seek(jpg_img_off, BasicIo::beg) != 0)
  ------------------
  |  Branch (287:7): [True: 0, False: 182]
  ------------------
  288|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  289|       |
  290|    182|  if (!jpg_buf.empty()) {
  ------------------
  |  Branch (290:7): [True: 126, False: 56]
  ------------------
  291|    126|    io_->read(jpg_buf.data(), jpg_buf.size());
  292|    126|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (292:9): [True: 0, False: 126]
  |  Branch (292:25): [True: 0, False: 126]
  ------------------
  293|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  294|    126|  }
  295|       |
  296|       |  // Retrieve metadata from embedded JPEG preview image.
  297|    182|  try {
  298|    182|    auto jpg_io = std::make_unique<Exiv2::MemIo>(jpg_buf.data(), jpg_buf.size());
  299|    182|    auto jpg_img = JpegImage(std::move(jpg_io), ImageCtorParams(false, 0));
  300|    182|    jpg_img.readMetadata();
  301|    182|    setByteOrder(jpg_img.byteOrder());
  302|    182|    xmpData_ = jpg_img.xmpData();
  303|    182|    exifData_ = jpg_img.exifData();
  304|    182|    iptcData_ = jpg_img.iptcData();
  305|    182|    comment_ = jpg_img.comment();
  306|    182|  } catch (const Exiv2::Error&) {
  307|    102|  }
  308|       |
  309|    182|  exifData_["Exif.Image2.JPEGInterchangeFormat"] = getULong(jpg_img_offset, bigEndian);
  310|    126|  exifData_["Exif.Image2.JPEGInterchangeFormatLength"] = getULong(jpg_img_length, bigEndian);
  311|       |
  312|       |  // Todo: parse the proprietary metadata structure
  313|       |  //       at offset 92 for pixelWidth_ & pixelHeight_
  314|       |  // See https://libopenraw.freedesktop.org/formats/raf/
  315|       |  // and https://exiftool.org/TagNames/FujiFilm.html#RAF
  316|       |
  317|       |  // parse the tiff
  318|    126|  std::array<byte, 4> readBuff;
  319|    126|  if (io_->seek(100, BasicIo::beg) != 0)
  ------------------
  |  Branch (319:7): [True: 22, False: 104]
  ------------------
  320|     22|    throw Error(ErrorCode::kerFailedToReadImageData);
  321|    104|  if (io_->read(readBuff.data(), 4) != 4)
  ------------------
  |  Branch (321:7): [True: 7, False: 97]
  ------------------
  322|      7|    throw Error(ErrorCode::kerFailedToReadImageData);
  323|     97|  uint32_t tiffOffset = Exiv2::getULong(readBuff.data(), bigEndian);
  324|       |
  325|     97|  if (io_->read(readBuff.data(), 4) != 4)
  ------------------
  |  Branch (325:7): [True: 8, False: 89]
  ------------------
  326|      8|    throw Error(ErrorCode::kerFailedToReadImageData);
  327|     89|  uint32_t tiffLength = Exiv2::getULong(readBuff.data(), bigEndian);
  328|       |
  329|       |  // sanity check.  Does tiff lie inside the file?
  330|     89|  Internal::enforce(Safe::add(tiffOffset, tiffLength) <= io_->size(), ErrorCode::kerCorruptedMetadata);
  331|       |
  332|     89|  if (io_->seek(tiffOffset, BasicIo::beg) != 0)
  ------------------
  |  Branch (332:7): [True: 0, False: 89]
  ------------------
  333|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
  334|       |
  335|       |  // Check if this really is a tiff and then call the tiff parser.
  336|       |  // Check is needed because some older models just embed a raw bitstream.
  337|       |  // For those files we skip the parsing step.
  338|     89|  if (io_->read(readBuff.data(), 4) != 4) {
  ------------------
  |  Branch (338:7): [True: 5, False: 84]
  ------------------
  339|      5|    throw Error(ErrorCode::kerFailedToReadImageData);
  340|      5|  }
  341|     84|  io_->seek(-4, BasicIo::cur);
  342|     84|  const std::array<byte, 4> Id1{0x49, 0x49, 0x2A, 0x00};
  343|     84|  const std::array<byte, 4> Id2{0x4D, 0x4D, 0x00, 0x2A};
  344|     84|  if (readBuff == Id1 || readBuff == Id2) {
  ------------------
  |  Branch (344:7): [True: 23, False: 61]
  |  Branch (344:26): [True: 17, False: 44]
  ------------------
  345|     19|    DataBuf tiff(tiffLength);
  346|     19|    io_->read(tiff.data(), tiff.size());
  347|       |
  348|     19|    if (!io_->error() && !io_->eof()) {
  ------------------
  |  Branch (348:9): [True: 19, False: 0]
  |  Branch (348:26): [True: 19, False: 0]
  ------------------
  349|     19|      const DecodeParams dp(max_recursion_depth_);
  350|     19|      TiffParser::decode(exifData_, iptcData_, xmpData_, tiff.c_data(), tiff.size(), dp);
  351|     19|    }
  352|     19|  }
  353|     84|}
_ZN5Exiv28RafImage13writeMetadataEv:
  355|      4|void RafImage::writeMetadata() {
  356|       |  //! Todo: implement me!
  357|      4|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "RAF"));
  358|      4|}  // RafImage::writeMetadata
_ZN5Exiv214newRafInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  362|    212|Image::UniquePtr newRafInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  363|    212|  auto image = std::make_unique<RafImage>(std::move(io), params);
  364|    212|  if (!image->good()) {
  ------------------
  |  Branch (364:7): [True: 0, False: 212]
  ------------------
  365|      0|    return nullptr;
  366|      0|  }
  367|    212|  return image;
  368|    212|}
_ZN5Exiv29isRafTypeERNS_7BasicIoEb:
  370|  16.7k|bool isRafType(BasicIo& iIo, bool advance) {
  371|  16.7k|  const int32_t len = 8;
  372|  16.7k|  constexpr std::array<byte, len> RafId{'F', 'U', 'J', 'I', 'F', 'I', 'L', 'M'};
  373|  16.7k|  std::array<byte, len> buf;
  374|  16.7k|  iIo.read(buf.data(), len);
  375|  16.7k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (375:7): [True: 0, False: 16.7k]
  |  Branch (375:22): [True: 0, False: 16.7k]
  ------------------
  376|      0|    return false;
  377|      0|  }
  378|  16.7k|  bool rc = buf == RafId;
  379|  16.7k|  if (!advance || !rc) {
  ------------------
  |  Branch (379:7): [True: 16.7k, False: 0]
  |  Branch (379:19): [True: 0, False: 0]
  ------------------
  380|  16.7k|    iIo.seek(-len, BasicIo::cur);
  381|  16.7k|  }
  382|  16.7k|  return rc;
  383|  16.7k|}

_ZN5Exiv29RiffVideoC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
  365|    673|    Image(ImageType::riff, mdNone, std::move(io), params) {
  366|    673|}  // RiffVideo::RiffVideo
_ZNK5Exiv29RiffVideo8mimeTypeEv:
  368|    673|std::string RiffVideo::mimeType() const {
  369|    673|  return "video/riff";
  370|    673|}
_ZN5Exiv29RiffVideo13writeMetadataEv:
  372|     18|void RiffVideo::writeMetadata() {
  373|     18|}  // RiffVideo::writeMetadata
_ZN5Exiv29RiffVideo12readMetadataEv:
  375|    673|void RiffVideo::readMetadata() {
  376|    673|  if (io_->open() != 0)
  ------------------
  |  Branch (376:7): [True: 0, False: 673]
  ------------------
  377|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  378|       |
  379|       |  // Ensure that this is the correct image type
  380|    673|  if (!isRiffType(*io_, false)) {
  ------------------
  |  Branch (380:7): [True: 0, False: 673]
  ------------------
  381|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (381:9): [True: 0, False: 0]
  |  Branch (381:25): [True: 0, False: 0]
  ------------------
  382|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  383|      0|    throw Error(ErrorCode::kerNotAnImage, "RIFF");
  384|      0|  }
  385|       |
  386|    673|  IoCloser closer(*io_);
  387|    673|  clearMetadata();
  388|       |
  389|    673|  xmpData_["Xmp.video.FileSize"] = io_->size();
  390|    673|  xmpData_["Xmp.video.MimeType"] = mimeType();
  391|       |
  392|    673|  HeaderReader header(io_);
  393|    673|  xmpData_["Xmp.video.Container"] = header.getId();
  394|       |
  395|    673|  xmpData_["Xmp.video.FileType"] = readStringTag(io_);
  396|       |
  397|    673|  decodeBlocks();
  398|    673|}  // RiffVideo::readMetadata
_ZN5Exiv29RiffVideo12HeaderReaderC2ERKNSt3__110unique_ptrINS_7BasicIoENS2_14default_deleteIS4_EEEE:
  400|  5.93k|RiffVideo::HeaderReader::HeaderReader(const BasicIo::UniquePtr& io) {
  401|  5.93k|  Internal::enforce(io->size() > io->tell() + DWORD + DWORD, Exiv2::ErrorCode::kerCorruptedMetadata);
  402|  5.93k|  id_ = readStringTag(io);
  403|  5.93k|  size_ = readDWORDTag(io);
  404|  5.93k|}
_ZN5Exiv29RiffVideo5equalERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
  406|  32.4k|bool RiffVideo::equal(const std::string& str1, const std::string& str2) {
  407|  32.4k|  if (str1.size() != str2.size())
  ------------------
  |  Branch (407:7): [True: 10.9k, False: 21.4k]
  ------------------
  408|  10.9k|    return false;
  409|       |
  410|  21.4k|  return Internal::upper(str1) == str2;
  411|  32.4k|}
_ZN5Exiv29RiffVideo8readListERKNS0_12HeaderReaderE:
  413|    329|void RiffVideo::readList(const HeaderReader& header_) {
  414|    329|  std::string chunk_type = readStringTag(io_);
  415|       |
  416|       |#ifdef EXIV2_DEBUG_MESSAGES
  417|       |  EXV_INFO << "-> Reading list : id= " << header_.getId() << "  type= " << chunk_type << " size= " << header_.getSize()
  418|       |           << "(" << io_->tell() << "/" << io_->size() << ")" << '\n';
  419|       |#endif
  420|       |
  421|    329|  if (equal(chunk_type, CHUNK_ID_INFO))
  ------------------
  |  Branch (421:7): [True: 239, False: 90]
  ------------------
  422|    239|    readInfoListChunk(header_.getSize());
  423|     90|  else if (equal(chunk_type, CHUNK_ID_MOVI)) {
  ------------------
  |  Branch (423:12): [True: 34, False: 56]
  ------------------
  424|     34|    readMoviList(header_.getSize());
  425|     34|  }
  426|    329|}
_ZN5Exiv29RiffVideo9readChunkERKNS0_12HeaderReaderE:
  428|  4.81k|void RiffVideo::readChunk(const HeaderReader& header_) {
  429|       |#ifdef EXIV2_DEBUG_MESSAGES
  430|       |  if (header_.getSize())
  431|       |    EXV_INFO << "--> Reading Chunk : [" << header_.getId() << "] size= " << header_.getSize() << "(" << io_->tell()
  432|       |             << "/" << io_->size() << ")" << '\n';
  433|       |#endif
  434|       |
  435|  4.81k|  if (equal(header_.getId(), CHUNK_ID_AVIH))
  ------------------
  |  Branch (435:7): [True: 728, False: 4.09k]
  ------------------
  436|    728|    readAviHeader();
  437|  4.09k|  else if (equal(header_.getId(), CHUNK_ID_STRH))
  ------------------
  |  Branch (437:12): [True: 674, False: 3.41k]
  ------------------
  438|    674|    readStreamHeader();
  439|  3.41k|  else if (equal(header_.getId(), CHUNK_ID_STRF))
  ------------------
  |  Branch (439:12): [True: 1.04k, False: 2.37k]
  ------------------
  440|  1.04k|    readStreamFormat(header_.getSize());
  441|  2.37k|  else if (equal(header_.getId(), CHUNK_ID_FMT)) {
  ------------------
  |  Branch (441:12): [True: 210, False: 2.16k]
  ------------------
  442|    210|    streamType_ = Audio;
  443|    210|    readStreamFormat(header_.getSize());
  444|  2.16k|  } else if (equal(header_.getId(), CHUNK_ID_STRD))
  ------------------
  |  Branch (444:14): [True: 13, False: 2.14k]
  ------------------
  445|     13|    readStreamData(header_.getSize());
  446|  2.14k|  else if (equal(header_.getId(), CHUNK_ID_STRN))
  ------------------
  |  Branch (446:12): [True: 49, False: 2.09k]
  ------------------
  447|     49|    StreamName(header_.getSize());
  448|  2.09k|  else if (equal(header_.getId(), CHUNK_ID_VPRP))
  ------------------
  |  Branch (448:12): [True: 235, False: 1.86k]
  ------------------
  449|    235|    readVPRPChunk(header_.getSize());
  450|  1.86k|  else if (equal(header_.getId(), CHUNK_ID_IDX1))
  ------------------
  |  Branch (450:12): [True: 119, False: 1.74k]
  ------------------
  451|    119|    readIndexChunk(header_.getSize());
  452|  1.74k|  else if (equal(header_.getId(), CHUNK_ID_DATA))
  ------------------
  |  Branch (452:12): [True: 224, False: 1.52k]
  ------------------
  453|    224|    readDataChunk(header_.getSize());
  454|  1.52k|  else if (equal(header_.getId(), CHUNK_ID_JUNK))
  ------------------
  |  Branch (454:12): [True: 158, False: 1.36k]
  ------------------
  455|    158|    readJunk(header_.getSize());
  456|  1.36k|  else {
  457|       |#ifdef EXIV2_DEBUG_MESSAGES
  458|       |    if (header_.getSize())
  459|       |      EXV_WARNING << "--> Ignoring Chunk : " << header_.getId() << "] size= " << header_.getSize() << "(" << io_->tell()
  460|       |                  << "/" << io_->size() << ")" << '\n';
  461|       |#endif
  462|  1.36k|    io_->seekOrThrow(io_->tell() + header_.getSize(), BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  463|  1.36k|  }
  464|  4.81k|}
_ZN5Exiv29RiffVideo12decodeBlocksEv:
  466|    673|void RiffVideo::decodeBlocks() {
  467|  5.26k|  do {
  468|  5.26k|    if (HeaderReader header(io_); equal(header.getId(), CHUNK_ID_LIST)) {
  ------------------
  |  Branch (468:35): [True: 329, False: 4.93k]
  ------------------
  469|    329|      readList(header);
  470|  4.93k|    } else {
  471|  4.93k|      readChunk(header);
  472|  4.93k|    }
  473|  5.26k|  } while (!io_->eof() && io_->tell() < io_->size());
  ------------------
  |  Branch (473:12): [True: 4.61k, False: 649]
  |  Branch (473:27): [True: 4.58k, False: 24]
  ------------------
  474|    673|}  // RiffVideo::decodeBlock
_ZN5Exiv29RiffVideo13readAviHeaderEv:
  476|    728|void RiffVideo::readAviHeader() {
  477|       |#ifdef EXIV2_DEBUG_MESSAGES
  478|       |  EXV_INFO << "--> dwMicroSecPerFrame    = " << readDWORDTag(io_) << '\n';
  479|       |  EXV_INFO << "--> dwMaxBytesPerSec      = " << readDWORDTag(io_) << '\n';
  480|       |  EXV_INFO << "--> dwPaddingGranularity  = " << readDWORDTag(io_) << '\n';
  481|       |  EXV_INFO << "--> dwFlags               = " << readDWORDTag(io_) << '\n';
  482|       |  EXV_INFO << "--> dwTotalFrames         = " << readDWORDTag(io_) << '\n';
  483|       |  EXV_INFO << "--> dwInitialFrames       = " << readDWORDTag(io_) << '\n';
  484|       |  EXV_INFO << "--> dwStreams             = " << readDWORDTag(io_) << '\n';
  485|       |  EXV_INFO << "--> dwSuggestedBufferSize = " << readDWORDTag(io_) << '\n';
  486|       |  EXV_INFO << "--> dwWidth               = " << readDWORDTag(io_) << '\n';
  487|       |  EXV_INFO << "--> dwHeight              = " << readDWORDTag(io_) << '\n';
  488|       |  EXV_INFO << "--> dwReserved1           = " << readDWORDTag(io_) << '\n';
  489|       |  EXV_INFO << "--> dwReserved2           = " << readDWORDTag(io_) << '\n';
  490|       |  EXV_INFO << "--> dwReserved3           = " << readDWORDTag(io_) << '\n';
  491|       |  EXV_INFO << "--> dwReserved4           = " << readDWORDTag(io_) << '\n';
  492|       |  if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  493|       |    io_->seekOrThrow(io_->tell() - DWORD * 14, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  494|       |#endif
  495|       |
  496|    728|  uint32_t TimeBetweenFrames = readDWORDTag(io_);
  497|    728|  xmpData_["Xmp.video.MicroSecPerFrame"] = TimeBetweenFrames;
  498|    728|  double frame_rate = 1000000. / TimeBetweenFrames;
  499|       |
  500|    728|  xmpData_["Xmp.video.MaxDataRate"] = readDWORDTag(io_);  // MaximumDataRate
  501|       |
  502|    728|  io_->seekOrThrow(io_->tell() + (DWORD * 2), BasicIo::beg,
  503|    728|                   ErrorCode::kerFailedToReadImageData);  // ignore PaddingGranularity and Flags
  504|       |
  505|    728|  uint32_t frame_count = readDWORDTag(io_);  // TotalNumberOfFrames
  506|    728|  xmpData_["Xmp.video.FrameCount"] = frame_count;
  507|       |
  508|    728|  io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg,
  509|    728|                   ErrorCode::kerFailedToReadImageData);  // ignore NumberOfInitialFrames
  510|       |
  511|    728|  xmpData_["Xmp.audio.ChannelType"] = getStreamType(readDWORDTag(io_));  // NumberOfStreams
  512|       |
  513|    728|  xmpData_["Xmp.video.StreamCount"] = readDWORDTag(io_);  // SuggestedBufferSize
  514|       |
  515|    728|  uint32_t width = readDWORDTag(io_);
  516|    728|  xmpData_["Xmp.video.Width"] = width;
  517|       |
  518|    728|  uint32_t height = readDWORDTag(io_);
  519|    728|  xmpData_["Xmp.video.Height"] = height;
  520|       |
  521|    728|  io_->seekOrThrow(io_->tell() + (DWORD * 4), BasicIo::beg,
  522|    728|                   ErrorCode::kerFailedToReadImageData);  // TimeScale, DataRate, StartTime, DataLength
  523|       |
  524|    728|  xmpData_["Xmp.video.AspectRatio"] = getAspectRatio(width, height);
  525|       |
  526|    728|  fillDuration(frame_rate, frame_count);
  527|    728|}
_ZN5Exiv29RiffVideo16readStreamHeaderEv:
  529|    674|void RiffVideo::readStreamHeader() {
  530|    674|  std::string stream = readStringTag(io_);
  531|    674|  streamType_ = (equal(stream, "VIDS")) ? Video : Audio;
  ------------------
  |  Branch (531:17): [True: 101, False: 573]
  ------------------
  532|       |
  533|       |#ifdef EXIV2_DEBUG_MESSAGES
  534|       |  EXV_INFO << "--> fccType                = " << stream << '\n';
  535|       |  EXV_INFO << "--> fccHandler             = " << readStringTag(io_) << '\n';
  536|       |  EXV_INFO << "--> dwFlags                = " << readDWORDTag(io_) << '\n';
  537|       |  EXV_INFO << "--> wPriority              = " << readWORDTag(io_) << '\n';
  538|       |  EXV_INFO << "--> wLanguage              = " << readWORDTag(io_) << '\n';
  539|       |  EXV_INFO << "--> dwInitialFrames        = " << readDWORDTag(io_) << '\n';  // 20
  540|       |  EXV_INFO << "--> dwScale                = " << readDWORDTag(io_) << '\n';
  541|       |  EXV_INFO << "--> dwRate                 = " << readDWORDTag(io_) << '\n';
  542|       |  EXV_INFO << "--> dwStart                = " << readDWORDTag(io_) << '\n';
  543|       |  EXV_INFO << "--> dwLength               = " << readDWORDTag(io_) << '\n';
  544|       |  EXV_INFO << "--> dwSuggestedBufferSize  = " << readDWORDTag(io_) << '\n';  // 40
  545|       |  EXV_INFO << "--> dwSampleSize           = " << readDWORDTag(io_) << '\n';
  546|       |  EXV_INFO << "--> Left                   = " << readWORDTag(io_) << '\n';
  547|       |  EXV_INFO << "--> top                    = " << readWORDTag(io_) << '\n';
  548|       |  EXV_INFO << "--> right                  = " << readWORDTag(io_) << '\n';
  549|       |  EXV_INFO << "--> bottom                 = " << readWORDTag(io_) << '\n';
  550|       |  EXV_INFO << "--> XXXXXX                 = " << readDWORDTag(io_) << '\n';  // 56
  551|       |  if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  552|       |    io_->seekOrThrow(io_->tell() - DWORD * 13, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  553|       |#endif
  554|       |
  555|    674|  xmpData_["Xmp.video.Codec"] = readStringTag(io_);  // DataHandler
  556|       |
  557|    674|  io_->seekOrThrow(io_->tell() + (DWORD * 2) + (WORD * 2), BasicIo::beg,
  558|    674|                   ErrorCode::kerFailedToReadImageData);  // dwFlags, wPriority, wLanguage, dwInitialFrames
  559|       |
  560|    674|  uint32_t divisor = readDWORDTag(io_);  // TimeScale
  561|       |
  562|    674|  if (divisor) {
  ------------------
  |  Branch (562:7): [True: 494, False: 180]
  ------------------
  563|    494|    auto rate = static_cast<double>(readDWORDTag(io_)) / divisor;
  564|    494|    xmpData_[(streamType_ == Video) ? "Xmp.video.FrameRate" : "Xmp.audio.SampleRate"] = rate;
  ------------------
  |  Branch (564:14): [True: 56, False: 438]
  ------------------
  565|    494|  }
  566|    674|  io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData);  // dwStart
  567|       |
  568|    674|  if (divisor) {
  ------------------
  |  Branch (568:7): [True: 479, False: 195]
  ------------------
  569|    479|    auto frame_count = static_cast<double>(readDWORDTag(io_)) / divisor;  // DataLength
  570|    479|    xmpData_[(streamType_ == Video) ? "Xmp.video.FrameCount" : "Xmp.audio.FrameCount"] = frame_count;
  ------------------
  |  Branch (570:14): [True: 56, False: 423]
  ------------------
  571|    479|  }
  572|       |
  573|    674|  io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData);  // dwSuggestedBufferSize
  574|       |
  575|    674|  xmpData_[(streamType_ == Video) ? "Xmp.video.VideoQuality" : "Xmp.video.StreamQuality"] = readDWORDTag(io_);
  ------------------
  |  Branch (575:12): [True: 100, False: 574]
  ------------------
  576|       |
  577|    674|  xmpData_[(streamType_ == Video) ? "Xmp.video.VideoSampleSize" : "Xmp.video.StreamSampleSize"] = readDWORDTag(io_);
  ------------------
  |  Branch (577:12): [True: 100, False: 574]
  ------------------
  578|    674|  io_->seekOrThrow(io_->tell() + (DWORD * 2), BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  579|    674|}
_ZN5Exiv29RiffVideo16readStreamFormatEm:
  581|  1.25k|void RiffVideo::readStreamFormat(uint64_t size_) {
  582|       |  // The structure of the strf chunk depends on the media type. Video streams use the BITMAPINFOHEADER structure,
  583|       |  // whereas audio streams use the WAVEFORMATEX structure.
  584|       |
  585|       |#ifdef EXIV2_DEBUG_MESSAGES
  586|       |  if (streamType_ == Audio) {
  587|       |    EXV_INFO << "--> wFormatTag      = " << readWORDTag(io_) << '\n';
  588|       |    EXV_INFO << "--> nChannels       = " << readWORDTag(io_) << '\n';
  589|       |    EXV_INFO << "--> nSamplesPerSec  = " << readDWORDTag(io_) << '\n';
  590|       |    EXV_INFO << "--> nAvgBytesPerSec = " << readDWORDTag(io_) << '\n';
  591|       |    EXV_INFO << "--> nBlockAlign     = " << readWORDTag(io_) << '\n';
  592|       |    EXV_INFO << "--> wBitsPerSample  = " << readWORDTag(io_) << '\n';
  593|       |    if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  594|       |      io_->seekOrThrow(io_->tell() - DWORD * 4, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  595|       |  } else if (streamType_ == Video) {
  596|       |    EXV_INFO << "--> biSize            = " << readDWORDTag(io_) << '\n';
  597|       |    EXV_INFO << "--> biWidth           = " << readDWORDTag(io_) << '\n';
  598|       |    EXV_INFO << "--> biHeight          = " << readDWORDTag(io_) << '\n';
  599|       |    EXV_INFO << "--> biPlanes          = " << readWORDTag(io_) << '\n';
  600|       |    EXV_INFO << "--> biBitCount        = " << readWORDTag(io_) << '\n';
  601|       |    EXV_INFO << "--> biCompression     = " << readDWORDTag(io_) << '\n';
  602|       |    EXV_INFO << "--> biSizeImage       = " << readDWORDTag(io_) << '\n';
  603|       |    EXV_INFO << "--> biXPelsPerMeter   = " << readDWORDTag(io_) << '\n';
  604|       |    EXV_INFO << "--> biYPelsPerMeter   = " << readDWORDTag(io_) << '\n';
  605|       |    EXV_INFO << "--> biClrUsed         = " << readDWORDTag(io_) << '\n';
  606|       |    EXV_INFO << "--> biClrImportant    = " << readDWORDTag(io_) << '\n';
  607|       |    if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  608|       |      io_->seekOrThrow(io_->tell() - DWORD * 10, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  609|       |  }
  610|       |#endif
  611|       |
  612|  1.25k|  if (streamType_ == Video) {
  ------------------
  |  Branch (612:7): [True: 157, False: 1.09k]
  ------------------
  613|    157|    io_->seekOrThrow(io_->tell() + (DWORD * 3), BasicIo::beg,
  614|    157|                     ErrorCode::kerFailedToReadImageData);  // ignore biSize, biWidth, biHeight
  615|    157|    xmpData_["Xmp.video.Planes"] = readWORDTag(io_);
  616|    157|    xmpData_["Xmp.video.PixelDepth"] = readWORDTag(io_);
  617|    157|    xmpData_["Xmp.video.Compressor"] = readStringTag(io_);
  618|    157|    xmpData_["Xmp.video.ImageLength"] = readDWORDTag(io_);
  619|    157|    xmpData_["Xmp.video.PixelPerMeterX"] = readQWORDTag(io_);
  620|    157|    xmpData_["Xmp.video.PixelPerMeterY"] = readQWORDTag(io_);
  621|    157|    if (uint32_t NumOfColours = readDWORDTag(io_))
  ------------------
  |  Branch (621:18): [True: 95, False: 62]
  ------------------
  622|     95|      xmpData_["Xmp.video.NumOfColours"] = NumOfColours;
  623|     62|    else
  624|     62|      xmpData_["Xmp.video.NumOfColours"] = "Unspecified";
  625|    157|    if (uint32_t NumIfImpColours = readDWORDTag(io_))
  ------------------
  |  Branch (625:18): [True: 93, False: 64]
  ------------------
  626|     93|      xmpData_["Xmp.video.NumIfImpColours"] = NumIfImpColours;
  627|     64|    else
  628|     64|      xmpData_["Xmp.video.NumIfImpColours"] = "All";
  629|  1.09k|  } else if (streamType_ == Audio) {
  ------------------
  |  Branch (629:14): [True: 1.03k, False: 60]
  ------------------
  630|  1.03k|    uint16_t format_tag = readWORDTag(io_);
  631|  1.03k|    if (auto it = Internal::audioEncodingValues.find(format_tag); it != Internal::audioEncodingValues.end())
  ------------------
  |  Branch (631:67): [True: 713, False: 326]
  ------------------
  632|    713|      xmpData_["Xmp.audio.Compressor"] = it->second;
  633|    326|    else
  634|    326|      xmpData_["Xmp.audio.Compressor"] = format_tag;
  635|       |
  636|  1.03k|    xmpData_["Xmp.audio.ChannelType"] = getStreamType(readDWORDTag(io_));
  637|  1.03k|    xmpData_["Xmp.audio.SampleRate"] = readDWORDTag(io_);                                      // nSamplesPerSec
  638|  1.03k|    io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData);  // nAvgBytesPerSec
  639|  1.03k|    xmpData_["Xmp.audio.SampleType"] = readDWORDTag(io_);                                      // nBlockAlign
  640|  1.03k|    xmpData_["Xmp.audio.BitsPerSample"] = readDWORDTag(io_);                                   // wBitsPerSample
  641|  1.03k|    if (xmpData_["Xmp.video.FileType"].toString() == "AVI ")
  ------------------
  |  Branch (641:9): [True: 17, False: 1.02k]
  ------------------
  642|     17|      io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData);  // cbSize
  643|  1.03k|  } else {
  644|     60|    io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  645|     60|  }
  646|  1.25k|}
_ZNK5Exiv29RiffVideo14readStreamDataEm:
  648|     13|void RiffVideo::readStreamData(uint64_t size_) const {
  649|     13|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  650|     13|}
_ZNK5Exiv29RiffVideo10StreamNameEm:
  652|     49|void RiffVideo::StreamName(uint64_t size_) const {
  653|       |  // This element contains a name for the stream. That stream name should only use plain ASCII, especially not UTF-8.
  654|     49|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  655|     49|}
_ZN5Exiv29RiffVideo17readInfoListChunkEm:
  657|    239|void RiffVideo::readInfoListChunk(uint64_t size_) {
  658|    239|  uint64_t current_size = DWORD;
  659|       |
  660|       |  // Add the elements to a temporary table first, so that we can check
  661|       |  // for duplicates before adding them to xmpData_.
  662|    239|  std::map<std::string, std::string> table;
  663|  1.01k|  while (current_size < size_) {
  ------------------
  |  Branch (663:10): [True: 776, False: 239]
  ------------------
  664|    776|    std::string type = readStringTag(io_);
  665|    776|    size_t size = readDWORDTag(io_);
  666|    776|    std::string content = readStringTag(io_, size);
  667|    776|    if (auto it = Internal::infoTags.find(type); it != Internal::infoTags.end()) {
  ------------------
  |  Branch (667:50): [True: 49, False: 727]
  ------------------
  668|       |      // Check that it isn't a duplicate.
  669|     49|      Internal::enforce(table.find(it->second) == table.end(), ErrorCode::kerCorruptedMetadata);
  670|     49|      table[it->second] = content;
  671|     49|    }
  672|    776|    current_size += DWORD * 2;
  673|    776|    current_size += size;
  674|    776|  }
  675|       |  // Copy the elements from the temporary table to xmpData_.
  676|    239|  for (const auto& it : table) {
  ------------------
  |  Branch (676:23): [True: 24, False: 239]
  ------------------
  677|     24|    xmpData_[it.first] = it.second;
  678|     24|  }
  679|    239|}
_ZNK5Exiv29RiffVideo12readMoviListEm:
  681|     34|void RiffVideo::readMoviList(uint64_t size_) const {
  682|     34|  io_->seekOrThrow(io_->tell() + size_ - DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  683|     34|}
_ZNK5Exiv29RiffVideo13readVPRPChunkEm:
  685|    235|void RiffVideo::readVPRPChunk(uint64_t size_) const {
  686|       |#ifdef EXIV2_DEBUG_MESSAGES
  687|       |  EXV_INFO << "--> VideoFormatToken         = " << readDWORDTag(io_) << '\n';
  688|       |  EXV_INFO << "--> VideoStandard            = " << readDWORDTag(io_) << '\n';
  689|       |  EXV_INFO << "--> VerticalRefreshRate      = " << readDWORDTag(io_) << '\n';
  690|       |  EXV_INFO << "--> HTotalInT                = " << readDWORDTag(io_) << '\n';
  691|       |  EXV_INFO << "--> VTotalInLines            = " << readDWORDTag(io_) << '\n';
  692|       |  EXV_INFO << "--> FrameAspectRatio Height  = " << readWORDTag(io_) << '\n';
  693|       |  EXV_INFO << "--> FrameAspectRatio Width   = " << readWORDTag(io_) << '\n';
  694|       |  EXV_INFO << "--> FrameWidthInPixels       = " << readDWORDTag(io_) << '\n';
  695|       |  EXV_INFO << "--> FrameHeightInLines       = " << readDWORDTag(io_) << '\n';
  696|       |  EXV_INFO << "--> CompressedBMHeight       = " << readDWORDTag(io_) << '\n';
  697|       |  EXV_INFO << "--> FieldPerFrame            = " << readDWORDTag(io_) << '\n';
  698|       |  EXV_INFO << "--> CompressedBMWidth        = " << readDWORDTag(io_) << '\n';
  699|       |  EXV_INFO << "--> ValidBMHeight            = " << readDWORDTag(io_) << '\n';
  700|       |  EXV_INFO << "--> ValidBMWidth             = " << readDWORDTag(io_) << '\n';
  701|       |  EXV_INFO << "--> ValidBMXOffset           = " << readDWORDTag(io_) << '\n';
  702|       |  EXV_INFO << "--> ValidBMYOffset           = " << readDWORDTag(io_) << '\n';
  703|       |  EXV_INFO << "--> VideoXOffsetInT          = " << readDWORDTag(io_) << '\n';
  704|       |  EXV_INFO << "--> VideoYValidStartLine     = " << readDWORDTag(io_) << '\n';
  705|       |  if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  706|       |    io_->seekOrThrow(io_->tell() - DWORD * 17, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  707|       |#endif
  708|    235|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  709|    235|}
_ZNK5Exiv29RiffVideo14readIndexChunkEm:
  711|    119|void RiffVideo::readIndexChunk(uint64_t size_) const {
  712|       |#ifdef EXIV2_DEBUG_MESSAGES
  713|       |  uint64_t current_size = 0;
  714|       |  while (current_size < size_) {
  715|       |    EXV_DEBUG << "--> Identifier               = " << readStringTag(io_) << "\t(" << current_size << "/" << size_ << ")"
  716|       |              << '\n';
  717|       |    EXV_DEBUG << "--> Flags                    = " << readDWORDTag(io_) << "\t(" << current_size << "/" << size_ << ")"
  718|       |              << '\n';
  719|       |    EXV_DEBUG << "--> Offset                   = " << readDWORDTag(io_) << "\t(" << current_size << "/" << size_ << ")"
  720|       |              << '\n';
  721|       |    EXV_DEBUG << "--> Length                   = " << readDWORDTag(io_) << "\t(" << current_size << "/" << size_ << ")"
  722|       |              << '\n';
  723|       |    current_size += DWORD * 4;
  724|       |  }
  725|       |  if (LogMsg::debug >= LogMsg::level() && LogMsg::handler())
  726|       |    io_->seekOrThrow(io_->tell() - size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  727|       |#endif
  728|    119|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  729|    119|}
_ZNK5Exiv29RiffVideo13readDataChunkEm:
  731|    224|void RiffVideo::readDataChunk(uint64_t size_) const {
  732|       |#ifdef EXIV2_DEBUG_MESSAGES
  733|       |  EXV_INFO << "--> Data               = " << readStringTag(io_, static_cast<size_t>(size_)) << '\n';
  734|       |  uint64_t readed_size = size_;
  735|       |  if (size_ % 2 != 0) {
  736|       |    EXV_INFO << "--> pad byte          = " << readStringTag(io_, 1) << '\n';
  737|       |    readed_size += 1;
  738|       |  }
  739|       |  if (LogMsg::info >= LogMsg::level() && LogMsg::handler())
  740|       |    io_->seekOrThrow(io_->tell() - readed_size, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  741|       |#endif
  742|    224|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  743|    224|  if (size_ % 2 != 0)
  ------------------
  |  Branch (743:7): [True: 124, False: 100]
  ------------------
  744|    124|    io_->seekOrThrow(io_->tell() + 1, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  745|    224|}
_ZNK5Exiv29RiffVideo8readJunkEm:
  747|    158|void RiffVideo::readJunk(uint64_t size_) const {
  748|    158|  io_->seekOrThrow(io_->tell() + size_, BasicIo::beg, ErrorCode::kerFailedToReadImageData);
  749|    158|}
_ZN5Exiv29RiffVideo13getStreamTypeEj:
  751|  1.75k|std::string RiffVideo::getStreamType(uint32_t stream) {
  752|  1.75k|  if (stream == 1)
  ------------------
  |  Branch (752:7): [True: 117, False: 1.64k]
  ------------------
  753|    117|    return "Mono";
  754|  1.64k|  if (stream == 2)
  ------------------
  |  Branch (754:7): [True: 457, False: 1.18k]
  ------------------
  755|    457|    return "Stereo";
  756|  1.18k|  if (stream == 5)
  ------------------
  |  Branch (756:7): [True: 80, False: 1.10k]
  ------------------
  757|     80|    return "5.1 Surround Sound";
  758|  1.10k|  if (stream == 7)
  ------------------
  |  Branch (758:7): [True: 205, False: 899]
  ------------------
  759|    205|    return "7.1 Surround Sound";
  760|    899|  return "Mono";
  761|  1.10k|}
_ZN5Exiv29RiffVideo12fillDurationEdm:
  763|    701|void RiffVideo::fillDuration(double frame_rate, size_t frame_count) {
  764|    701|  if (frame_rate == 0)
  ------------------
  |  Branch (764:7): [True: 0, False: 701]
  ------------------
  765|      0|    return;
  766|       |
  767|    701|  auto duration = static_cast<uint64_t>(frame_count * 1000. / frame_rate);
  768|    701|  xmpData_["Xmp.video.FileDataRate"] = io_->size() / (1048576. * duration);
  769|    701|  xmpData_["Xmp.video.Duration"] = duration;  // Duration in number of seconds
  770|    701|}  // RiffVideo::fillDuration
_ZN5Exiv215newRiffInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  772|    673|Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  773|    673|  auto image = std::make_unique<RiffVideo>(std::move(io), params);
  774|    673|  if (!image->good()) {
  ------------------
  |  Branch (774:7): [True: 0, False: 673]
  ------------------
  775|      0|    return nullptr;
  776|      0|  }
  777|    673|  return image;
  778|    673|}
_ZN5Exiv210isRiffTypeERNS_7BasicIoEb:
  780|  7.13k|bool isRiffType(BasicIo& iIo, bool advance) {
  781|  7.13k|  constexpr int len = 4;
  782|  7.13k|  const std::array<byte, len> RiffVideoId{'R', 'I', 'F', 'F'};
  783|  7.13k|  std::array<byte, len> buf;
  784|  7.13k|  iIo.read(buf.data(), len);
  785|  7.13k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (785:7): [True: 0, False: 7.13k]
  |  Branch (785:22): [True: 245, False: 6.88k]
  ------------------
  786|    245|    return false;
  787|    245|  }
  788|  6.88k|  bool matched = buf == RiffVideoId;
  789|  6.88k|  if (!advance || !matched) {
  ------------------
  |  Branch (789:7): [True: 6.88k, False: 0]
  |  Branch (789:19): [True: 0, False: 0]
  ------------------
  790|  6.88k|    iIo.seek(-1 * len, BasicIo::cur);
  791|  6.88k|  }
  792|  6.88k|  return matched;
  793|  7.13k|}

_ZN5Exiv28Rw2ImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   30|  6.36k|    Image(ImageType::rw2, mdExif | mdIptc | mdXmp, std::move(io), params) {
   31|  6.36k|}  // Rw2Image::Rw2Image
_ZNK5Exiv28Rw2Image8mimeTypeEv:
   33|  18.8k|std::string Rw2Image::mimeType() const {
   34|  18.8k|  return "image/x-panasonic-rw2";
   35|  18.8k|}
_ZNK5Exiv28Rw2Image10pixelWidthEv:
   37|  3.01k|uint32_t Rw2Image::pixelWidth() const {
   38|  3.01k|  auto imageWidth = exifData_.findKey(Exiv2::ExifKey("Exif.PanasonicRaw.SensorWidth"));
   39|  3.01k|  if (imageWidth == exifData_.end() || imageWidth->count() == 0)
  ------------------
  |  Branch (39:7): [True: 2.49k, False: 518]
  |  Branch (39:7): [True: 2.97k, False: 33]
  |  Branch (39:40): [True: 485, False: 33]
  ------------------
   40|  2.97k|    return 0;
   41|     33|  return imageWidth->toUint32();
   42|  3.01k|}
_ZNK5Exiv28Rw2Image11pixelHeightEv:
   44|  3.01k|uint32_t Rw2Image::pixelHeight() const {
   45|  3.01k|  auto imageHeight = exifData_.findKey(Exiv2::ExifKey("Exif.PanasonicRaw.SensorHeight"));
   46|  3.01k|  if (imageHeight == exifData_.end() || imageHeight->count() == 0)
  ------------------
  |  Branch (46:7): [True: 2.56k, False: 447]
  |  Branch (46:7): [True: 2.97k, False: 34]
  |  Branch (46:41): [True: 413, False: 34]
  ------------------
   47|  2.97k|    return 0;
   48|     34|  return imageHeight->toUint32();
   49|  3.01k|}
_ZN5Exiv28Rw2Image12readMetadataEv:
   82|  6.36k|void Rw2Image::readMetadata() {
   83|       |#ifdef EXIV2_DEBUG_MESSAGES
   84|       |  std::cerr << "Reading RW2 file " << io_->path() << "\n";
   85|       |#endif
   86|  6.36k|  if (io_->open() != 0) {
  ------------------
  |  Branch (86:7): [True: 0, False: 6.36k]
  ------------------
   87|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   88|      0|  }
   89|  6.36k|  IoCloser closer(*io_);
   90|       |  // Ensure that this is the correct image type
   91|  6.36k|  if (!isRw2Type(*io_, false)) {
  ------------------
  |  Branch (91:7): [True: 0, False: 6.36k]
  ------------------
   92|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (92:9): [True: 0, False: 0]
  |  Branch (92:25): [True: 0, False: 0]
  ------------------
   93|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   94|      0|    throw Error(ErrorCode::kerNotAnImage, "RW2");
   95|      0|  }
   96|  6.36k|  clearMetadata();
   97|  6.36k|  const DecodeParams dp(max_recursion_depth_);
   98|  6.36k|  ByteOrder bo = Rw2Parser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), io_->size(), dp);
   99|  6.36k|  setByteOrder(bo);
  100|       |
  101|       |  // A lot more metadata is hidden in the embedded preview image
  102|       |  // Todo: This should go into the Rw2Parser, but for that it needs the Image
  103|  6.36k|  PreviewManager loader(*this);
  104|  6.36k|  PreviewPropertiesList list = loader.getPreviewProperties();
  105|       |  // Todo: What if there are more preview images?
  106|  6.36k|  if (list.size() > 1) {
  ------------------
  |  Branch (106:7): [True: 1.86k, False: 4.49k]
  ------------------
  107|  1.86k|#ifndef SUPPRESS_WARNINGS
  108|  1.86k|    EXV_WARNING << "RW2 image contains more than one preview. None used.\n";
  ------------------
  |  |  138|  1.86k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 1.86k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  1.86k|  LogMsg(LogMsg::warn).os()
  ------------------
  109|  1.86k|#endif
  110|  1.86k|  }
  111|  6.36k|  if (list.size() != 1)
  ------------------
  |  Branch (111:7): [True: 4.82k, False: 1.53k]
  ------------------
  112|  4.82k|    return;
  113|  1.53k|  ExifData exifData;
  114|  1.53k|  PreviewImage preview = loader.getPreviewImage(*list.begin());
  115|  1.53k|  auto image = ImageFactory::open(preview.pData(), preview.size());
  116|  1.53k|  if (!image) {
  ------------------
  |  Branch (116:7): [True: 0, False: 1.53k]
  ------------------
  117|      0|#ifndef SUPPRESS_WARNINGS
  118|      0|    EXV_WARNING << "Failed to open RW2 preview image.\n";
  ------------------
  |  |  138|      0|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 0]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      0|  LogMsg(LogMsg::warn).os()
  ------------------
  119|      0|#endif
  120|      0|    return;
  121|      0|  }
  122|  1.53k|  image->readMetadata();
  123|  1.53k|  ExifData& prevData = image->exifData();
  124|  1.53k|  if (!prevData.empty()) {
  ------------------
  |  Branch (124:7): [True: 1.23k, False: 297]
  ------------------
  125|       |    // Filter duplicate tags
  126|   128k|    for (const auto& pos : exifData_) {
  ------------------
  |  Branch (126:26): [True: 128k, False: 1.23k]
  ------------------
  127|   128k|      if (pos.ifdId() == IfdId::panaRawId)
  ------------------
  |  Branch (127:11): [True: 42.0k, False: 86.6k]
  ------------------
  128|  42.0k|        continue;
  129|  86.6k|      auto dup = prevData.findKey(ExifKey(pos.key()));
  130|  86.6k|      if (dup != prevData.end()) {
  ------------------
  |  Branch (130:11): [True: 19.0k, False: 67.6k]
  ------------------
  131|       |#ifdef EXIV2_DEBUG_MESSAGES
  132|       |        std::cerr << "Filtering duplicate tag " << pos.key() << " (values '" << pos.value() << "' and '" << dup->value()
  133|       |                  << "')\n";
  134|       |#endif
  135|  19.0k|        prevData.erase(dup);
  136|  19.0k|      }
  137|  86.6k|    }
  138|  1.23k|  }
  139|       |  // Remove tags not applicable for raw images
  140|  1.53k|  static constexpr auto filteredTags = std::array{
  141|  1.53k|      "Exif.Photo.ComponentsConfiguration",
  142|  1.53k|      "Exif.Photo.CompressedBitsPerPixel",
  143|  1.53k|      "Exif.Panasonic.ColorEffect",
  144|  1.53k|      "Exif.Panasonic.Contrast",
  145|  1.53k|      "Exif.Panasonic.NoiseReduction",
  146|  1.53k|      "Exif.Panasonic.ColorMode",
  147|  1.53k|      "Exif.Panasonic.OpticalZoomMode",
  148|  1.53k|      "Exif.Panasonic.Contrast",
  149|  1.53k|      "Exif.Panasonic.Saturation",
  150|  1.53k|      "Exif.Panasonic.Sharpness",
  151|  1.53k|      "Exif.Panasonic.FilmMode",
  152|  1.53k|      "Exif.Panasonic.SceneMode",
  153|  1.53k|      "Exif.Panasonic.WBRedLevel",
  154|  1.53k|      "Exif.Panasonic.WBGreenLevel",
  155|  1.53k|      "Exif.Panasonic.WBBlueLevel",
  156|  1.53k|      "Exif.Photo.ColorSpace",
  157|  1.53k|      "Exif.Photo.PixelXDimension",
  158|  1.53k|      "Exif.Photo.PixelYDimension",
  159|  1.53k|      "Exif.Photo.SceneType",
  160|  1.53k|      "Exif.Photo.CustomRendered",
  161|  1.53k|      "Exif.Photo.DigitalZoomRatio",
  162|  1.53k|      "Exif.Photo.SceneCaptureType",
  163|  1.53k|      "Exif.Photo.GainControl",
  164|  1.53k|      "Exif.Photo.Contrast",
  165|  1.53k|      "Exif.Photo.Saturation",
  166|  1.53k|      "Exif.Photo.Sharpness",
  167|  1.53k|      "Exif.Image.PrintImageMatching",
  168|  1.53k|      "Exif.Image.YCbCrPositioning",
  169|  1.53k|  };
  170|  38.3k|  for (auto&& filteredTag : filteredTags) {
  ------------------
  |  Branch (170:27): [True: 38.3k, False: 1.53k]
  ------------------
  171|  38.3k|    auto pos = prevData.findKey(ExifKey(filteredTag));
  172|  38.3k|    if (pos != prevData.end()) {
  ------------------
  |  Branch (172:9): [True: 39, False: 38.3k]
  ------------------
  173|       |#ifdef EXIV2_DEBUG_MESSAGES
  174|       |      std::cerr << "Exif tag " << pos->key() << " removed\n";
  175|       |#endif
  176|     39|      prevData.erase(pos);
  177|     39|    }
  178|  38.3k|  }
  179|       |
  180|       |  // Add the remaining tags
  181|   202k|  for (const auto& pos : prevData) {
  ------------------
  |  Branch (181:24): [True: 202k, False: 1.53k]
  ------------------
  182|   202k|    exifData_.add(pos);
  183|   202k|  }
  184|       |
  185|  1.53k|}  // Rw2Image::readMetadata
_ZN5Exiv28Rw2Image13writeMetadataEv:
  187|  2.20k|void Rw2Image::writeMetadata() {
  188|       |  // Todo: implement me!
  189|  2.20k|  throw(Error(ErrorCode::kerWritingImageFormatUnsupported, "RW2"));
  190|  2.20k|}  // Rw2Image::writeMetadata
_ZN5Exiv29Rw2Parser6decodeERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPKhmRKNS_12DecodeParamsE:
  193|  6.36k|                            const DecodeParams& dp) {
  194|  6.36k|  Rw2Header rw2Header;
  195|  6.36k|  return TiffParserWorker::decode(exifData, iptcData, xmpData, pData, size, Tag::pana, TiffMapping::findDecoder, dp,
  196|  6.36k|                                  &rw2Header);
  197|  6.36k|}
_ZN5Exiv214newRw2InstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  201|  6.36k|Image::UniquePtr newRw2Instance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  202|  6.36k|  auto image = std::make_unique<Rw2Image>(std::move(io), params);
  203|  6.36k|  if (!image->good()) {
  ------------------
  |  Branch (203:7): [True: 0, False: 6.36k]
  ------------------
  204|      0|    return nullptr;
  205|      0|  }
  206|  6.36k|  return image;
  207|  6.36k|}
_ZN5Exiv29isRw2TypeERNS_7BasicIoEb:
  209|  37.5k|bool isRw2Type(BasicIo& iIo, bool advance) {
  210|  37.5k|  const int32_t len = 24;
  211|  37.5k|  byte buf[len];
  212|  37.5k|  iIo.read(buf, len);
  213|  37.5k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (213:7): [True: 0, False: 37.5k]
  |  Branch (213:22): [True: 200, False: 37.3k]
  ------------------
  214|    200|    return false;
  215|    200|  }
  216|  37.3k|  Rw2Header header;
  217|  37.3k|  bool rc = header.read(buf, len);
  218|  37.3k|  if (!advance || !rc) {
  ------------------
  |  Branch (218:7): [True: 37.3k, False: 0]
  |  Branch (218:19): [True: 0, False: 0]
  ------------------
  219|  37.3k|    iIo.seek(-len, BasicIo::cur);
  220|  37.3k|  }
  221|  37.3k|  return rc;
  222|  37.5k|}

_ZN5Exiv28Internal9Rw2HeaderC2Ev:
    6|  43.6k|Rw2Header::Rw2Header() : TiffHeaderBase(0x0055, 24, littleEndian, 0x00000018) {
    7|  43.6k|}

_ZN4Safe3addIjEET_S1_S1_:
  137|  7.22k|T add(T summand_1, T summand_2) {
  138|  7.22k|  T res = 0;
  139|  7.22k|  if (Internal::builtin_add_overflow(summand_1, summand_2, res)) {
  ------------------
  |  Branch (139:7): [True: 7, False: 7.22k]
  ------------------
  140|      7|    throw std::overflow_error("Overflow in addition");
  141|      7|  }
  142|  7.22k|  return res;
  143|  7.22k|}
_ZN4Safe8Internal20builtin_add_overflowIjEEbT_S2_RS2_:
   96|  7.22k|bool builtin_add_overflow(T summand_1, T summand_2, T& result) {
   97|  7.22k|#if (defined(__GNUC__) || defined(__clang__)) && (__GNUC__ >= 5 || __clang_major__ >= 3)
   98|       |  if constexpr (std::is_same_v<T, int>)
   99|       |    return __builtin_sadd_overflow(summand_1, summand_2, &result);
  100|       |  else if constexpr (std::is_same_v<T, long>)
  101|       |    return __builtin_saddl_overflow(summand_1, summand_2, &result);
  102|       |  else if constexpr (std::is_same_v<T, long long>)
  103|       |    return __builtin_saddll_overflow(summand_1, summand_2, &result);
  104|       |  else if constexpr (std::is_same_v<T, unsigned int>)
  105|  7.22k|    return __builtin_uadd_overflow(summand_1, summand_2, &result);
  106|       |  else if constexpr (std::is_same_v<T, unsigned long>)
  107|       |    return __builtin_uaddl_overflow(summand_1, summand_2, &result);
  108|       |  else if constexpr (std::is_same_v<T, unsigned long long>)
  109|       |    return __builtin_uaddll_overflow(summand_1, summand_2, &result);
  110|       |  else
  111|       |#endif
  112|       |    return fallback_add_overflow(summand_1, summand_2, result);
  113|  7.22k|}
_ZN4Safe3addImEET_S1_S1_:
  137|  1.34M|T add(T summand_1, T summand_2) {
  138|  1.34M|  T res = 0;
  139|  1.34M|  if (Internal::builtin_add_overflow(summand_1, summand_2, res)) {
  ------------------
  |  Branch (139:7): [True: 4, False: 1.34M]
  ------------------
  140|      4|    throw std::overflow_error("Overflow in addition");
  141|      4|  }
  142|  1.34M|  return res;
  143|  1.34M|}
_ZN4Safe8Internal20builtin_add_overflowImEEbT_S2_RS2_:
   96|  1.34M|bool builtin_add_overflow(T summand_1, T summand_2, T& result) {
   97|  1.34M|#if (defined(__GNUC__) || defined(__clang__)) && (__GNUC__ >= 5 || __clang_major__ >= 3)
   98|       |  if constexpr (std::is_same_v<T, int>)
   99|       |    return __builtin_sadd_overflow(summand_1, summand_2, &result);
  100|       |  else if constexpr (std::is_same_v<T, long>)
  101|       |    return __builtin_saddl_overflow(summand_1, summand_2, &result);
  102|       |  else if constexpr (std::is_same_v<T, long long>)
  103|       |    return __builtin_saddll_overflow(summand_1, summand_2, &result);
  104|       |  else if constexpr (std::is_same_v<T, unsigned int>)
  105|       |    return __builtin_uadd_overflow(summand_1, summand_2, &result);
  106|       |  else if constexpr (std::is_same_v<T, unsigned long>)
  107|  1.34M|    return __builtin_uaddl_overflow(summand_1, summand_2, &result);
  108|       |  else if constexpr (std::is_same_v<T, unsigned long long>)
  109|       |    return __builtin_uaddll_overflow(summand_1, summand_2, &result);
  110|       |  else
  111|       |#endif
  112|       |    return fallback_add_overflow(summand_1, summand_2, result);
  113|  1.34M|}
_ZN4Safe3addIlEET_S1_S1_:
  137|  87.6k|T add(T summand_1, T summand_2) {
  138|  87.6k|  T res = 0;
  139|  87.6k|  if (Internal::builtin_add_overflow(summand_1, summand_2, res)) {
  ------------------
  |  Branch (139:7): [True: 1, False: 87.6k]
  ------------------
  140|      1|    throw std::overflow_error("Overflow in addition");
  141|      1|  }
  142|  87.6k|  return res;
  143|  87.6k|}
_ZN4Safe8Internal20builtin_add_overflowIlEEbT_S2_RS2_:
   96|  87.6k|bool builtin_add_overflow(T summand_1, T summand_2, T& result) {
   97|  87.6k|#if (defined(__GNUC__) || defined(__clang__)) && (__GNUC__ >= 5 || __clang_major__ >= 3)
   98|       |  if constexpr (std::is_same_v<T, int>)
   99|       |    return __builtin_sadd_overflow(summand_1, summand_2, &result);
  100|       |  else if constexpr (std::is_same_v<T, long>)
  101|  87.6k|    return __builtin_saddl_overflow(summand_1, summand_2, &result);
  102|       |  else if constexpr (std::is_same_v<T, long long>)
  103|       |    return __builtin_saddll_overflow(summand_1, summand_2, &result);
  104|       |  else if constexpr (std::is_same_v<T, unsigned int>)
  105|       |    return __builtin_uadd_overflow(summand_1, summand_2, &result);
  106|       |  else if constexpr (std::is_same_v<T, unsigned long>)
  107|       |    return __builtin_uaddl_overflow(summand_1, summand_2, &result);
  108|       |  else if constexpr (std::is_same_v<T, unsigned long long>)
  109|       |    return __builtin_uaddll_overflow(summand_1, summand_2, &result);
  110|       |  else
  111|       |#endif
  112|       |    return fallback_add_overflow(summand_1, summand_2, result);
  113|  87.6k|}

_ZN5Exiv28Internal17Samsung2MakerNote7tagListEv:
   19|  1.69k|  static constexpr auto tagList() {
   20|  1.69k|    return tagInfo_;
   21|  1.69k|  }
_ZN5Exiv28Internal17Samsung2MakerNote9tagListPwEv:
   23|  22.8k|  static constexpr auto tagListPw() {
   24|  22.8k|    return tagInfoPw_;
   25|  22.8k|  }

_ZN5Exiv28Internal14SigmaMakerNote7tagListEv:
   25|    425|  static constexpr auto tagList() {
   26|    425|    return tagInfo_;
   27|    425|  }

_ZN5Exiv28Internal15sonyTagDecipherEtPKhmPNS0_13TiffComponentE:
 2333|    524|DataBuf sonyTagDecipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* object) {
 2334|    524|  return sonyTagCipher(tag, bytes, size, object, true);
 2335|    524|}
_ZN5Exiv28Internal15sonyTagEncipherEtPKhmPNS0_13TiffComponentE:
 2336|    109|DataBuf sonyTagEncipher(uint16_t tag, const byte* bytes, size_t size, TiffComponent* object) {
 2337|    109|  return sonyTagCipher(tag, bytes, size, object, false);
 2338|    109|}
sonymn_int.cpp:_ZN5Exiv28InternalL13sonyTagCipherEtPKhmPKNS0_13TiffComponentEb:
 2309|    633|                             bool bDecipher) {
 2310|    633|  DataBuf b(bytes, size);  // copy the data
 2311|       |
 2312|       |  // initialize the code table
 2313|    633|  byte code[256];
 2314|   158k|  for (uint32_t i = 0; i < 249; i++) {
  ------------------
  |  Branch (2314:24): [True: 157k, False: 633]
  ------------------
 2315|   157k|    if (bDecipher) {
  ------------------
  |  Branch (2315:9): [True: 130k, False: 27.1k]
  ------------------
 2316|   130k|      code[(i * i * i) % 249] = static_cast<byte>(i);
 2317|   130k|    } else {
 2318|  27.1k|      code[i] = (i * i * i) % 249;
 2319|  27.1k|    }
 2320|   157k|  }
 2321|  5.06k|  for (uint32_t i = 249; i < 256; i++) {
  ------------------
  |  Branch (2321:26): [True: 4.43k, False: 633]
  ------------------
 2322|  4.43k|    code[i] = static_cast<byte>(i);
 2323|  4.43k|  }
 2324|       |
 2325|       |  // code byte-by-byte
 2326|  82.3k|  for (uint32_t i = 0; i < size; i++) {
  ------------------
  |  Branch (2326:24): [True: 81.7k, False: 633]
  ------------------
 2327|  81.7k|    b.write_uint8(i, code[bytes[i]]);
 2328|  81.7k|  }
 2329|       |
 2330|    633|  return b;
 2331|    633|}

_ZN5Exiv28Internal13SonyMakerNote7tagListEv:
   29|  18.0k|  static constexpr auto tagList() {
   30|  18.0k|    return tagInfo_;
   31|  18.0k|  }
_ZN5Exiv28Internal13SonyMakerNote9tagListCsEv:
   33|    800|  static constexpr auto tagListCs() {
   34|    800|    return tagInfoCs_;
   35|    800|  }
_ZN5Exiv28Internal13SonyMakerNote10tagListCs2Ev:
   37|    255|  static constexpr auto tagListCs2() {
   38|    255|    return tagInfoCs2_;
   39|    255|  }
_ZN5Exiv28Internal13SonyMakerNote9tagListFpEv:
   41|  21.0k|  static constexpr auto tagListFp() {
   42|  21.0k|    return tagInfoFp_;
   43|  21.0k|  }
_ZN5Exiv28Internal13SonyMakerNote16tagListSonyMisc1Ev:
   45|    510|  static constexpr auto tagListSonyMisc1() {
   46|    510|    return tagInfoSonyMisc1_;
   47|    510|  }
_ZN5Exiv28Internal13SonyMakerNote17tagListSonyMisc2bEv:
   49|    420|  static constexpr auto tagListSonyMisc2b() {
   50|    420|    return tagInfoSonyMisc2b_;
   51|    420|  }
_ZN5Exiv28Internal13SonyMakerNote17tagListSonyMisc3cEv:
   53|  23.5k|  static constexpr auto tagListSonyMisc3c() {
   54|  23.5k|    return tagInfoSonyMisc3c_;
   55|  23.5k|  }
_ZN5Exiv28Internal13SonyMakerNote17tagListSonySInfo1Ev:
   57|   627k|  static constexpr auto tagListSonySInfo1() {
   58|   627k|    return tagInfoSonySInfo1_;
   59|   627k|  }

_ZNK5Exiv28Internal13TagVocabularyeqENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
   48|  14.6M|bool TagVocabulary::operator==(std::string_view key) const {
   49|  14.6M|  return key.ends_with(voc_);
   50|  14.6M|}
_ZNK5Exiv29GroupInfoeqENS_5IfdIdE:
   68|   343M|bool GroupInfo::operator==(IfdId ifdId) const {
   69|   343M|  return ifdId_ == ifdId;
   70|   343M|}
_ZNK5Exiv29GroupInfoeqERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   72|   304M|bool GroupInfo::operator==(const GroupName& groupName) const {
   73|   304M|  return groupName == groupName_;
   74|   304M|}
_ZN5Exiv28ExifTags7tagListERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  108|  4.32k|const TagInfo* ExifTags::tagList(const std::string& groupName) {
  109|  4.32k|  return Internal::tagList(groupName);
  110|  4.32k|}
_ZNK5Exiv27ExifKey4Impl7tagNameEv:
  177|  2.50M|std::string ExifKey::Impl::tagName() const {
  178|  2.50M|  if (tagInfo_ && tagInfo_->tag_ != 0xffff) {
  ------------------
  |  Branch (178:7): [True: 2.50M, False: 0]
  |  Branch (178:19): [True: 947k, False: 1.55M]
  ------------------
  179|   947k|    return tagInfo_->name_;
  180|   947k|  }
  181|  1.55M|  return stringFormat("0x{:04x}", tag_);
  ------------------
  |  |   18|  1.55M|#define stringFormat std::format
  ------------------
  182|  2.50M|}
_ZN5Exiv27ExifKey4Impl12decomposeKeyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  184|   759k|void ExifKey::Impl::decomposeKey(const std::string& key) {
  185|       |  // Get the family name, IFD name and tag name parts of the key
  186|   759k|  std::string::size_type pos1 = key.find('.');
  187|   759k|  if (pos1 == std::string::npos)
  ------------------
  |  Branch (187:7): [True: 0, False: 759k]
  ------------------
  188|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  189|   759k|  std::string familyName = key.substr(0, pos1);
  190|   759k|  if (familyName != familyName_)
  ------------------
  |  Branch (190:7): [True: 0, False: 759k]
  ------------------
  191|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  192|   759k|  std::string::size_type pos0 = pos1 + 1;
  193|   759k|  pos1 = key.find('.', pos0);
  194|   759k|  if (pos1 == std::string::npos)
  ------------------
  |  Branch (194:7): [True: 0, False: 759k]
  ------------------
  195|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  196|   759k|  std::string groupName = key.substr(pos0, pos1 - pos0);
  197|   759k|  if (groupName.empty())
  ------------------
  |  Branch (197:7): [True: 0, False: 759k]
  ------------------
  198|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  199|   759k|  std::string tn = key.substr(pos1 + 1);
  200|   759k|  if (tn.empty())
  ------------------
  |  Branch (200:7): [True: 0, False: 759k]
  ------------------
  201|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  202|       |
  203|       |  // Find IfdId
  204|   759k|  IfdId ifdId = groupId(groupName);
  205|   759k|  if (ifdId == IfdId::ifdIdNotSet)
  ------------------
  |  Branch (205:7): [True: 0, False: 759k]
  ------------------
  206|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  207|   759k|  if (!Internal::isExifIfd(ifdId) && !Internal::isMakerIfd(ifdId)) {
  ------------------
  |  Branch (207:7): [True: 188k, False: 570k]
  |  Branch (207:38): [True: 0, False: 188k]
  ------------------
  208|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  209|      0|  }
  210|       |  // Convert tag
  211|   759k|  uint16_t tag = tagNumber(tn, ifdId);
  212|       |  // Get tag info
  213|   759k|  tagInfo_ = tagInfo(tag, ifdId);
  214|   759k|  if (!tagInfo_)
  ------------------
  |  Branch (214:7): [True: 0, False: 759k]
  ------------------
  215|      0|    throw Error(ErrorCode::kerInvalidKey, key);
  216|       |
  217|   759k|  tag_ = tag;
  218|   759k|  ifdId_ = ifdId;
  219|   759k|  groupName_ = groupName;
  220|       |  // tagName() translates hex tag name (0xabcd) to a real tag name if there is one
  221|   759k|  key_ = familyName + "." + groupName + "." + tagName();
  222|   759k|}
_ZN5Exiv27ExifKey4Impl7makeKeyEtNS_5IfdIdEPKNS_7TagInfoE:
  224|  1.74M|void ExifKey::Impl::makeKey(uint16_t tag, IfdId ifdId, const TagInfo* tagInfo) {
  225|  1.74M|  tagInfo_ = tagInfo;
  226|  1.74M|  tag_ = tag;
  227|  1.74M|  ifdId_ = ifdId;
  228|  1.74M|  key_ = std::string(familyName_) + "." + groupName_ + "." + tagName();
  229|  1.74M|}
_ZN5Exiv27ExifKeyC2EtRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  231|  1.74M|ExifKey::ExifKey(uint16_t tag, const std::string& groupName) : p_(std::make_unique<Impl>()) {
  232|  1.74M|  IfdId ifdId = groupId(groupName);
  233|       |  // Todo: Test if this condition can be removed
  234|  1.74M|  if (!Internal::isExifIfd(ifdId) && !Internal::isMakerIfd(ifdId)) {
  ------------------
  |  Branch (234:7): [True: 810k, False: 936k]
  |  Branch (234:38): [True: 0, False: 810k]
  ------------------
  235|      0|    throw Error(ErrorCode::kerInvalidIfdId, ifdId);
  236|      0|  }
  237|  1.74M|  if (auto ti = tagInfo(tag, ifdId)) {
  ------------------
  |  Branch (237:12): [True: 1.74M, False: 0]
  ------------------
  238|  1.74M|    p_->groupName_ = groupName;
  239|  1.74M|    p_->makeKey(tag, ifdId, ti);
  240|  1.74M|    return;
  241|  1.74M|  }
  242|      0|  throw Error(ErrorCode::kerInvalidIfdId, ifdId);
  243|  1.74M|}
_ZN5Exiv27ExifKeyC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  254|   759k|ExifKey::ExifKey(const std::string& key) : p_(std::make_unique<Impl>()) {
  255|   759k|  p_->decomposeKey(key);
  256|   759k|}
_ZN5Exiv27ExifKeyC2ERKS0_:
  258|  6.92M|ExifKey::ExifKey(const ExifKey& rhs) : p_(std::make_unique<Impl>(*rhs.p_)) {
  259|  6.92M|}
_ZN5Exiv27ExifKeyD2Ev:
  261|  9.43M|ExifKey::~ExifKey() = default;
_ZNK5Exiv27ExifKey6setIdxEi:
  270|  1.68M|void ExifKey::setIdx(int idx) const {
  271|  1.68M|  p_->idx_ = idx;
  272|  1.68M|}
_ZNK5Exiv27ExifKey3keyEv:
  274|  83.6M|std::string ExifKey::key() const {
  275|  83.6M|  return p_->key_;
  276|  83.6M|}
_ZNK5Exiv27ExifKey9groupNameEv:
  282|  2.60M|std::string ExifKey::groupName() const {
  283|  2.60M|  return p_->groupName_;
  284|  2.60M|}
_ZNK5Exiv27ExifKey7tagNameEv:
  286|    293|std::string ExifKey::tagName() const {
  287|    293|  return p_->tagName();
  288|    293|}
_ZNK5Exiv27ExifKey13defaultTypeIdEv:
  302|  1.94k|TypeId ExifKey::defaultTypeId() const {
  303|  1.94k|  if (!p_->tagInfo_)
  ------------------
  |  Branch (303:7): [True: 0, False: 1.94k]
  ------------------
  304|      0|    return unknownTag.typeId_;
  305|  1.94k|  return p_->tagInfo_->typeId_;
  306|  1.94k|}
_ZNK5Exiv27ExifKey3tagEv:
  308|  7.15M|uint16_t ExifKey::tag() const {
  309|  7.15M|  return p_->tag_;
  310|  7.15M|}
_ZNK5Exiv27ExifKey5cloneEv:
  312|  6.92M|ExifKey::UniquePtr ExifKey::clone() const {
  313|  6.92M|  return UniquePtr(clone_());
  314|  6.92M|}
_ZNK5Exiv27ExifKey6clone_Ev:
  316|  6.92M|ExifKey* ExifKey::clone_() const {
  317|  6.92M|  return new ExifKey(*this);
  318|  6.92M|}
_ZNK5Exiv27ExifKey5ifdIdEv:
  320|  11.7M|IfdId ExifKey::ifdId() const {
  321|  11.7M|  return p_->ifdId_;
  322|  11.7M|}
_ZNK5Exiv27ExifKey3idxEv:
  324|  2.65M|int ExifKey::idx() const {
  325|  2.65M|  return p_->idx_;
  326|  2.65M|}

_ZN5Exiv28Internal10ifdTagListEv:
 1778|  1.55M|const TagInfo* ifdTagList() {
 1779|  1.55M|  return ifdTagInfo;
 1780|  1.55M|}
_ZN5Exiv28Internal11exifTagListEv:
 2216|   217k|const TagInfo* exifTagList() {
 2217|   217k|  return exifTagInfo;
 2218|   217k|}
_ZN5Exiv28Internal10gpsTagListEv:
 2432|   116k|const TagInfo* gpsTagList() {
 2433|   116k|  return gpsTagInfo;
 2434|   116k|}
_ZN5Exiv28Internal10iopTagListEv:
 2507|  64.5k|const TagInfo* iopTagList() {
 2508|  64.5k|  return iopTagInfo;
 2509|  64.5k|}
_ZN5Exiv28Internal9mnTagListEv:
 2523|  13.2k|const TagInfo* mnTagList() {
 2524|  13.2k|  return mnTagInfo;
 2525|  13.2k|}
_ZN5Exiv28Internal10isMakerIfdENS_5IfdIdE:
 2527|   999k|bool isMakerIfd(IfdId ifdId) {
 2528|   999k|  if (auto ii = Exiv2::find(groupInfo, ifdId))
  ------------------
  |  Branch (2528:12): [True: 999k, False: 0]
  ------------------
 2529|   999k|    return std::string_view("Makernote") == ii->ifdName_;
 2530|      0|  return false;
 2531|   999k|}
_ZN5Exiv28Internal9isExifIfdENS_5IfdIdE:
 2533|  2.50M|bool isExifIfd(IfdId ifdId) {
 2534|  2.50M|  switch (ifdId) {
 2535|   338k|    case IfdId::ifd0Id:
  ------------------
  |  Branch (2535:5): [True: 338k, False: 2.16M]
  ------------------
 2536|   452k|    case IfdId::exifId:
  ------------------
  |  Branch (2536:5): [True: 113k, False: 2.39M]
  ------------------
 2537|   522k|    case IfdId::gpsId:
  ------------------
  |  Branch (2537:5): [True: 70.2k, False: 2.43M]
  ------------------
 2538|   583k|    case IfdId::iopId:
  ------------------
  |  Branch (2538:5): [True: 61.0k, False: 2.44M]
  ------------------
 2539|   629k|    case IfdId::ifd1Id:
  ------------------
  |  Branch (2539:5): [True: 45.8k, False: 2.46M]
  ------------------
 2540|   643k|    case IfdId::ifd2Id:
  ------------------
  |  Branch (2540:5): [True: 14.2k, False: 2.49M]
  ------------------
 2541|   644k|    case IfdId::ifd3Id:
  ------------------
  |  Branch (2541:5): [True: 548, False: 2.50M]
  ------------------
 2542|   644k|    case IfdId::mpfId:
  ------------------
  |  Branch (2542:5): [True: 0, False: 2.50M]
  ------------------
 2543|   910k|    case IfdId::subImage1Id:
  ------------------
  |  Branch (2543:5): [True: 266k, False: 2.23M]
  ------------------
 2544|  1.09M|    case IfdId::subImage2Id:
  ------------------
  |  Branch (2544:5): [True: 180k, False: 2.32M]
  ------------------
 2545|  1.20M|    case IfdId::subImage3Id:
  ------------------
  |  Branch (2545:5): [True: 110k, False: 2.39M]
  ------------------
 2546|  1.29M|    case IfdId::subImage4Id:
  ------------------
  |  Branch (2546:5): [True: 93.3k, False: 2.41M]
  ------------------
 2547|  1.30M|    case IfdId::subImage5Id:
  ------------------
  |  Branch (2547:5): [True: 12.1k, False: 2.49M]
  ------------------
 2548|  1.31M|    case IfdId::subImage6Id:
  ------------------
  |  Branch (2548:5): [True: 7.57k, False: 2.49M]
  ------------------
 2549|  1.32M|    case IfdId::subImage7Id:
  ------------------
  |  Branch (2549:5): [True: 11.7k, False: 2.49M]
  ------------------
 2550|  1.33M|    case IfdId::subImage8Id:
  ------------------
  |  Branch (2550:5): [True: 3.78k, False: 2.50M]
  ------------------
 2551|  1.33M|    case IfdId::subImage9Id:
  ------------------
  |  Branch (2551:5): [True: 6.57k, False: 2.50M]
  ------------------
 2552|  1.35M|    case IfdId::subThumb1Id:
  ------------------
  |  Branch (2552:5): [True: 19.5k, False: 2.48M]
  ------------------
 2553|  1.50M|    case IfdId::panaRawId:
  ------------------
  |  Branch (2553:5): [True: 150k, False: 2.35M]
  ------------------
 2554|  1.50M|      return true;
 2555|   999k|    default:
  ------------------
  |  Branch (2555:5): [True: 999k, False: 1.50M]
  ------------------
 2556|   999k|      return false;
 2557|  2.50M|  }
 2558|  2.50M|}
_ZN5Exiv28Internal7tagListENS_5IfdIdE:
 2568|  3.26M|const TagInfo* tagList(IfdId ifdId) {
 2569|  3.26M|  if (auto ii = Exiv2::find(groupInfo, ifdId))
  ------------------
  |  Branch (2569:12): [True: 3.26M, False: 0]
  ------------------
 2570|  3.26M|    if (ii->tagList_)
  ------------------
  |  Branch (2570:9): [True: 3.26M, False: 0]
  ------------------
 2571|  3.26M|      return ii->tagList_();
 2572|      0|  return nullptr;
 2573|  3.26M|}  // tagList
_ZN5Exiv28Internal7tagInfoEtNS_5IfdIdE:
 2575|  2.50M|const TagInfo* tagInfo(uint16_t tag, IfdId ifdId) {
 2576|  2.50M|  if (auto ti = tagList(ifdId)) {
  ------------------
  |  Branch (2576:12): [True: 2.50M, False: 0]
  ------------------
 2577|  2.50M|    int idx = 0;
 2578|   204M|    for (idx = 0; ti[idx].tag_ != 0xffff; ++idx) {
  ------------------
  |  Branch (2578:19): [True: 203M, False: 1.55M]
  ------------------
 2579|   203M|      if (ti[idx].tag_ == tag)
  ------------------
  |  Branch (2579:11): [True: 946k, False: 202M]
  ------------------
 2580|   946k|        break;
 2581|   203M|    }
 2582|  2.50M|    return ti + idx;
 2583|  2.50M|  }
 2584|      0|  return nullptr;
 2585|  2.50M|}  // tagInfo
_ZN5Exiv28Internal7tagInfoERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_5IfdIdE:
 2587|   759k|const TagInfo* tagInfo(const std::string& tagName, IfdId ifdId) {
 2588|   759k|  if (tagName.empty())
  ------------------
  |  Branch (2588:7): [True: 0, False: 759k]
  ------------------
 2589|      0|    return nullptr;
 2590|   759k|  if (auto ti = tagList(ifdId)) {
  ------------------
  |  Branch (2590:12): [True: 759k, False: 0]
  ------------------
 2591|  45.9M|    for (int idx = 0; ti[idx].tag_ != 0xffff; ++idx) {
  ------------------
  |  Branch (2591:23): [True: 45.9M, False: 73.4k]
  ------------------
 2592|  45.9M|      if (tagName == ti[idx].name_) {
  ------------------
  |  Branch (2592:11): [True: 685k, False: 45.2M]
  ------------------
 2593|   685k|        return ti + idx;
 2594|   685k|      }
 2595|  45.9M|    }
 2596|   759k|  }
 2597|  73.4k|  return nullptr;
 2598|   759k|}  // tagInfo
_ZN5Exiv28Internal7groupIdERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2600|  4.89M|IfdId groupId(const std::string& groupName) {
 2601|  4.89M|  if (auto ii = Exiv2::find(groupInfo, groupName))
  ------------------
  |  Branch (2601:12): [True: 4.89M, False: 0]
  ------------------
 2602|  4.89M|    return IfdId{ii->ifdId_};
 2603|      0|  return IfdId::ifdIdNotSet;
 2604|  4.89M|}
_ZN5Exiv28Internal9groupNameENS_5IfdIdE:
 2612|  1.73M|const char* groupName(IfdId ifdId) {
 2613|  1.73M|  if (auto ii = Exiv2::find(groupInfo, ifdId))
  ------------------
  |  Branch (2613:12): [True: 1.73M, False: 0]
  ------------------
 2614|  1.73M|    return ii->groupName_;
 2615|      0|  return groupInfo[0].groupName_;
 2616|  1.73M|}
_ZN5Exiv28Internal7fnumberEf:
 2647|    196|float fnumber(float apertureValue) {
 2648|    196|  float result = std::exp2(apertureValue / 2.F);
 2649|    196|  if (std::abs(result - 3.5F) < 0.1F) {
  ------------------
  |  Branch (2649:7): [True: 4, False: 192]
  ------------------
 2650|      4|    result = 3.5F;
 2651|      4|  }
 2652|    196|  return result;
 2653|    196|}
_ZN5Exiv28Internal12exposureTimeEf:
 2655|    196|URational exposureTime(float shutterSpeedValue) {
 2656|    196|  URational ur(1, 1);
 2657|    196|  const double tmp = std::exp2(shutterSpeedValue);
 2658|    196|  if (tmp > 1) {
  ------------------
  |  Branch (2658:7): [True: 101, False: 95]
  ------------------
 2659|    101|    const double x = std::round(tmp);
 2660|       |    // Check that x is within the range of a uint32_t before casting.
 2661|    101|    if (x <= std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (2661:9): [True: 42, False: 59]
  ------------------
 2662|     42|      ur.second = static_cast<uint32_t>(x);
 2663|     42|    }
 2664|    101|  } else {
 2665|     95|    const double x = std::round(1 / tmp);
 2666|       |    // Check that x is within the range of a uint32_t before casting.
 2667|     95|    if (0 <= x && x <= std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (2667:9): [True: 95, False: 0]
  |  Branch (2667:19): [True: 95, False: 0]
  ------------------
 2668|     95|      ur.first = static_cast<uint32_t>(x);
 2669|     95|    }
 2670|     95|  }
 2671|    196|  return ur;
 2672|    196|}
_ZN5Exiv28Internal9tagNumberERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_5IfdIdE:
 2674|   759k|uint16_t tagNumber(const std::string& tagName, IfdId ifdId) {
 2675|   759k|  auto ti = tagInfo(tagName, ifdId);
 2676|   759k|  if (ti && ti->tag_ != 0xffff)
  ------------------
  |  Branch (2676:7): [True: 685k, False: 73.4k]
  |  Branch (2676:13): [True: 685k, False: 0]
  ------------------
 2677|   685k|    return ti->tag_;
 2678|  73.4k|  if (!isHex(tagName, 4, "0x"))
  ------------------
  |  Branch (2678:7): [True: 0, False: 73.4k]
  ------------------
 2679|      0|    throw Error(ErrorCode::kerInvalidTag, tagName, ifdId);
 2680|  73.4k|  return static_cast<uint16_t>(std::stoi(tagName, nullptr, 16));
 2681|  73.4k|}  // tagNumber
_ZN5Exiv28Internal7tagListERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 3294|  4.32k|const TagInfo* tagList(const std::string& groupName) {
 3295|  4.32k|  auto ii = Exiv2::find(groupInfo, groupName);
 3296|  4.32k|  if (!ii || !ii->tagList_) {
  ------------------
  |  Branch (3296:7): [True: 0, False: 4.32k]
  |  Branch (3296:14): [True: 0, False: 4.32k]
  ------------------
 3297|      0|    return nullptr;
 3298|      0|  }
 3299|  4.32k|  return ii->tagList_();
 3300|  4.32k|}

_ZNK5Exiv28Internal10TagDetailseqEl:
   50|  10.1M|  bool operator==(int64_t key) const {
   51|  10.1M|    return key == val_;
   52|  10.1M|  }

_ZN5Exiv28TgaImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   22|      1|    Image(ImageType::tga, mdNone, std::move(io), params) {
   23|      1|}
_ZN5Exiv214newTgaInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
   96|      1|Image::UniquePtr newTgaInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
   97|      1|  auto image = std::make_unique<TgaImage>(std::move(io), params);
   98|      1|  if (!image->good()) {
  ------------------
  |  Branch (98:7): [True: 1, False: 0]
  ------------------
   99|      1|    return nullptr;
  100|      1|  }
  101|      0|  return image;
  102|      1|}
_ZN5Exiv29isTgaTypeERNS_7BasicIoEb:
  104|  10.7k|bool isTgaType(BasicIo& iIo, bool /*advance*/) {
  105|       |  // not all TARGA files have a signature string, so first just try to match the file name extension
  106|  10.7k|  const std::string& path = iIo.path();
  107|  10.7k|  if (path.ends_with(".tga") || path.ends_with(".TGA")) {
  ------------------
  |  Branch (107:7): [True: 0, False: 10.7k]
  |  Branch (107:33): [True: 0, False: 10.7k]
  ------------------
  108|      0|    return true;
  109|      0|  }
  110|  10.7k|  byte buf[26];
  111|  10.7k|  const size_t curPos = iIo.tell();
  112|  10.7k|  if (curPos < 26)
  ------------------
  |  Branch (112:7): [True: 10.6k, False: 123]
  ------------------
  113|  10.6k|    return false;
  114|       |
  115|    123|  iIo.seek(-26, BasicIo::end);
  116|    123|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (116:7): [True: 0, False: 123]
  |  Branch (116:22): [True: 0, False: 123]
  ------------------
  117|      0|    return false;
  118|      0|  }
  119|    123|  iIo.read(buf, sizeof(buf));
  120|    123|  if (iIo.error()) {
  ------------------
  |  Branch (120:7): [True: 0, False: 123]
  ------------------
  121|      0|    return false;
  122|      0|  }
  123|       |  // some TARGA files, but not all, have a signature string at the end
  124|    123|  bool matched = (memcmp(buf + 8, "TRUEVISION-XFILE", 16) == 0);
  125|    123|  iIo.seek(curPos, BasicIo::beg);
  126|    123|  return matched;
  127|    123|}

_ZNK5Exiv28Internal15TiffMappingInfoeqERKNS1_3KeyE:
   41|  20.2M|bool TiffMappingInfo::operator==(const TiffMappingInfo::Key& key) const {
   42|  20.2M|  return (make_ == "*" || key.m_.starts_with(make_)) && (Tag::all == extendedTag_ || key.e_ == extendedTag_) &&
  ------------------
  |  Branch (42:11): [True: 20.2M, False: 0]
  |  Branch (42:27): [True: 0, False: 0]
  |  Branch (42:58): [True: 4.05M, False: 16.1M]
  |  Branch (42:86): [True: 15.3k, False: 16.1M]
  ------------------
   43|  4.06M|         key.g_ == group_;
  ------------------
  |  Branch (43:10): [True: 8.80k, False: 4.05M]
  ------------------
   44|  20.2M|}
_ZN5Exiv28Internal9IoWrapperC2ERNS_7BasicIoEPKhmPNS0_12OffsetWriterE:
   47|  15.9k|    io_(io), pHeader_(pHeader), size_(size), pow_(pow) {
   48|  15.9k|  if (!pHeader_ || size_ == 0)
  ------------------
  |  Branch (48:7): [True: 5.18k, False: 10.7k]
  |  Branch (48:20): [True: 0, False: 10.7k]
  ------------------
   49|  5.18k|    wroteHeader_ = true;
   50|  15.9k|}
_ZN5Exiv28Internal9IoWrapper5writeEPKhm:
   52|  3.30M|size_t IoWrapper::write(const byte* pData, size_t wcount) {
   53|  3.30M|  if (!wroteHeader_ && wcount > 0) {
  ------------------
  |  Branch (53:7): [True: 10.6k, False: 3.29M]
  |  Branch (53:24): [True: 10.6k, False: 0]
  ------------------
   54|  10.6k|    io_.write(pHeader_, size_);
   55|  10.6k|    wroteHeader_ = true;
   56|  10.6k|  }
   57|  3.30M|  return io_.write(pData, wcount);
   58|  3.30M|}
_ZN5Exiv28Internal9IoWrapper4putbEh:
   60|  25.8k|int IoWrapper::putb(byte data) {
   61|  25.8k|  if (!wroteHeader_) {
  ------------------
  |  Branch (61:7): [True: 0, False: 25.8k]
  ------------------
   62|      0|    io_.write(pHeader_, size_);
   63|      0|    wroteHeader_ = true;
   64|      0|  }
   65|  25.8k|  return io_.putb(data);
   66|  25.8k|}
_ZN5Exiv28Internal9IoWrapper9setTargetEim:
   68|     37|void IoWrapper::setTarget(int id, size_t target) {
   69|     37|  if (target > std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (69:7): [True: 0, False: 37]
  ------------------
   70|      0|    throw Error(ErrorCode::kerOffsetOutOfRange);
   71|      0|  }
   72|     37|  if (pow_)
  ------------------
  |  Branch (72:7): [True: 14, False: 23]
  ------------------
   73|     14|    pow_->setTarget(static_cast<OffsetWriter::OffsetId>(id), static_cast<uint32_t>(target));
   74|     37|}
_ZN5Exiv28Internal13TiffDirectoryC2EtNS_5IfdIdEb:
   76|   111k|TiffDirectory::TiffDirectory(uint16_t tag, IfdId group, bool hasNext) : TiffComponent(tag, group), hasNext_(hasNext) {
   77|   111k|}
_ZN5Exiv28Internal10TiffSubIfdC2EtNS_5IfdIdES2_:
   80|  38.1k|    TiffEntryBase(tag, group, ttUnsignedLong), newGroup_(newGroup) {
   81|  38.1k|}
_ZN5Exiv28Internal16TiffIfdMakernoteC2EtNS_5IfdIdES2_NSt3__110unique_ptrINS0_8MnHeaderENS3_14default_deleteIS5_EEEEb:
   85|  11.6k|    TiffComponent(tag, group), pHeader_(std::move(pHeader)), ifd_(tag, mnGroup, hasNext) {
   86|  11.6k|}
_ZN5Exiv28Internal16TiffIfdMakernoteD2Ev:
   88|  11.6k|TiffIfdMakernote::~TiffIfdMakernote() = default;
_ZN5Exiv28Internal15TiffBinaryArrayC2EtNS_5IfdIdERKNS0_8ArrayCfgEPKNS0_8ArrayDefEm:
   92|  23.0k|    TiffEntryBase(tag, group, arrayCfg.elTiffType_), arrayCfg_(&arrayCfg), arrayDef_(arrayDef), defSize_(defSize) {
   93|  23.0k|}
_ZN5Exiv28Internal15TiffBinaryArrayC2EtNS_5IfdIdEPKNS0_8ArraySetEmPFitPKhmPNS0_13TiffComponentEE:
   97|  4.49k|    TiffEntryBase(tag, group),  // Todo: Does it make a difference that there is no type?
   98|  4.49k|    cfgSelFct_(cfgSelFct),
   99|  4.49k|    arraySet_(arraySet),
  100|  4.49k|    setSize_(setSize) {
  101|       |  // We'll figure out the correct cfg later
  102|  4.49k|}
_ZN5Exiv28Internal13TiffEntryBaseC2EtNS_5IfdIdENS0_8TiffTypeE:
  118|  6.13M|    TiffComponent(tag, group), tiffType_(tiffType) {
  119|  6.13M|}
_ZN5Exiv28Internal13TiffEntryBaseD2Ev:
  121|  6.16M|TiffEntryBase::~TiffEntryBase() = default;
_ZN5Exiv28Internal13TiffEntryBaseC2ERKS1_:
  124|  32.2k|    TiffComponent(rhs),
  125|  32.2k|    tiffType_(rhs.tiffType_),
  126|  32.2k|    count_(rhs.count_),
  127|  32.2k|    offset_(rhs.offset_),
  128|  32.2k|    size_(rhs.size_),
  129|  32.2k|    pData_(rhs.pData_),
  130|  32.2k|    idx_(rhs.idx_),
  131|  32.2k|    pValue_(rhs.pValue_ ? rhs.pValue_->clone().release() : nullptr),
  ------------------
  |  Branch (131:13): [True: 18.1k, False: 14.1k]
  ------------------
  132|  32.2k|    storage_(rhs.storage_) {
  133|  32.2k|}
_ZN5Exiv28Internal10TiffSubIfdC2ERKS1_:
  138|    232|TiffSubIfd::TiffSubIfd(const TiffSubIfd& rhs) : TiffEntryBase(rhs), newGroup_(rhs.newGroup_) {
  139|    232|}
_ZN5Exiv28Internal17TiffDataEntryBaseC2EtNS_5IfdIdEtS2_:
  142|  63.4k|    TiffEntryBase(tag, group), szTag_(szTag), szGroup_(szGroup) {
  143|  63.4k|}
_ZN5Exiv28Internal13TiffSizeEntryC2EtNS_5IfdIdEtS2_:
  148|  63.2k|    TiffEntryBase(tag, group), dtTag_(dtTag), dtGroup_(dtGroup) {
  149|  63.2k|}
_ZN5Exiv28Internal11TiffMnEntryC2EtNS_5IfdIdES2_:
  152|  29.1k|    TiffEntryBase(tag, group, ttUndefined), mnGroup_(mnGroup) {
  153|  29.1k|}
_ZN5Exiv28Internal11TiffMnEntryD2Ev:
  155|  29.1k|TiffMnEntry::~TiffMnEntry() = default;
_ZNK5Exiv28Internal13TiffComponent5cloneEv:
  157|  32.2k|TiffComponent::UniquePtr TiffComponent::clone() const {
  158|  32.2k|  return UniquePtr(doClone());
  159|  32.2k|}
_ZNK5Exiv28Internal9TiffEntry7doCloneEv:
  161|  26.8k|TiffEntry* TiffEntry::doClone() const {
  162|  26.8k|  return new TiffEntry(*this);
  163|  26.8k|}
_ZNK5Exiv28Internal13TiffDataEntry7doCloneEv:
  165|    193|TiffDataEntry* TiffDataEntry::doClone() const {
  166|    193|  return new TiffDataEntry(*this);
  167|    193|}
_ZNK5Exiv28Internal14TiffImageEntry7doCloneEv:
  169|  2.04k|TiffImageEntry* TiffImageEntry::doClone() const {
  170|  2.04k|  return new TiffImageEntry(*this);
  171|  2.04k|}
_ZNK5Exiv28Internal13TiffSizeEntry7doCloneEv:
  173|  2.93k|TiffSizeEntry* TiffSizeEntry::doClone() const {
  174|  2.93k|  return new TiffSizeEntry(*this);
  175|  2.93k|}
_ZNK5Exiv28Internal10TiffSubIfd7doCloneEv:
  181|    232|TiffSubIfd* TiffSubIfd::doClone() const {
  182|    232|  return new TiffSubIfd(*this);
  183|    232|}
_ZNK5Exiv28Internal13TiffEntryBase3idxEv:
  205|  14.3M|int TiffEntryBase::idx() const {
  206|  14.3M|  return idx_;
  207|  14.3M|}
_ZN5Exiv28Internal13TiffEntryBase7setDataENSt3__110shared_ptrINS_7DataBufEEE:
  209|   774k|void TiffEntryBase::setData(std::shared_ptr<DataBuf> buf) {
  210|   774k|  storage_ = std::move(buf);
  211|   774k|  pData_ = storage_->data();
  212|   774k|  size_ = storage_->size();
  213|   774k|}
_ZN5Exiv28Internal13TiffEntryBase7setDataEPhmNSt3__110shared_ptrINS_7DataBufEEE:
  215|  2.51M|void TiffEntryBase::setData(byte* pData, size_t size, std::shared_ptr<DataBuf> storage) {
  216|  2.51M|  pData_ = pData;
  217|  2.51M|  size_ = size;
  218|  2.51M|  storage_ = std::move(storage);
  219|  2.51M|  if (!pData_)
  ------------------
  |  Branch (219:7): [True: 0, False: 2.51M]
  ------------------
  220|      0|    size_ = 0;
  221|  2.51M|}
_ZN5Exiv28Internal13TiffEntryBase11updateValueENSt3__110unique_ptrINS_5ValueENS2_14default_deleteIS4_EEEENS_9ByteOrderE:
  223|  2.34M|void TiffEntryBase::updateValue(Value::UniquePtr value, ByteOrder byteOrder) {
  224|  2.34M|  if (!value)
  ------------------
  |  Branch (224:7): [True: 0, False: 2.34M]
  ------------------
  225|      0|    return;
  226|  2.34M|  if (size_t newSize = value->size(); newSize > size_) {
  ------------------
  |  Branch (226:39): [True: 773k, False: 1.57M]
  ------------------
  227|   773k|    auto d = std::make_shared<DataBuf>(newSize);
  228|   773k|    setData(std::move(d));
  229|   773k|  }
  230|  2.34M|  if (pData_) {
  ------------------
  |  Branch (230:7): [True: 799k, False: 1.55M]
  ------------------
  231|   799k|    memset(pData_, 0x0, size_);
  232|   799k|  }
  233|  2.34M|  size_ = value->copy(pData_, byteOrder);
  234|  2.34M|  setValue(std::move(value));
  235|  2.34M|}
_ZN5Exiv28Internal13TiffEntryBase8setValueENSt3__110unique_ptrINS_5ValueENS2_14default_deleteIS4_EEEE:
  237|  4.91M|void TiffEntryBase::setValue(Value::UniquePtr value) {
  238|  4.91M|  if (!value)
  ------------------
  |  Branch (238:7): [True: 0, False: 4.91M]
  ------------------
  239|      0|    return;
  240|  4.91M|  tiffType_ = toTiffType(value->typeId());
  241|  4.91M|  count_ = value->count();
  242|  4.91M|  pValue_ = std::move(value);
  243|  4.91M|}
_ZN5Exiv28Internal13TiffDataEntry9setStripsEPKNS_5ValueEPKhmm:
  245|  12.1k|void TiffDataEntry::setStrips(const Value* pSize, const byte* pData, size_t sizeData, size_t baseOffset) {
  246|  12.1k|  if (!pValue() || !pSize) {
  ------------------
  |  Branch (246:7): [True: 324, False: 11.8k]
  |  Branch (246:20): [True: 220, False: 11.6k]
  ------------------
  247|    544|#ifndef SUPPRESS_WARNINGS
  248|    544|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|    544|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 544]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    544|  LogMsg(LogMsg::warn).os()
  ------------------
  249|      0|                << tag() << ": Size or data offset value not set, ignoring them.\n";
  250|    544|#endif
  251|    544|    return;
  252|    544|  }
  253|  11.6k|  if (pValue()->count() == 0) {
  ------------------
  |  Branch (253:7): [True: 1.65k, False: 9.97k]
  ------------------
  254|  1.65k|#ifndef SUPPRESS_WARNINGS
  255|  1.65k|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  1.65k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 1.65k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  1.65k|  LogMsg(LogMsg::warn).os()
  ------------------
  256|      0|                << tag() << ": Data offset entry value is empty, ignoring it.\n";
  257|  1.65k|#endif
  258|  1.65k|    return;
  259|  1.65k|  }
  260|  9.97k|  if (pValue()->count() != pSize->count()) {
  ------------------
  |  Branch (260:7): [True: 1.50k, False: 8.47k]
  ------------------
  261|  1.50k|#ifndef SUPPRESS_WARNINGS
  262|  1.50k|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  1.50k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 1.50k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  1.50k|  LogMsg(LogMsg::warn).os()
  ------------------
  263|      0|                << tag() << ": Size and data offset entries have different"
  264|      0|                << " number of components, ignoring them.\n";
  265|  1.50k|#endif
  266|  1.50k|    return;
  267|  1.50k|  }
  268|  8.47k|  size_t size = 0;
  269|  20.3k|  for (size_t i = 0; i < pSize->count(); ++i) {
  ------------------
  |  Branch (269:22): [True: 11.8k, False: 8.47k]
  ------------------
  270|  11.8k|    size = Safe::add<size_t>(size, pSize->toUint32(i));
  271|  11.8k|  }
  272|  8.47k|  const size_t offset = pValue()->toUint32(0);
  273|  8.47k|  if (size > sizeData || offset > sizeData - size || baseOffset > sizeData - size - offset) {
  ------------------
  |  Branch (273:7): [True: 279, False: 8.19k]
  |  Branch (273:26): [True: 626, False: 7.57k]
  |  Branch (273:54): [True: 37, False: 7.53k]
  ------------------
  274|    942|#ifndef SUPPRESS_WARNINGS
  275|    942|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|    942|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 942]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    942|  LogMsg(LogMsg::warn).os()
  ------------------
  276|      0|                << tag() << ": Data area exceeds data buffer, ignoring it.\n";
  277|    942|#endif
  278|    942|    return;
  279|    942|  }
  280|       |  // Todo: Remove limitation of JPEG writer: strips must be contiguous
  281|       |  // Until then we check: last offset + last size - first offset == size?
  282|  7.53k|  if (pValue()->toUint32(pValue()->count() - 1) + pSize->toUint32(pSize->count() - 1) != size + offset) {
  ------------------
  |  Branch (282:7): [True: 298, False: 7.23k]
  ------------------
  283|    298|#ifndef SUPPRESS_WARNINGS
  284|    298|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|    298|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 298]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    298|  LogMsg(LogMsg::warn).os()
  ------------------
  285|      0|                << tag() << ": Data area is not contiguous, ignoring it.\n";
  286|    298|#endif
  287|    298|    return;
  288|    298|  }
  289|  7.23k|  pDataArea_ = const_cast<byte*>(pData) + baseOffset + offset;
  290|  7.23k|  sizeDataArea_ = size;
  291|  7.23k|  const_cast<Value*>(pValue())->setDataArea(pDataArea_, sizeDataArea_);
  292|  7.23k|}  // TiffDataEntry::setStrips
_ZN5Exiv28Internal14TiffImageEntry9setStripsEPKNS_5ValueEPKhmm:
  294|  36.9k|void TiffImageEntry::setStrips(const Value* pSize, const byte* pData, size_t sizeData, size_t baseOffset) {
  295|  36.9k|  if (!pValue() || !pSize) {
  ------------------
  |  Branch (295:7): [True: 1.64k, False: 35.3k]
  |  Branch (295:20): [True: 1.45k, False: 33.8k]
  ------------------
  296|  3.09k|#ifndef SUPPRESS_WARNINGS
  297|  3.09k|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  3.09k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 3.09k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  3.09k|  LogMsg(LogMsg::warn).os()
  ------------------
  298|      0|                << tag() << ": Size or data offset value not set, ignoring them.\n";
  299|  3.09k|#endif
  300|  3.09k|    return;
  301|  3.09k|  }
  302|  33.8k|  if (pValue()->count() != pSize->count()) {
  ------------------
  |  Branch (302:7): [True: 10.0k, False: 23.8k]
  ------------------
  303|  10.0k|#ifndef SUPPRESS_WARNINGS
  304|  10.0k|    EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  10.0k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 10.0k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  10.0k|  LogMsg(LogMsg::warn).os()
  ------------------
  305|      0|                << tag() << ": Size and data offset entries have different"
  306|      0|                << " number of components, ignoring them.\n";
  307|  10.0k|#endif
  308|  10.0k|    return;
  309|  10.0k|  }
  310|  2.65M|  for (size_t i = 0; i < pValue()->count(); ++i) {
  ------------------
  |  Branch (310:22): [True: 2.63M, False: 23.8k]
  ------------------
  311|  2.63M|    const size_t offset = pValue()->toUint32(i);
  312|  2.63M|    const size_t size = pSize->toUint32(i);
  313|       |
  314|  2.63M|    if (size > sizeData || offset > sizeData - size || baseOffset > sizeData - size - offset) {
  ------------------
  |  Branch (314:9): [True: 12.5k, False: 2.61M]
  |  Branch (314:28): [True: 30.4k, False: 2.58M]
  |  Branch (314:56): [True: 74, False: 2.58M]
  ------------------
  315|  43.0k|#ifndef SUPPRESS_WARNINGS
  316|  43.0k|      EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  43.0k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 43.0k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  43.0k|  LogMsg(LogMsg::warn).os()
  ------------------
  317|      0|                  << tag() << ": Strip " << std::dec << i << " is outside of the data area; ignored.\n";
  318|  43.0k|#endif
  319|  2.58M|    } else if (size != 0) {
  ------------------
  |  Branch (319:16): [True: 2.37M, False: 208k]
  ------------------
  320|  2.37M|      const byte* pStrip = pData + baseOffset + offset;
  321|  2.37M|      strips_.emplace_back(pStrip, size);
  322|  2.37M|    }
  323|  2.63M|  }
  324|  23.8k|}  // TiffImageEntry::setStrips
_ZNK5Exiv28Internal16TiffIfdMakernote9ifdOffsetEv:
  326|  4.98k|size_t TiffIfdMakernote::ifdOffset() const {
  327|  4.98k|  if (!pHeader_)
  ------------------
  |  Branch (327:7): [True: 2.17k, False: 2.80k]
  ------------------
  328|  2.17k|    return 0;
  329|  2.80k|  return pHeader_->ifdOffset();
  330|  4.98k|}
_ZNK5Exiv28Internal16TiffIfdMakernote9byteOrderEv:
  332|  20.2k|ByteOrder TiffIfdMakernote::byteOrder() const {
  333|  20.2k|  if (!pHeader_ || pHeader_->byteOrder() == invalidByteOrder) {
  ------------------
  |  Branch (333:7): [True: 4.78k, False: 15.4k]
  |  Branch (333:20): [True: 13.6k, False: 1.83k]
  ------------------
  334|  18.4k|    return imageByteOrder_;
  335|  18.4k|  }
  336|  1.83k|  return pHeader_->byteOrder();
  337|  20.2k|}
_ZNK5Exiv28Internal16TiffIfdMakernote8mnOffsetEv:
  339|  2.91k|size_t TiffIfdMakernote::mnOffset() const {
  340|  2.91k|  return mnOffset_;
  341|  2.91k|}
_ZNK5Exiv28Internal16TiffIfdMakernote10baseOffsetEv:
  343|  10.8k|size_t TiffIfdMakernote::baseOffset() const {
  344|  10.8k|  if (!pHeader_)
  ------------------
  |  Branch (344:7): [True: 2.66k, False: 8.21k]
  ------------------
  345|  2.66k|    return 0;
  346|  8.21k|  return pHeader_->baseOffset(mnOffset_);
  347|  10.8k|}
_ZN5Exiv28Internal16TiffIfdMakernote10readHeaderEPKhmNS_9ByteOrderE:
  349|  5.74k|bool TiffIfdMakernote::readHeader(const byte* pData, size_t size, ByteOrder byteOrder) {
  350|  5.74k|  if (!pHeader_)
  ------------------
  |  Branch (350:7): [True: 2.17k, False: 3.57k]
  ------------------
  351|  2.17k|    return true;
  352|  3.57k|  return pHeader_->read(pData, size, byteOrder);
  353|  5.74k|}
_ZN5Exiv28Internal16TiffIfdMakernote12setByteOrderENS_9ByteOrderE:
  355|  4.99k|void TiffIfdMakernote::setByteOrder(ByteOrder byteOrder) {
  356|  4.99k|  if (pHeader_)
  ------------------
  |  Branch (356:7): [True: 4.51k, False: 486]
  ------------------
  357|  4.51k|    pHeader_->setByteOrder(byteOrder);
  358|  4.99k|}
_ZNK5Exiv28Internal16TiffIfdMakernote10sizeHeaderEv:
  360|  50.0k|size_t TiffIfdMakernote::sizeHeader() const {
  361|  50.0k|  if (!pHeader_)
  ------------------
  |  Branch (361:7): [True: 4.87k, False: 45.2k]
  ------------------
  362|  4.87k|    return 0;
  363|  45.2k|  return pHeader_->size();
  364|  50.0k|}
_ZNK5Exiv28Internal16TiffIfdMakernote11writeHeaderERNS0_9IoWrapperENS_9ByteOrderE:
  366|  5.90k|size_t TiffIfdMakernote::writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const {
  367|  5.90k|  if (!pHeader_)
  ------------------
  |  Branch (367:7): [True: 486, False: 5.41k]
  ------------------
  368|    486|    return 0;
  369|  5.41k|  return pHeader_->write(ioWrapper, byteOrder);
  370|  5.90k|}
_ZNK5Exiv28Internal8ArrayDef4sizeEtNS_5IfdIdE:
  372|  4.22M|size_t ArrayDef::size(uint16_t tag, IfdId group) const {
  373|  4.22M|  TypeId typeId = toTypeId(tiffType_, tag, group);
  374|  4.22M|  return count_ * TypeInfo::typeSize(typeId);
  375|  4.22M|}
_ZN5Exiv28Internal15TiffBinaryArray10initializeENS_5IfdIdE:
  377|  1.24M|bool TiffBinaryArray::initialize(IfdId group) {
  378|  1.24M|  if (arrayCfg_)
  ------------------
  |  Branch (378:7): [True: 1.24M, False: 268]
  ------------------
  379|  1.24M|    return true;  // Not a complex array or already initialized
  380|       |
  381|    636|  for (size_t idx = 0; idx < setSize_; ++idx) {
  ------------------
  |  Branch (381:24): [True: 636, False: 0]
  ------------------
  382|    636|    if (arraySet_[idx].cfg_.group_ == group) {
  ------------------
  |  Branch (382:9): [True: 268, False: 368]
  ------------------
  383|    268|      arrayCfg_ = &arraySet_[idx].cfg_;
  384|    268|      arrayDef_ = arraySet_[idx].def_;
  385|    268|      defSize_ = arraySet_[idx].defSize_;
  386|    268|      return true;
  387|    268|    }
  388|    636|  }
  389|      0|  return false;
  390|    268|}
_ZN5Exiv28Internal15TiffBinaryArray10initializeEPNS0_13TiffComponentE:
  392|  3.32k|bool TiffBinaryArray::initialize(TiffComponent* pRoot) {
  393|  3.32k|  if (!cfgSelFct_)
  ------------------
  |  Branch (393:7): [True: 1.79k, False: 1.52k]
  ------------------
  394|  1.79k|    return true;  // Not a complex array
  395|       |
  396|  1.52k|  int idx = cfgSelFct_(tag(), pData(), TiffEntryBase::doSize(), pRoot);
  397|  1.52k|  if (idx > -1) {
  ------------------
  |  Branch (397:7): [True: 975, False: 552]
  ------------------
  398|    975|    arrayCfg_ = &arraySet_[idx].cfg_;
  399|    975|    arrayDef_ = arraySet_[idx].def_;
  400|    975|    defSize_ = arraySet_[idx].defSize_;
  401|    975|  }
  402|  1.52k|  return idx > -1;
  403|  3.32k|}
_ZN5Exiv28Internal15TiffBinaryArray14iniOrigDataBufEv:
  405|  10.2k|void TiffBinaryArray::iniOrigDataBuf() {
  406|  10.2k|  origData_ = const_cast<byte*>(pData());
  407|  10.2k|  origSize_ = TiffEntryBase::doSize();
  408|  10.2k|}
_ZN5Exiv28Internal15TiffBinaryArray14updOrigDataBufEPKhm:
  410|     47|bool TiffBinaryArray::updOrigDataBuf(const byte* pData, size_t size) {
  411|     47|  if (origSize_ != size)
  ------------------
  |  Branch (411:7): [True: 0, False: 47]
  ------------------
  412|      0|    return false;
  413|     47|  if (origData_ == pData)
  ------------------
  |  Branch (413:7): [True: 24, False: 23]
  ------------------
  414|     24|    return true;
  415|     23|  std::memcpy(origData_, pData, origSize_);
  416|     23|  return true;
  417|     47|}
_ZN5Exiv28Internal15TiffBinaryArray10addElementEmRKNS0_8ArrayDefE:
  419|  1.35M|size_t TiffBinaryArray::addElement(size_t idx, const ArrayDef& def) {
  420|  1.35M|  auto tag = static_cast<uint16_t>(idx / cfg()->tagStep());
  421|  1.35M|  auto sz = std::min<size_t>(def.size(tag, cfg()->group_), TiffEntryBase::doSize() - idx);
  422|  1.35M|  auto tc = TiffCreator::create(tag, cfg()->group_);
  423|  1.35M|  auto tp = dynamic_cast<TiffBinaryElement*>(tc.get());
  424|  1.35M|  if (!tp)
  ------------------
  |  Branch (424:7): [True: 0, False: 1.35M]
  ------------------
  425|      0|    return 0;
  426|       |  // The assertion typically fails if a component is not configured in
  427|       |  // the TIFF structure table (TiffCreator::tiffTreeStruct_)
  428|  1.35M|  tp->setStart(pData() + idx);
  429|  1.35M|  auto s = storage();
  430|  1.35M|  tp->setData(const_cast<byte*>(pData() + idx), sz, std::move(s));
  431|  1.35M|  tp->setElDef(def);
  432|  1.35M|  tp->setElByteOrder(cfg()->byteOrder_);
  433|  1.35M|  addChild(std::move(tc));
  434|  1.35M|  return sz;
  435|  1.35M|}  // TiffBinaryArray::addElement
_ZN5Exiv28Internal13TiffComponent7addPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPS1_NS2_10unique_ptrIS1_NS2_14default_deleteIS1_EEEE:
  438|  14.9M|                                      TiffComponent::UniquePtr object) {
  439|  14.9M|  return doAddPath(tag, tiffPath, pRoot, std::move(object));
  440|  14.9M|}  // TiffComponent::addPath
_ZN5Exiv28Internal13TiffComponent9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPS1_NS2_10unique_ptrIS1_NS2_14default_deleteIS1_EEEE:
  443|  2.35M|                                        TiffComponent::UniquePtr /*object*/) {
  444|  2.35M|  return this;
  445|  2.35M|}  // TiffComponent::doAddPath
_ZN5Exiv28Internal13TiffDirectory9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEE:
  448|  5.99M|                                        TiffComponent::UniquePtr object) {
  449|  5.99M|  tiffPath.pop();
  450|  5.99M|  const TiffPathItem tpi = tiffPath.top();
  451|       |
  452|  5.99M|  TiffComponent* tc = nullptr;
  453|       |  // Try to use an existing component if there is still at least one
  454|       |  // composite tag on the stack or the tag to add is the MakerNote tag.
  455|       |  // This is used to prevent duplicate entries. Sub-IFDs also, but the > 1
  456|       |  // condition takes care of them, see below.
  457|  5.99M|  if (tiffPath.size() > 1 || (tpi.extendedTag() == 0x927c && tpi.group() == IfdId::exifId)) {
  ------------------
  |  Branch (457:7): [True: 4.85M, False: 1.13M]
  |  Branch (457:31): [True: 933, False: 1.13M]
  |  Branch (457:62): [True: 692, False: 241]
  ------------------
  458|  4.85M|    if (tpi.extendedTag() == Tag::next) {
  ------------------
  |  Branch (458:9): [True: 27.8k, False: 4.83M]
  ------------------
  459|  27.8k|      tc = pNext_.get();
  460|  4.83M|    } else {
  461|  34.5M|      for (auto&& component : components_) {
  ------------------
  |  Branch (461:29): [True: 34.5M, False: 17.3k]
  ------------------
  462|  34.5M|        if (component->tag() == tpi.tag() && component->group() == tpi.group()) {
  ------------------
  |  Branch (462:13): [True: 4.82M, False: 29.7M]
  |  Branch (462:46): [True: 4.81M, False: 14.9k]
  ------------------
  463|  4.81M|          tc = component.get();
  464|  4.81M|          break;
  465|  4.81M|        }
  466|  34.5M|      }
  467|  4.83M|    }
  468|  4.85M|  }
  469|       |
  470|  5.99M|  if (tc)
  ------------------
  |  Branch (470:7): [True: 4.83M, False: 1.15M]
  ------------------
  471|  4.83M|    return tc->addPath(tag, tiffPath, pRoot, std::move(object));
  472|       |
  473|  1.15M|  auto atc = [&] {
  474|  1.15M|    if (tiffPath.size() == 1 && object) {
  475|  1.15M|      return std::move(object);
  476|  1.15M|    }
  477|  1.15M|    return TiffCreator::create(tpi.extendedTag(), tpi.group());
  478|  1.15M|  }();
  479|       |
  480|       |  // Prevent dangling sub-IFD tags: Do not add a sub-IFD component without children.
  481|       |  // Todo: How to check before creating the component?
  482|  1.15M|  if (tiffPath.size() == 1 && dynamic_cast<const TiffSubIfd*>(atc.get()))
  ------------------
  |  Branch (482:7): [True: 1.13M, False: 17.8k]
  |  Branch (482:31): [True: 15.1k, False: 1.12M]
  ------------------
  483|  15.1k|    return nullptr;
  484|       |
  485|  1.14M|  tc = [&] {
  486|  1.14M|    if (tpi.extendedTag() == Tag::next)
  487|  1.14M|      return this->addNext(std::move(atc));
  488|  1.14M|    return this->addChild(std::move(atc));
  489|  1.14M|  }();
  490|  1.14M|  return tc->addPath(tag, tiffPath, pRoot, nullptr);
  491|  1.15M|}  // TiffDirectory::doAddPath
_ZN5Exiv28Internal10TiffSubIfd9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEE:
  494|  1.84M|                                     TiffComponent::UniquePtr object) {
  495|  1.84M|  const TiffPathItem tpi1 = tiffPath.top();
  496|  1.84M|  tiffPath.pop();
  497|  1.84M|  if (tiffPath.empty()) {
  ------------------
  |  Branch (497:7): [True: 0, False: 1.84M]
  ------------------
  498|       |    // If the last element in the path is the sub-IFD tag itself we're done.
  499|       |    // But that shouldn't happen - see TiffDirectory::doAddPath
  500|      0|    return this;
  501|      0|  }
  502|  1.84M|  const TiffPathItem tpi2 = tiffPath.top();
  503|  1.84M|  tiffPath.push(tpi1);
  504|  1.84M|  for (const auto& ifd : ifds_)
  ------------------
  |  Branch (504:24): [True: 1.97M, False: 9.24k]
  ------------------
  505|  1.97M|    if (ifd->group() == tpi2.group())
  ------------------
  |  Branch (505:9): [True: 1.83M, False: 144k]
  ------------------
  506|  1.83M|      return ifd->addPath(tag, tiffPath, pRoot, std::move(object));
  507|       |
  508|  9.24k|  auto tc = [&] {
  509|  9.24k|    if (tiffPath.size() == 1 && object) {
  510|  9.24k|      return addChild(std::move(object));
  511|  9.24k|    }
  512|  9.24k|    return addChild(std::make_unique<TiffDirectory>(tpi1.tag(), tpi2.group()));
  513|  9.24k|  }();
  514|  9.24k|  setCount(ifds_.size());
  515|  9.24k|  return tc->addPath(tag, tiffPath, pRoot, nullptr);
  516|  1.84M|}  // TiffSubIfd::doAddPath
_ZN5Exiv28Internal11TiffMnEntry9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEE:
  519|  1.74M|                                      TiffComponent::UniquePtr object) {
  520|  1.74M|  const TiffPathItem tpi1 = tiffPath.top();
  521|  1.74M|  tiffPath.pop();
  522|  1.74M|  if (tiffPath.empty()) {
  ------------------
  |  Branch (522:7): [True: 9.60k, False: 1.73M]
  ------------------
  523|       |    // If the last element in the path is the makernote tag itself we're done
  524|  9.60k|    return this;
  525|  9.60k|  }
  526|  1.73M|  const TiffPathItem tpi2 = tiffPath.top();
  527|  1.73M|  tiffPath.push(tpi1);
  528|  1.73M|  if (!mn_) {
  ------------------
  |  Branch (528:7): [True: 5.94k, False: 1.73M]
  ------------------
  529|  5.94k|    mnGroup_ = tpi2.group();
  530|  5.94k|    mn_ = TiffMnCreator::create(tpi1.tag(), tpi1.group(), mnGroup_);
  531|  5.94k|  }
  532|  1.73M|  return mn_->addPath(tag, tiffPath, pRoot, std::move(object));
  533|  1.74M|}  // TiffMnEntry::doAddPath
_ZN5Exiv28Internal16TiffIfdMakernote9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEE:
  536|  1.73M|                                           TiffComponent::UniquePtr object) {
  537|  1.73M|  return ifd_.addPath(tag, tiffPath, pRoot, std::move(object));
  538|  1.73M|}
_ZN5Exiv28Internal15TiffBinaryArray9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEE:
  541|  1.26M|                                          TiffComponent::UniquePtr object) {
  542|  1.26M|  pRoot_ = pRoot;
  543|  1.26M|  if (tiffPath.size() == 1) {
  ------------------
  |  Branch (543:7): [True: 12.0k, False: 1.24M]
  ------------------
  544|       |    // An unknown complex binary array has no children and acts like a standard TIFF entry
  545|  12.0k|    return this;
  546|  12.0k|  }
  547|  1.24M|  tiffPath.pop();
  548|  1.24M|  const TiffPathItem tpi = tiffPath.top();
  549|       |  // Initialize the binary array (if it is a complex array)
  550|  1.24M|  initialize(tpi.group());
  551|       |  // Todo: Duplicates are not allowed!
  552|       |  // To allow duplicate entries, we only check if the new component already
  553|       |  // exists if there is still at least one composite tag on the stack
  554|  1.24M|  if (tiffPath.size() > 1) {
  ------------------
  |  Branch (554:7): [True: 0, False: 1.24M]
  ------------------
  555|      0|    for (const auto& element : elements_)
  ------------------
  |  Branch (555:30): [True: 0, False: 0]
  ------------------
  556|      0|      if (element->tag() == tpi.tag() && element->group() == tpi.group())
  ------------------
  |  Branch (556:11): [True: 0, False: 0]
  |  Branch (556:42): [True: 0, False: 0]
  ------------------
  557|      0|        return element->addPath(tag, tiffPath, pRoot, std::move(object));
  558|      0|  }
  559|       |
  560|  1.24M|  if (tiffPath.size() == 1 && object) {
  ------------------
  |  Branch (560:7): [True: 1.24M, False: 0]
  |  Branch (560:31): [True: 0, False: 1.24M]
  ------------------
  561|      0|    auto tc = addChild(std::move(object));
  562|      0|    setCount(elements_.size());
  563|      0|    return tc->addPath(tag, tiffPath, pRoot, nullptr);
  564|      0|  }
  565|       |
  566|  1.24M|  auto tc = addChild(TiffCreator::create(tpi.extendedTag(), tpi.group()));
  567|  1.24M|  setCount(elements_.size());
  568|  1.24M|  return tc->addPath(tag, tiffPath, pRoot, std::move(object));
  569|  1.24M|}  // TiffBinaryArray::doAddPath
_ZN5Exiv28Internal13TiffComponent8addChildENSt3__110shared_ptrIS1_EE:
  571|  6.21M|TiffComponent* TiffComponent::addChild(TiffComponent::SharedPtr tiffComponent) {
  572|  6.21M|  return doAddChild(std::move(tiffComponent));
  573|  6.21M|}  // TiffComponent::addChild
_ZN5Exiv28Internal13TiffDirectory10doAddChildENSt3__110shared_ptrINS0_13TiffComponentEEE:
  579|  3.54M|TiffComponent* TiffDirectory::doAddChild(TiffComponent::SharedPtr tiffComponent) {
  580|  3.54M|  return components_.emplace_back(std::move(tiffComponent)).get();
  581|  3.54M|}  // TiffDirectory::doAddChild
_ZN5Exiv28Internal10TiffSubIfd10doAddChildENSt3__110shared_ptrINS0_13TiffComponentEEE:
  583|  65.7k|TiffComponent* TiffSubIfd::doAddChild(TiffComponent::SharedPtr tiffComponent) {
  584|  65.7k|  auto d = std::dynamic_pointer_cast<TiffDirectory>(std::move(tiffComponent));
  585|  65.7k|  if (!d)
  ------------------
  |  Branch (585:7): [True: 0, False: 65.7k]
  ------------------
  586|      0|    throw Error(ErrorCode::kerErrorMessage, "dynamic_pointer_cast to TiffDirectory failed");
  587|       |
  588|  65.7k|  return ifds_.emplace_back(std::move(d)).get();
  589|  65.7k|}  // TiffSubIfd::doAddChild
_ZN5Exiv28Internal15TiffBinaryArray10doAddChildENSt3__110shared_ptrINS0_13TiffComponentEEE:
  602|  2.60M|TiffComponent* TiffBinaryArray::doAddChild(TiffComponent::SharedPtr tiffComponent) {
  603|  2.60M|  setDecoded(true);
  604|  2.60M|  return elements_.emplace_back(std::move(tiffComponent)).get();
  605|  2.60M|}  // TiffBinaryArray::doAddChild
_ZN5Exiv28Internal13TiffComponent7addNextENSt3__110unique_ptrIS1_NS2_14default_deleteIS1_EEEE:
  607|  2.57k|TiffComponent* TiffComponent::addNext(TiffComponent::UniquePtr tiffComponent) {
  608|  2.57k|  return doAddNext(std::move(tiffComponent));
  609|  2.57k|}  // TiffComponent::addNext
_ZN5Exiv28Internal13TiffDirectory9doAddNextENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEE:
  615|  2.57k|TiffComponent* TiffDirectory::doAddNext(TiffComponent::UniquePtr tiffComponent) {
  616|  2.57k|  if (hasNext_) {
  ------------------
  |  Branch (616:7): [True: 2.57k, False: 0]
  ------------------
  617|  2.57k|    pNext_ = std::move(tiffComponent);
  618|  2.57k|    return pNext_.get();
  619|  2.57k|  }
  620|      0|  return nullptr;
  621|  2.57k|}  // TiffDirectory::doAddNext
_ZN5Exiv28Internal13TiffComponent6acceptERNS0_11TiffVisitorE:
  634|  39.0M|void TiffComponent::accept(TiffVisitor& visitor) {
  635|  39.0M|  if (visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (635:7): [True: 39.0M, False: 7.77k]
  ------------------
  636|  39.0M|    doAccept(visitor);  // one for NVI :)
  637|  39.0M|}  // TiffComponent::accept
_ZN5Exiv28Internal9TiffEntry8doAcceptERNS0_11TiffVisitorE:
  639|  22.3M|void TiffEntry::doAccept(TiffVisitor& visitor) {
  640|  22.3M|  visitor.visitEntry(this);
  641|  22.3M|}  // TiffEntry::doAccept
_ZN5Exiv28Internal13TiffDataEntry8doAcceptERNS0_11TiffVisitorE:
  643|   157k|void TiffDataEntry::doAccept(TiffVisitor& visitor) {
  644|   157k|  visitor.visitDataEntry(this);
  645|   157k|}  // TiffDataEntry::doAccept
_ZN5Exiv28Internal14TiffImageEntry8doAcceptERNS0_11TiffVisitorE:
  647|  1.34M|void TiffImageEntry::doAccept(TiffVisitor& visitor) {
  648|  1.34M|  visitor.visitImageEntry(this);
  649|  1.34M|}  // TiffImageEntry::doAccept
_ZN5Exiv28Internal13TiffSizeEntry8doAcceptERNS0_11TiffVisitorE:
  651|  1.18M|void TiffSizeEntry::doAccept(TiffVisitor& visitor) {
  652|  1.18M|  visitor.visitSizeEntry(this);
  653|  1.18M|}  // TiffSizeEntry::doAccept
_ZN5Exiv28Internal13TiffDirectory8doAcceptERNS0_11TiffVisitorE:
  655|  1.08M|void TiffDirectory::doAccept(TiffVisitor& visitor) {
  656|  1.08M|  visitor.visitDirectory(this);
  657|  25.9M|  for (auto&& component : components_) {
  ------------------
  |  Branch (657:25): [True: 25.9M, False: 904k]
  ------------------
  658|  25.9M|    if (!visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (658:9): [True: 183k, False: 25.7M]
  ------------------
  659|   183k|      break;
  660|  25.7M|    component->accept(visitor);
  661|  25.7M|  }
  662|  1.08M|  if (visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (662:7): [True: 893k, False: 193k]
  ------------------
  663|   893k|    visitor.visitDirectoryNext(this);
  664|  1.08M|  if (pNext_)
  ------------------
  |  Branch (664:7): [True: 39.0k, False: 1.04M]
  ------------------
  665|  39.0k|    pNext_->accept(visitor);
  666|  1.08M|  if (visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (666:7): [True: 878k, False: 209k]
  ------------------
  667|   878k|    visitor.visitDirectoryEnd(this);
  668|  1.08M|}  // TiffDirectory::doAccept
_ZN5Exiv28Internal10TiffSubIfd8doAcceptERNS0_11TiffVisitorE:
  670|   204k|void TiffSubIfd::doAccept(TiffVisitor& visitor) {
  671|   204k|  visitor.visitSubIfd(this);
  672|   784k|  for (auto&& ifd : ifds_) {
  ------------------
  |  Branch (672:19): [True: 784k, False: 163k]
  ------------------
  673|   784k|    if (!visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (673:9): [True: 40.1k, False: 744k]
  ------------------
  674|  40.1k|      break;
  675|   744k|    ifd->accept(visitor);
  676|   744k|  }
  677|   204k|}  // TiffSubIfd::doAccept
_ZN5Exiv28Internal11TiffMnEntry8doAcceptERNS0_11TiffVisitorE:
  679|   189k|void TiffMnEntry::doAccept(TiffVisitor& visitor) {
  680|   189k|  visitor.visitMnEntry(this);
  681|   189k|  if (mn_)
  ------------------
  |  Branch (681:7): [True: 62.0k, False: 127k]
  ------------------
  682|  62.0k|    mn_->accept(visitor);
  683|   189k|  if (!visitor.go(TiffVisitor::geKnownMakernote)) {
  ------------------
  |  Branch (683:7): [True: 1.49k, False: 188k]
  ------------------
  684|  1.49k|    mn_ = nullptr;
  685|  1.49k|  }
  686|       |
  687|   189k|}  // TiffMnEntry::doAccept
_ZN5Exiv28Internal16TiffIfdMakernote8doAcceptERNS0_11TiffVisitorE:
  689|  57.0k|void TiffIfdMakernote::doAccept(TiffVisitor& visitor) {
  690|  57.0k|  if (visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (690:7): [True: 57.0k, False: 0]
  ------------------
  691|  57.0k|    visitor.visitIfdMakernote(this);
  692|  57.0k|  if (visitor.go(TiffVisitor::geKnownMakernote))
  ------------------
  |  Branch (692:7): [True: 56.1k, False: 853]
  ------------------
  693|  56.1k|    ifd_.accept(visitor);
  694|  57.0k|  if (visitor.go(TiffVisitor::geKnownMakernote) && visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (694:7): [True: 56.1k, False: 853]
  |  Branch (694:52): [True: 43.0k, False: 13.0k]
  ------------------
  695|  43.0k|    visitor.visitIfdMakernoteEnd(this);
  696|  57.0k|}
_ZN5Exiv28Internal15TiffBinaryArray8doAcceptERNS0_11TiffVisitorE:
  698|   121k|void TiffBinaryArray::doAccept(TiffVisitor& visitor) {
  699|   121k|  visitor.visitBinaryArray(this);
  700|  12.0M|  for (auto&& element : elements_) {
  ------------------
  |  Branch (700:23): [True: 12.0M, False: 120k]
  ------------------
  701|  12.0M|    if (!visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (701:9): [True: 469, False: 12.0M]
  ------------------
  702|    469|      break;
  703|  12.0M|    element->accept(visitor);
  704|  12.0M|  }
  705|   121k|  if (visitor.go(TiffVisitor::geTraverse))
  ------------------
  |  Branch (705:7): [True: 112k, False: 9.40k]
  ------------------
  706|   112k|    visitor.visitBinaryArrayEnd(this);
  707|   121k|}
_ZN5Exiv28Internal17TiffBinaryElement8doAcceptERNS0_11TiffVisitorE:
  709|  12.3M|void TiffBinaryElement::doAccept(TiffVisitor& visitor) {
  710|  12.3M|  visitor.visitBinaryElement(this);
  711|  12.3M|}
_ZN5Exiv28Internal13TiffEntryBase6encodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  713|  2.37M|void TiffEntryBase::encode(TiffEncoder& encoder, const Exifdatum* datum) {
  714|  2.37M|  doEncode(encoder, datum);
  715|  2.37M|}
_ZN5Exiv28Internal17TiffBinaryElement8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  717|  1.25M|void TiffBinaryElement::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  718|  1.25M|  encoder.encodeBinaryElement(this, datum);
  719|  1.25M|}
_ZN5Exiv28Internal15TiffBinaryArray8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  721|  12.2k|void TiffBinaryArray::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  722|  12.2k|  encoder.encodeBinaryArray(this, datum);
  723|  12.2k|}
_ZN5Exiv28Internal13TiffDataEntry8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  725|  6.19k|void TiffDataEntry::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  726|  6.19k|  encoder.encodeDataEntry(this, datum);
  727|  6.19k|}
_ZN5Exiv28Internal9TiffEntry8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  729|  1.06M|void TiffEntry::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  730|  1.06M|  encoder.encodeTiffEntry(this, datum);
  731|  1.06M|}
_ZN5Exiv28Internal14TiffImageEntry8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  733|  11.0k|void TiffImageEntry::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  734|  11.0k|  encoder.encodeImageEntry(this, datum);
  735|  11.0k|}
_ZN5Exiv28Internal11TiffMnEntry8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  737|  10.1k|void TiffMnEntry::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  738|  10.1k|  encoder.encodeMnEntry(this, datum);
  739|  10.1k|}
_ZN5Exiv28Internal13TiffSizeEntry8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  741|  15.9k|void TiffSizeEntry::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  742|  15.9k|  encoder.encodeSizeEntry(this, datum);
  743|  15.9k|}
_ZN5Exiv28Internal10TiffSubIfd8doEncodeERNS0_11TiffEncoderEPKNS_9ExifdatumE:
  745|  1.25k|void TiffSubIfd::doEncode(TiffEncoder& encoder, const Exifdatum* datum) {
  746|  1.25k|  encoder.encodeSubIfd(this, datum);
  747|  1.25k|}
_ZNK5Exiv28Internal13TiffComponent5countEv:
  749|  1.35M|size_t TiffComponent::count() const {
  750|  1.35M|  return doCount();
  751|  1.35M|}
_ZNK5Exiv28Internal13TiffDirectory7doCountEv:
  753|   121k|size_t TiffDirectory::doCount() const {
  754|   121k|  return components_.size();
  755|   121k|}
_ZNK5Exiv28Internal13TiffEntryBase7doCountEv:
  757|  1.21M|size_t TiffEntryBase::doCount() const {
  758|  1.21M|  return count_;
  759|  1.21M|}
_ZNK5Exiv28Internal11TiffMnEntry7doCountEv:
  761|  14.1k|size_t TiffMnEntry::doCount() const {
  762|  14.1k|  if (!mn_) {
  ------------------
  |  Branch (762:7): [True: 8.09k, False: 6.10k]
  ------------------
  763|  8.09k|    return TiffEntryBase::doCount();
  764|  8.09k|  }
  765|  6.10k|#ifndef SUPPRESS_WARNINGS
  766|       |  // Count of IFD makernote in tag Exif.Photo.MakerNote is the size of the
  767|       |  // Makernote in bytes
  768|  6.10k|  if (tiffType() != ttUndefined && tiffType() != ttUnsignedByte && tiffType() != ttSignedByte) {
  ------------------
  |  Branch (768:7): [True: 1.11k, False: 4.98k]
  |  Branch (768:36): [True: 1.04k, False: 70]
  |  Branch (768:68): [True: 998, False: 50]
  ------------------
  769|    998|    EXV_ERROR << stringFormat(
  ------------------
  |  |  142|    998|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 998]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    998|  LogMsg(LogMsg::error).os()
  ------------------
                  EXV_ERROR << stringFormat(
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  770|      0|        "Makernote entry 0x{:04x} has incorrect Exif (TIFF) type {}. (Expected signed or unsigned byte.)\n", tag(),
  771|      0|        static_cast<uint16_t>(tiffType()));
  772|    998|  }
  773|  6.10k|#endif
  774|  6.10k|  return mn_->size();
  775|  14.1k|}
_ZNK5Exiv28Internal15TiffBinaryArray7doCountEv:
  781|  17.3k|size_t TiffBinaryArray::doCount() const {
  782|  17.3k|  if (!cfg() || !decoded())
  ------------------
  |  Branch (782:7): [True: 1.84k, False: 15.5k]
  |  Branch (782:17): [True: 10.3k, False: 5.25k]
  ------------------
  783|  12.1k|    return TiffEntryBase::doCount();
  784|       |
  785|  5.25k|  if (elements_.empty())
  ------------------
  |  Branch (785:7): [True: 0, False: 5.25k]
  ------------------
  786|      0|    return 0;
  787|       |
  788|  5.25k|  TypeId typeId = toTypeId(tiffType(), tag(), group());
  789|  5.25k|  size_t typeSize = TypeInfo::typeSize(typeId);
  790|  5.25k|  if (0 == typeSize) {
  ------------------
  |  Branch (790:7): [True: 41, False: 5.21k]
  ------------------
  791|     41|#ifndef SUPPRESS_WARNINGS
  792|     41|    EXV_WARNING << stringFormat("Directory {}, entry 0x{:04x} has unknown Exif (TIFF) type {}; setting type size 1.\n",
  ------------------
  |  |  138|     41|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 41]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     41|  LogMsg(LogMsg::warn).os()
  ------------------
                  EXV_WARNING << stringFormat("Directory {}, entry 0x{:04x} has unknown Exif (TIFF) type {}; setting type size 1.\n",
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
  793|      0|                                groupName(group()), tag(), static_cast<uint16_t>(tiffType()));
  794|     41|#endif
  795|     41|    typeSize = 1;
  796|     41|  }
  797|       |
  798|  5.25k|  return size() / typeSize;
  799|  5.25k|}
_ZNK5Exiv28Internal17TiffBinaryElement7doCountEv:
  801|    845|size_t TiffBinaryElement::doCount() const {
  802|    845|  return elDef_.count_;
  803|    845|}
_ZN5Exiv28Internal13TiffComponent5writeERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
  806|  2.40M|                            size_t& imageIdx) {
  807|  2.40M|  return doWrite(ioWrapper, byteOrder, offset, valueIdx, dataIdx, imageIdx);
  808|  2.40M|}  // TiffComponent::write
_ZN5Exiv28Internal13TiffDirectory7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
  811|  26.4k|                              size_t& imageIdx) {
  812|  26.4k|  bool isRootDir = (imageIdx == std::string::npos);
  813|       |
  814|       |  // Number of components to write
  815|  26.4k|  const size_t compCount = count();
  816|  26.4k|  if (compCount > 0xffff)
  ------------------
  |  Branch (816:7): [True: 0, False: 26.4k]
  ------------------
  817|      0|    throw Error(ErrorCode::kerTooManyTiffDirectoryEntries, groupName(group()));
  818|       |
  819|       |  // Size of next IFD, if any
  820|  26.4k|  size_t sizeNext = 0;
  821|  26.4k|  if (pNext_)
  ------------------
  |  Branch (821:7): [True: 701, False: 25.7k]
  ------------------
  822|    701|    sizeNext = pNext_->size();
  823|       |
  824|       |  // Nothing to do if there are no entries and the size of the next IFD is 0
  825|  26.4k|  if (compCount == 0 && sizeNext == 0)
  ------------------
  |  Branch (825:7): [True: 478, False: 25.9k]
  |  Branch (825:25): [True: 152, False: 326]
  ------------------
  826|    152|    return 0;
  827|       |
  828|       |  // Remember the offset of the CR2 RAW IFD
  829|  26.2k|  if (group() == IfdId::ifd3Id) {
  ------------------
  |  Branch (829:7): [True: 37, False: 26.2k]
  ------------------
  830|       |#ifdef EXIV2_DEBUG_MESSAGES
  831|       |    std::cerr << "Directory " << groupName(group()) << " offset is 0x" << std::setw(8) << std::setfill('0') << std::hex
  832|       |              << offset << std::dec << "\n";
  833|       |#endif
  834|     37|    ioWrapper.setTarget(OffsetWriter::cr2RawIfdOffset, offset);
  835|     37|  }
  836|       |  // Size of all directory entries, without values and additional data
  837|  26.2k|  const size_t sizeDir = 2 + (12 * compCount) + (hasNext_ ? 4 : 0);
  ------------------
  |  Branch (837:50): [True: 26.1k, False: 133]
  ------------------
  838|       |
  839|       |  // TIFF standard requires IFD entries to be sorted in ascending order by tag.
  840|       |  // Not sorting makernote directories sometimes preserves them better.
  841|  26.2k|  if (group() < IfdId::mnId) {
  ------------------
  |  Branch (841:7): [True: 19.5k, False: 6.75k]
  ------------------
  842|  19.5k|    std::sort(components_.begin(), components_.end(), cmpTagLt);
  843|  19.5k|  }
  844|       |  // Size of IFD values and additional data
  845|  26.2k|  size_t sizeValue = 0;
  846|  26.2k|  size_t sizeData = 0;
  847|  1.13M|  for (auto&& component : components_) {
  ------------------
  |  Branch (847:25): [True: 1.13M, False: 26.2k]
  ------------------
  848|  1.13M|    if (size_t sv = component->size(); sv > 4) {
  ------------------
  |  Branch (848:40): [True: 65.0k, False: 1.06M]
  ------------------
  849|  65.0k|      sv += sv & 1;  // Align value to word boundary
  850|  65.0k|      sizeValue += sv;
  851|  65.0k|    }
  852|       |    // Also add the size of data, but only if needed
  853|  1.13M|    if (isRootDir) {
  ------------------
  |  Branch (853:9): [True: 543k, False: 590k]
  ------------------
  854|   543k|      auto sd = component->sizeData();
  855|   543k|      sd += sd & 1;  // Align data to word boundary
  856|   543k|      sizeData += sd;
  857|   543k|    }
  858|  1.13M|  }
  859|       |
  860|  26.2k|  size_t idx = 0;                 // Current IFD index / bytes written
  861|  26.2k|  valueIdx = sizeDir;             // Offset to the current IFD value
  862|  26.2k|  dataIdx = sizeDir + sizeValue;  // Offset to the entry's data area
  863|  26.2k|  if (isRootDir) {                // Absolute offset to the image data
  ------------------
  |  Branch (863:7): [True: 10.6k, False: 15.6k]
  ------------------
  864|  10.6k|    imageIdx = offset + dataIdx + sizeData + sizeNext;
  865|  10.6k|    imageIdx += imageIdx & 1;  // Align image data to word boundary
  866|  10.6k|  }
  867|       |
  868|       |  // 1st: Write the IFD, a) Number of directory entries
  869|  26.2k|  byte buf[4];
  870|  26.2k|  us2Data(buf, static_cast<uint16_t>(compCount), byteOrder);
  871|  26.2k|  ioWrapper.write(buf, 2);
  872|  26.2k|  idx += 2;
  873|       |  // b) Directory entries - may contain pointers to the value or data
  874|  1.13M|  for (auto&& component : components_) {
  ------------------
  |  Branch (874:25): [True: 1.13M, False: 26.2k]
  ------------------
  875|  1.13M|    idx += writeDirEntry(ioWrapper, byteOrder, offset, component.get(), valueIdx, dataIdx, imageIdx);
  876|  1.13M|    if (size_t sv = component->size(); sv > 4) {
  ------------------
  |  Branch (876:40): [True: 64.4k, False: 1.06M]
  ------------------
  877|  64.4k|      sv += sv & 1;  // Align value to word boundary
  878|  64.4k|      valueIdx += sv;
  879|  64.4k|    }
  880|  1.13M|    auto sd = component->sizeData();
  881|  1.13M|    sd += sd & 1;  // Align data to word boundary
  882|  1.13M|    dataIdx += sd;
  883|  1.13M|  }
  884|       |  // c) Pointer to the next IFD
  885|  26.2k|  if (hasNext_) {
  ------------------
  |  Branch (885:7): [True: 25.9k, False: 283]
  ------------------
  886|  25.9k|    memset(buf, 0x0, 4);
  887|  25.9k|    if (pNext_ && sizeNext) {
  ------------------
  |  Branch (887:9): [True: 700, False: 25.2k]
  |  Branch (887:19): [True: 699, False: 1]
  ------------------
  888|    699|      l2Data(buf, static_cast<uint32_t>(offset + dataIdx), byteOrder);
  889|    699|    }
  890|  25.9k|    ioWrapper.write(buf, 4);
  891|  25.9k|    idx += 4;
  892|  25.9k|  }
  893|       |
  894|       |  // 2nd: Write IFD values - may contain pointers to additional data
  895|  26.2k|  valueIdx = sizeDir;
  896|  26.2k|  dataIdx = sizeDir + sizeValue;
  897|  1.12M|  for (auto&& component : components_) {
  ------------------
  |  Branch (897:25): [True: 1.12M, False: 26.2k]
  ------------------
  898|  1.12M|    if (size_t sv = component->size(); sv > 4) {
  ------------------
  |  Branch (898:40): [True: 63.1k, False: 1.05M]
  ------------------
  899|  63.1k|      size_t d = component->write(ioWrapper, byteOrder, offset, valueIdx, dataIdx, imageIdx);
  900|  63.1k|      enforce(sv == d, ErrorCode::kerImageWriteFailed);
  901|  63.1k|      if ((sv & 1) == 1) {
  ------------------
  |  Branch (901:11): [True: 11.4k, False: 51.7k]
  ------------------
  902|  11.4k|        ioWrapper.putb(0x0);  // Align value to word boundary
  903|  11.4k|        sv += 1;
  904|  11.4k|      }
  905|  63.1k|      idx += sv;
  906|  63.1k|      valueIdx += sv;
  907|  63.1k|    }
  908|  1.12M|    auto sd = component->sizeData();
  909|  1.12M|    sd += sd & 1;  // Align data to word boundary
  910|  1.12M|    dataIdx += sd;
  911|  1.12M|  }
  912|       |
  913|       |  // 3rd: Write data - may contain offsets too (eg sub-IFD)
  914|  26.2k|  dataIdx = sizeDir + sizeValue;
  915|  26.2k|  idx += writeData(ioWrapper, byteOrder, offset, dataIdx, imageIdx);
  916|       |
  917|       |  // 4th: Write next-IFD
  918|  26.2k|  if (pNext_ && sizeNext) {
  ------------------
  |  Branch (918:7): [True: 691, False: 25.5k]
  |  Branch (918:17): [True: 690, False: 1]
  ------------------
  919|    690|    idx += pNext_->write(ioWrapper, byteOrder, offset + idx, std::string::npos, std::string::npos, imageIdx);
  920|    690|  }
  921|       |
  922|       |  // 5th, at the root directory level only: write image data
  923|  26.2k|  if (isRootDir) {
  ------------------
  |  Branch (923:7): [True: 10.2k, False: 16.0k]
  ------------------
  924|  10.2k|    idx += writeImage(ioWrapper, byteOrder);
  925|  10.2k|  }
  926|       |
  927|  26.2k|  return idx;
  928|  26.4k|}
_ZN5Exiv28Internal13TiffDirectory13writeDirEntryERNS0_9IoWrapperENS_9ByteOrderEmPNS0_13TiffComponentEmmRm:
  931|  1.13M|                                    TiffComponent* pTiffComponent, size_t valueIdx, size_t dataIdx, size_t& imageIdx) {
  932|  1.13M|  auto pDirEntry = dynamic_cast<TiffEntryBase*>(pTiffComponent);
  933|  1.13M|  if (!pDirEntry)
  ------------------
  |  Branch (933:7): [True: 0, False: 1.13M]
  ------------------
  934|      0|    return 0;
  935|  1.13M|  byte buf[8];
  936|  1.13M|  us2Data(buf, pDirEntry->tag(), byteOrder);
  937|  1.13M|  us2Data(buf + 2, pDirEntry->tiffType(), byteOrder);
  938|  1.13M|  ul2Data(buf + 4, static_cast<uint32_t>(pDirEntry->count()), byteOrder);
  939|  1.13M|  ioWrapper.write(buf, 8);
  940|  1.13M|  if (pDirEntry->size() > 4) {
  ------------------
  |  Branch (940:7): [True: 64.4k, False: 1.06M]
  ------------------
  941|  64.4k|    pDirEntry->setOffset(Safe::add<size_t>(offset, valueIdx));
  942|  64.4k|    ul2Data(buf, static_cast<uint32_t>(pDirEntry->offset()), byteOrder);
  943|  64.4k|    ioWrapper.write(buf, 4);
  944|  1.06M|  } else {
  945|  1.06M|    const size_t len = pDirEntry->write(ioWrapper, byteOrder, offset, valueIdx, dataIdx, imageIdx);
  946|  1.06M|#ifndef SUPPRESS_WARNINGS
  947|  1.06M|    if (len > 4) {
  ------------------
  |  Branch (947:9): [True: 95, False: 1.06M]
  ------------------
  948|     95|      EXV_ERROR << "Unexpected length in TiffDirectory::writeDirEntry(): len == " << len << ".\n";
  ------------------
  |  |  142|     95|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 95]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|     95|  LogMsg(LogMsg::error).os()
  ------------------
  949|     95|    }
  950|  1.06M|#endif
  951|  1.06M|    if (len < 4) {
  ------------------
  |  Branch (951:9): [True: 1.05M, False: 14.6k]
  ------------------
  952|  1.05M|      memset(buf, 0x0, 4);
  953|  1.05M|      ioWrapper.write(buf, 4 - len);
  954|  1.05M|    }
  955|  1.06M|  }
  956|  1.13M|  return 12;
  957|  1.13M|}  // TiffDirectory::writeDirEntry
_ZN5Exiv28Internal13TiffEntryBase7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
  960|  1.09M|                              size_t /*dataIdx*/, size_t& /*imageIdx*/) {
  961|  1.09M|  if (!pValue_ || pValue_->size() == 0)
  ------------------
  |  Branch (961:7): [True: 13.0k, False: 1.08M]
  |  Branch (961:19): [True: 1.00M, False: 75.5k]
  ------------------
  962|  1.02M|    return 0;
  963|       |
  964|  75.5k|  DataBuf buf(pValue_->size());
  965|  75.5k|  pValue_->copy(buf.data(), byteOrder);
  966|  75.5k|  ioWrapper.write(buf.c_data(), buf.size());
  967|  75.5k|  return buf.size();
  968|  1.09M|}  // TiffEntryBase::doWrite
_ZN5Exiv28Internal13TiffEntryBase11writeOffsetEPhmNS0_8TiffTypeENS_9ByteOrderE:
  970|  42.6k|size_t TiffEntryBase::writeOffset(byte* buf, size_t offset, TiffType tiffType, ByteOrder byteOrder) {
  971|  42.6k|  size_t rc = 0;
  972|  42.6k|  switch (tiffType) {
  973|  2.05k|    case ttUnsignedShort:
  ------------------
  |  Branch (973:5): [True: 2.05k, False: 40.6k]
  ------------------
  974|  4.61k|    case ttSignedShort:
  ------------------
  |  Branch (974:5): [True: 2.55k, False: 40.1k]
  ------------------
  975|  4.61k|      if (offset > std::numeric_limits<uint16_t>::max())
  ------------------
  |  Branch (975:11): [True: 19, False: 4.59k]
  ------------------
  976|     19|        throw Error(ErrorCode::kerOffsetOutOfRange);
  977|  4.59k|      rc = us2Data(buf, static_cast<uint16_t>(offset), byteOrder);
  978|  4.59k|      break;
  979|  36.3k|    case ttUnsignedLong:
  ------------------
  |  Branch (979:5): [True: 36.3k, False: 6.30k]
  ------------------
  980|  37.7k|    case ttSignedLong:
  ------------------
  |  Branch (980:5): [True: 1.40k, False: 41.2k]
  ------------------
  981|  37.7k|      if (offset > std::numeric_limits<uint32_t>::max())
  ------------------
  |  Branch (981:11): [True: 6, False: 37.7k]
  ------------------
  982|      6|        throw Error(ErrorCode::kerOffsetOutOfRange);
  983|  37.7k|      rc = l2Data(buf, static_cast<uint32_t>(offset), byteOrder);
  984|  37.7k|      break;
  985|    279|    default:
  ------------------
  |  Branch (985:5): [True: 279, False: 42.3k]
  ------------------
  986|    279|      throw Error(ErrorCode::kerUnsupportedDataAreaOffsetType);
  987|  42.6k|  }
  988|  42.3k|  return rc;
  989|  42.6k|}  // TiffEntryBase::writeOffset
_ZN5Exiv28Internal13TiffDataEntry7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
  992|  3.89k|                              size_t dataIdx, size_t& /*imageIdx*/) {
  993|  3.89k|  if (!pValue() || pValue()->count() == 0)
  ------------------
  |  Branch (993:7): [True: 86, False: 3.80k]
  |  Branch (993:20): [True: 2.26k, False: 1.54k]
  ------------------
  994|  2.35k|    return 0;
  995|       |
  996|  1.54k|  DataBuf buf(pValue()->size());
  997|  1.54k|  size_t idx = 0;
  998|  1.54k|  const size_t prevOffset = pValue()->toUint32(0);
  999|  4.13k|  for (size_t i = 0; i < count(); ++i) {
  ------------------
  |  Branch (999:22): [True: 2.59k, False: 1.54k]
  ------------------
 1000|  2.59k|    const size_t iOffset = pValue()->toUint32(i);
 1001|  2.59k|    enforce(prevOffset <= iOffset, ErrorCode::kerOffsetOutOfRange);
 1002|  2.59k|    const auto newDataIdx = Safe::add<size_t>(iOffset - prevOffset, dataIdx);
 1003|  2.59k|    idx += writeOffset(buf.data(idx), Safe::add(offset, newDataIdx), tiffType(), byteOrder);
 1004|  2.59k|  }
 1005|  1.54k|  ioWrapper.write(buf.c_data(), buf.size());
 1006|  1.54k|  return buf.size();
 1007|  3.89k|}
_ZN5Exiv28Internal14TiffImageEntry7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1010|  11.0k|                               size_t dataIdx, size_t& imageIdx) {
 1011|  11.0k|  size_t o2 = imageIdx;
 1012|       |  // For makernotes, write TIFF image data to the data area
 1013|  11.0k|  if (group() > IfdId::mnId)
  ------------------
  |  Branch (1013:7): [True: 471, False: 10.6k]
  ------------------
 1014|    471|    o2 = Safe::add<size_t>(offset, dataIdx);
 1015|       |#ifdef EXIV2_DEBUG_MESSAGES
 1016|       |  std::cerr << "TiffImageEntry, Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
 1017|       |            << std::hex << tag() << std::dec << ": Writing offset " << o2 << "\n";
 1018|       |#endif
 1019|  11.0k|  DataBuf buf(strips_.size() * 4);
 1020|  11.0k|  size_t idx = 0;
 1021|  30.8k|  for (const auto& [_, off] : strips_) {
  ------------------
  |  Branch (1021:29): [True: 30.8k, False: 11.0k]
  ------------------
 1022|  30.8k|    idx += writeOffset(buf.data(idx), o2, tiffType(), byteOrder);
 1023|       |    // Align strip data to word boundary
 1024|  30.8k|    const auto sz = Safe::add(off, off & 1);
 1025|  30.8k|    o2 = Safe::add(o2, sz);
 1026|  30.8k|    if (group() <= IfdId::mnId)
  ------------------
  |  Branch (1026:9): [True: 30.2k, False: 599]
  ------------------
 1027|  30.2k|      imageIdx = Safe::add(imageIdx, sz);
 1028|  30.8k|  }
 1029|  11.0k|  ioWrapper.write(buf.c_data(), buf.size());
 1030|  11.0k|  return buf.size();
 1031|  11.0k|}  // TiffImageEntry::doWrite
_ZN5Exiv28Internal10TiffSubIfd7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1034|  7.02k|                           size_t dataIdx, size_t& /*imageIdx*/) {
 1035|  7.02k|  DataBuf buf(ifds_.size() * 4);
 1036|  7.02k|  size_t idx = 0;
 1037|       |  // Sort IFDs by group, needed if image data tags were copied first
 1038|  7.02k|  std::sort(ifds_.begin(), ifds_.end(), [](const auto& lhs, const auto& rhs) { return lhs->group() < rhs->group(); });
 1039|  9.20k|  for (auto&& ifd : ifds_) {
  ------------------
  |  Branch (1039:19): [True: 9.20k, False: 7.02k]
  ------------------
 1040|  9.20k|    idx += writeOffset(buf.data(idx), offset + dataIdx, tiffType(), byteOrder);
 1041|  9.20k|    dataIdx += ifd->size();
 1042|  9.20k|  }
 1043|  7.02k|  ioWrapper.write(buf.c_data(), buf.size());
 1044|  7.02k|  return buf.size();
 1045|  7.02k|}  // TiffSubIfd::doWrite
_ZN5Exiv28Internal11TiffMnEntry7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1048|  13.8k|                            size_t& imageIdx) {
 1049|  13.8k|  if (!mn_) {
  ------------------
  |  Branch (1049:7): [True: 7.95k, False: 5.90k]
  ------------------
 1050|  7.95k|    return TiffEntryBase::doWrite(ioWrapper, byteOrder, offset, valueIdx, dataIdx, imageIdx);
 1051|  7.95k|  }
 1052|  5.90k|  return mn_->write(ioWrapper, byteOrder, offset + valueIdx, std::string::npos, std::string::npos, imageIdx);
 1053|  13.8k|}  // TiffMnEntry::doWrite
_ZN5Exiv28Internal16TiffIfdMakernote7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1056|  5.90k|                                 size_t /*dataIdx*/, size_t& imageIdx) {
 1057|  5.90k|  mnOffset_ = offset;
 1058|  5.90k|  setImageByteOrder(byteOrder);
 1059|  5.90k|  auto len = writeHeader(ioWrapper, this->byteOrder());
 1060|  5.90k|  len += ifd_.write(ioWrapper, this->byteOrder(), offset - baseOffset() + len, std::string::npos, std::string::npos,
 1061|  5.90k|                    imageIdx);
 1062|  5.90k|  return len;
 1063|  5.90k|}  // TiffIfdMakernote::doWrite
_ZN5Exiv28Internal15TiffBinaryArray7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1066|  17.2k|                                size_t dataIdx, size_t& imageIdx) {
 1067|  17.2k|  if (!cfg() || !decoded())
  ------------------
  |  Branch (1067:7): [True: 1.78k, False: 15.4k]
  |  Branch (1067:17): [True: 10.2k, False: 5.18k]
  ------------------
 1068|  12.0k|    return TiffEntryBase::doWrite(ioWrapper, byteOrder, offset, valueIdx, dataIdx, imageIdx);
 1069|  5.18k|  if (cfg()->byteOrder_ != invalidByteOrder)
  ------------------
  |  Branch (1069:7): [True: 711, False: 4.47k]
  ------------------
 1070|    711|    byteOrder = cfg()->byteOrder_;
 1071|       |  // Tags must be sorted in ascending order
 1072|  5.18k|  std::sort(elements_.begin(), elements_.end(), cmpTagLt);
 1073|  5.18k|  size_t idx = 0;
 1074|  5.18k|  MemIo mio;  // memory stream in which to store data
 1075|  5.18k|  IoWrapper mioWrapper(mio, nullptr, 0, nullptr);
 1076|       |  // Some array entries need to have the size in the first element
 1077|  5.18k|  if (cfg()->hasSize_) {
  ------------------
  |  Branch (1077:7): [True: 451, False: 4.73k]
  ------------------
 1078|    451|    byte buf[4];
 1079|    451|    size_t elSize = TypeInfo::typeSize(toTypeId(cfg()->elTiffType_, 0, cfg()->group_));
 1080|    451|    switch (elSize) {
 1081|    131|      case 2:
  ------------------
  |  Branch (1081:7): [True: 131, False: 320]
  ------------------
 1082|    131|        idx += us2Data(buf, static_cast<uint16_t>(size()), byteOrder);
 1083|    131|        break;
 1084|    320|      case 4:
  ------------------
  |  Branch (1084:7): [True: 320, False: 131]
  ------------------
 1085|    320|        idx += ul2Data(buf, static_cast<uint32_t>(size()), byteOrder);
 1086|    320|        break;
 1087|      0|      default:
  ------------------
  |  Branch (1087:7): [True: 0, False: 451]
  ------------------
 1088|      0|        break;
 1089|    451|    }
 1090|    451|    mioWrapper.write(buf, elSize);
 1091|    451|  }
 1092|       |  // write all tags of the array (Todo: assumes that there are no duplicates, need check)
 1093|  1.24M|  for (auto&& element : elements_) {
  ------------------
  |  Branch (1093:23): [True: 1.24M, False: 5.18k]
  ------------------
 1094|       |    // Skip the manufactured tag, if it exists
 1095|  1.24M|    if (cfg()->hasSize_ && element->tag() == 0)
  ------------------
  |  Branch (1095:9): [True: 29.7k, False: 1.21M]
  |  Branch (1095:28): [True: 451, False: 29.2k]
  ------------------
 1096|    451|      continue;
 1097|  1.24M|    size_t newIdx = element->tag() * cfg()->tagStep();
 1098|  1.24M|    idx += fillGap(mioWrapper, idx, newIdx);
 1099|  1.24M|    idx += element->write(mioWrapper, byteOrder, offset + newIdx, valueIdx, dataIdx, imageIdx);
 1100|  1.24M|  }
 1101|  5.18k|  if (cfg()->hasFillers_ && def()) {
  ------------------
  |  Branch (1101:7): [True: 4.05k, False: 1.13k]
  |  Branch (1101:29): [True: 4.05k, False: 0]
  ------------------
 1102|  4.05k|    const ArrayDef* lastDef = def() + defSize() - 1;
 1103|  4.05k|    auto lastTag = static_cast<uint16_t>(lastDef->idx_ / cfg()->tagStep());
 1104|  4.05k|    idx += fillGap(mioWrapper, idx, lastDef->idx_ + lastDef->size(lastTag, cfg()->group_));
 1105|  4.05k|  }
 1106|       |
 1107|  5.18k|  if (cfg()->cryptFct_) {
  ------------------
  |  Branch (1107:7): [True: 209, False: 4.97k]
  ------------------
 1108|       |    // Select sonyTagEncipher
 1109|    209|    CryptFct cryptFct = cfg()->cryptFct_;
 1110|    209|    if (cryptFct == &sonyTagDecipher) {
  ------------------
  |  Branch (1110:9): [True: 94, False: 115]
  ------------------
 1111|     94|      cryptFct = sonyTagEncipher;
 1112|     94|    }
 1113|    209|    DataBuf buf = cryptFct(tag(), mio.mmap(), mio.size(), pRoot_);
 1114|    209|    if (!buf.empty()) {
  ------------------
  |  Branch (1114:9): [True: 117, False: 92]
  ------------------
 1115|    117|      mio.seek(0, Exiv2::BasicIo::beg);
 1116|    117|      mio.write(buf.c_data(), buf.size());
 1117|    117|    }
 1118|    209|  }
 1119|  5.18k|  ioWrapper.write(mio.mmap(), mio.size());
 1120|       |
 1121|  5.18k|  return idx;
 1122|  5.18k|}  // TiffBinaryArray::doWrite
_ZN5Exiv28Internal17TiffBinaryElement7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRm:
 1125|  1.24M|                                  size_t /*dataIdx*/, size_t& /*imageIdx*/) {
 1126|  1.24M|  auto pv = pValue();
 1127|  1.24M|  if (!pv || pv->count() == 0)
  ------------------
  |  Branch (1127:7): [True: 0, False: 1.24M]
  |  Branch (1127:14): [True: 559k, False: 688k]
  ------------------
 1128|   559k|    return 0;
 1129|   688k|  DataBuf buf(pv->size());
 1130|   688k|  pv->copy(buf.data(), byteOrder);
 1131|   688k|  ioWrapper.write(buf.c_data(), buf.size());
 1132|   688k|  return buf.size();
 1133|  1.24M|}  // TiffBinaryElement::doWrite
_ZNK5Exiv28Internal13TiffComponent9writeDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1136|  1.14M|                                size_t& imageIdx) const {
 1137|  1.14M|  return doWriteData(ioWrapper, byteOrder, offset, dataIdx, imageIdx);
 1138|  1.14M|}  // TiffComponent::writeData
_ZNK5Exiv28Internal13TiffDirectory11doWriteDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1141|  25.8k|                                  size_t& imageIdx) const {
 1142|  25.8k|  size_t len = 0;
 1143|  1.11M|  for (auto&& component : components_) {
  ------------------
  |  Branch (1143:25): [True: 1.11M, False: 25.8k]
  ------------------
 1144|  1.11M|    len += component->writeData(ioWrapper, byteOrder, offset, dataIdx + len, imageIdx);
 1145|  1.11M|  }
 1146|  25.8k|  return len;
 1147|  25.8k|}  // TiffDirectory::doWriteData
_ZNK5Exiv28Internal13TiffEntryBase11doWriteDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1150|  1.09M|                                  size_t /*dataIdx*/, size_t& /*imageIdx*/) const {
 1151|  1.09M|  return 0;
 1152|  1.09M|}  // TiffEntryBase::doWriteData
_ZNK5Exiv28Internal14TiffImageEntry11doWriteDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1155|  10.8k|                                   size_t& /*imageIdx*/) const {
 1156|  10.8k|  size_t len = 0;
 1157|       |  // For makernotes, write TIFF image data to the data area
 1158|  10.8k|  if (group() > IfdId::mnId) {  // Todo: FIX THIS HACK!!!
  ------------------
  |  Branch (1158:7): [True: 449, False: 10.4k]
  ------------------
 1159|    449|    len = writeImage(ioWrapper, byteOrder);
 1160|    449|  }
 1161|  10.8k|  return len;
 1162|  10.8k|}  // TiffImageEntry::doWriteData
_ZNK5Exiv28Internal13TiffDataEntry11doWriteDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1165|  2.94k|                                  size_t& /*imageIdx*/) const {
 1166|  2.94k|  if (!pValue())
  ------------------
  |  Branch (1166:7): [True: 34, False: 2.90k]
  ------------------
 1167|     34|    return 0;
 1168|       |
 1169|  2.90k|  DataBuf buf = pValue()->dataArea();
 1170|  2.90k|  if (!buf.empty())
  ------------------
  |  Branch (1170:7): [True: 383, False: 2.52k]
  ------------------
 1171|    383|    ioWrapper.write(buf.c_data(), buf.size());
 1172|       |  // Align data to word boundary
 1173|  2.90k|  size_t align = (buf.size() & 1);
 1174|  2.90k|  if (align)
  ------------------
  |  Branch (1174:7): [True: 229, False: 2.68k]
  ------------------
 1175|    229|    ioWrapper.putb(0x0);
 1176|       |
 1177|  2.90k|  return buf.size() + align;
 1178|  2.94k|}  // TiffDataEntry::doWriteData
_ZNK5Exiv28Internal10TiffSubIfd11doWriteDataERNS0_9IoWrapperENS_9ByteOrderEmmRm:
 1181|  6.98k|                               size_t& imageIdx) const {
 1182|  6.98k|  size_t len = 0;
 1183|  9.08k|  for (auto&& ifd : ifds_) {
  ------------------
  |  Branch (1183:19): [True: 9.08k, False: 6.98k]
  ------------------
 1184|  9.08k|    len += ifd->write(ioWrapper, byteOrder, offset + dataIdx + len, std::string::npos, std::string::npos, imageIdx);
 1185|  9.08k|  }
 1186|       |  // Align data to word boundary
 1187|  6.98k|  size_t align = (len & 1);
 1188|  6.98k|  if (align)
  ------------------
  |  Branch (1188:7): [True: 0, False: 6.98k]
  ------------------
 1189|      0|    ioWrapper.putb(0x0);
 1190|       |
 1191|  6.98k|  return len + align;
 1192|  6.98k|}  // TiffSubIfd::doWriteData
_ZNK5Exiv28Internal13TiffComponent10writeImageERNS0_9IoWrapperENS_9ByteOrderE:
 1199|   650k|size_t TiffComponent::writeImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const {
 1200|   650k|  return doWriteImage(ioWrapper, byteOrder);
 1201|   650k|}  // TiffComponent::writeImage
_ZNK5Exiv28Internal13TiffDirectory12doWriteImageERNS0_9IoWrapperENS_9ByteOrderE:
 1203|  18.6k|size_t TiffDirectory::doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const {
 1204|  18.6k|  size_t len = 0;
 1205|  18.6k|  const TiffComponent* pSubIfd = nullptr;
 1206|   631k|  for (const auto& component : components_) {
  ------------------
  |  Branch (1206:30): [True: 631k, False: 18.6k]
  ------------------
 1207|   631k|    if (component->tag() == 0x014a) {
  ------------------
  |  Branch (1207:9): [True: 1.05k, False: 630k]
  ------------------
 1208|       |      // Hack: delay writing of sub-IFD image data to get the order correct
 1209|  1.05k|#ifndef SUPPRESS_WARNINGS
 1210|  1.05k|      if (pSubIfd) {
  ------------------
  |  Branch (1210:11): [True: 274, False: 784]
  ------------------
 1211|    274|        EXV_ERROR << "Multiple sub-IFD image data tags found\n";
  ------------------
  |  |  142|    274|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 274]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    274|  LogMsg(LogMsg::error).os()
  ------------------
 1212|    274|      }
 1213|  1.05k|#endif
 1214|  1.05k|      pSubIfd = component.get();
 1215|  1.05k|      continue;
 1216|  1.05k|    }
 1217|   630k|    len += component->writeImage(ioWrapper, byteOrder);
 1218|   630k|  }
 1219|  18.6k|  if (pSubIfd) {
  ------------------
  |  Branch (1219:7): [True: 767, False: 17.9k]
  ------------------
 1220|    767|    len += pSubIfd->writeImage(ioWrapper, byteOrder);
 1221|    767|  }
 1222|  18.6k|  if (pNext_) {
  ------------------
  |  Branch (1222:7): [True: 520, False: 18.1k]
  ------------------
 1223|    520|    len += pNext_->writeImage(ioWrapper, byteOrder);
 1224|    520|  }
 1225|  18.6k|  return len;
 1226|  18.6k|}  // TiffDirectory::doWriteImage
_ZNK5Exiv28Internal13TiffEntryBase12doWriteImageERNS0_9IoWrapperENS_9ByteOrderE:
 1228|   616k|size_t TiffEntryBase::doWriteImage(IoWrapper& /*ioWrapper*/, ByteOrder /*byteOrder*/) const {
 1229|   616k|  return 0;
 1230|   616k|}  // TiffEntryBase::doWriteImage
_ZNK5Exiv28Internal10TiffSubIfd12doWriteImageERNS0_9IoWrapperENS_9ByteOrderE:
 1232|  5.96k|size_t TiffSubIfd::doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const {
 1233|  5.96k|  return std::transform_reduce(ifds_.begin(), ifds_.end(), size_t{}, std::plus(),
 1234|  5.96k|                               [&](const auto& ifd) { return ifd->writeImage(ioWrapper, byteOrder); });
 1235|  5.96k|}  // TiffSubIfd::doWriteImage
_ZNK5Exiv28Internal14TiffImageEntry12doWriteImageERNS0_9IoWrapperENS_9ByteOrderE:
 1245|  9.09k|size_t TiffImageEntry::doWriteImage(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
 1246|  9.09k|  if (!pValue())
  ------------------
  |  Branch (1246:7): [True: 100, False: 8.99k]
  ------------------
 1247|    100|    throw Error(ErrorCode::kerImageWriteFailed);  // #1296
 1248|       |
 1249|  8.99k|  size_t len = pValue()->sizeDataArea();
 1250|  8.99k|  if (len > 0) {
  ------------------
  |  Branch (1250:7): [True: 126, False: 8.86k]
  ------------------
 1251|       |#ifdef EXIV2_DEBUG_MESSAGES
 1252|       |    std::cerr << "TiffImageEntry, Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
 1253|       |              << std::hex << tag() << std::dec << ": Writing data area, size = " << len;
 1254|       |#endif
 1255|    126|    DataBuf buf = pValue()->dataArea();
 1256|    126|    ioWrapper.write(buf.c_data(), buf.size());
 1257|    126|    size_t align = len & 1;  // Align image data to word boundary
 1258|    126|    if (align)
  ------------------
  |  Branch (1258:9): [True: 63, False: 63]
  ------------------
 1259|     63|      ioWrapper.putb(0x0);
 1260|    126|    len += align;
 1261|  8.86k|  } else {
 1262|       |#ifdef EXIV2_DEBUG_MESSAGES
 1263|       |    std::cerr << "TiffImageEntry, Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
 1264|       |              << std::hex << tag() << std::dec << ": Writing " << strips_.size() << " strips";
 1265|       |#endif
 1266|  8.86k|    len = 0;
 1267|  25.6k|    for (auto&& [f, s] : strips_) {
  ------------------
  |  Branch (1267:24): [True: 25.6k, False: 8.86k]
  ------------------
 1268|  25.6k|      ioWrapper.write(f, s);
 1269|  25.6k|      len += s;
 1270|  25.6k|      size_t align = s & 1;  // Align strip data to word boundary
 1271|  25.6k|      if (align)
  ------------------
  |  Branch (1271:11): [True: 14.1k, False: 11.4k]
  ------------------
 1272|  14.1k|        ioWrapper.putb(0x0);
 1273|  25.6k|      len += align;
 1274|  25.6k|    }
 1275|  8.86k|  }
 1276|       |#ifdef EXIV2_DEBUG_MESSAGES
 1277|       |  std::cerr << ", len = " << len << " bytes\n";
 1278|       |#endif
 1279|  8.99k|  return len;
 1280|  9.09k|}  // TiffImageEntry::doWriteImage
_ZNK5Exiv28Internal13TiffComponent4sizeEv:
 1282|  13.4M|size_t TiffComponent::size() const {
 1283|  13.4M|  return doSize();
 1284|  13.4M|}
_ZNK5Exiv28Internal13TiffDirectory6doSizeEv:
 1286|  95.2k|size_t TiffDirectory::doSize() const {
 1287|  95.2k|  size_t compCount = count();
 1288|       |  // Size of the directory, without values and additional data
 1289|  95.2k|  size_t len = 2 + (12 * compCount) + (hasNext_ ? 4 : 0);
  ------------------
  |  Branch (1289:40): [True: 94.0k, False: 1.20k]
  ------------------
 1290|       |  // Size of IFD values and data
 1291|  4.74M|  for (auto&& component : components_) {
  ------------------
  |  Branch (1291:25): [True: 4.74M, False: 95.2k]
  ------------------
 1292|  4.74M|    if (size_t sv = component->size(); sv > 4) {
  ------------------
  |  Branch (1292:40): [True: 216k, False: 4.53M]
  ------------------
 1293|   216k|      sv += sv & 1;  // Align value to word boundary
 1294|   216k|      len += sv;
 1295|   216k|    }
 1296|  4.74M|    auto sd = component->sizeData();
 1297|  4.74M|    sd += sd & 1;  // Align data to word boundary
 1298|  4.74M|    len += sd;
 1299|  4.74M|  }
 1300|       |  // Size of next-IFD, if any
 1301|  95.2k|  size_t sizeNext = 0;
 1302|  95.2k|  if (pNext_) {
  ------------------
  |  Branch (1302:7): [True: 153, False: 95.0k]
  ------------------
 1303|    153|    sizeNext = pNext_->size();
 1304|    153|    len += sizeNext;
 1305|    153|  }
 1306|       |  // Reset size of IFD if it has no entries and no or empty next IFD.
 1307|  95.2k|  if (compCount == 0 && sizeNext == 0)
  ------------------
  |  Branch (1307:7): [True: 893, False: 94.3k]
  |  Branch (1307:25): [True: 800, False: 93]
  ------------------
 1308|    800|    len = 0;
 1309|  95.2k|  return len;
 1310|  95.2k|}
_ZNK5Exiv28Internal13TiffEntryBase6doSizeEv:
 1312|  13.1M|size_t TiffEntryBase::doSize() const {
 1313|  13.1M|  return size_;
 1314|  13.1M|}
_ZNK5Exiv28Internal14TiffImageEntry6doSizeEv:
 1316|  71.1k|size_t TiffImageEntry::doSize() const {
 1317|  71.1k|  return strips_.size() * 4;
 1318|  71.1k|}
_ZNK5Exiv28Internal10TiffSubIfd6doSizeEv:
 1320|  37.0k|size_t TiffSubIfd::doSize() const {
 1321|  37.0k|  return ifds_.size() * 4;
 1322|  37.0k|}
_ZNK5Exiv28Internal11TiffMnEntry6doSizeEv:
 1324|  76.1k|size_t TiffMnEntry::doSize() const {
 1325|  76.1k|  if (!mn_) {
  ------------------
  |  Branch (1325:7): [True: 32.2k, False: 43.9k]
  ------------------
 1326|  32.2k|    return TiffEntryBase::doSize();
 1327|  32.2k|  }
 1328|  43.9k|  return mn_->size();
 1329|  76.1k|}
_ZNK5Exiv28Internal16TiffIfdMakernote6doSizeEv:
 1331|  50.0k|size_t TiffIfdMakernote::doSize() const {
 1332|  50.0k|  return sizeHeader() + ifd_.size();
 1333|  50.0k|}
_ZNK5Exiv28Internal15TiffBinaryArray6doSizeEv:
 1335|   230k|size_t TiffBinaryArray::doSize() const {
 1336|   230k|  if (!cfg() || !decoded())
  ------------------
  |  Branch (1336:7): [True: 23.4k, False: 206k]
  |  Branch (1336:17): [True: 133k, False: 73.3k]
  ------------------
 1337|   156k|    return TiffEntryBase::doSize();
 1338|       |
 1339|  73.3k|  if (elements_.empty())
  ------------------
  |  Branch (1339:7): [True: 0, False: 73.3k]
  ------------------
 1340|      0|    return 0;
 1341|       |
 1342|       |  // Remaining assumptions:
 1343|       |  // - array elements don't "overlap"
 1344|       |  // - no duplicate tags in the array
 1345|  73.3k|  size_t idx = 0;
 1346|  73.3k|  size_t sz = cfg()->tagStep();
 1347|  17.5M|  for (auto&& element : elements_) {
  ------------------
  |  Branch (1347:23): [True: 17.5M, False: 73.3k]
  ------------------
 1348|  17.5M|    if (element->tag() > idx) {
  ------------------
  |  Branch (1348:9): [True: 3.99M, False: 13.5M]
  ------------------
 1349|  3.99M|      idx = element->tag();
 1350|  3.99M|      sz = element->size();
 1351|  3.99M|    }
 1352|  17.5M|  }
 1353|  73.3k|  idx *= cfg()->tagStep();
 1354|  73.3k|  idx += sz;
 1355|       |
 1356|  73.3k|  if (cfg()->hasFillers_ && def()) {
  ------------------
  |  Branch (1356:7): [True: 56.8k, False: 16.4k]
  |  Branch (1356:29): [True: 56.8k, False: 0]
  ------------------
 1357|  56.8k|    const ArrayDef* lastDef = def() + defSize() - 1;
 1358|  56.8k|    auto lastTag = static_cast<uint16_t>(lastDef->idx_ / cfg()->tagStep());
 1359|  56.8k|    idx = std::max<size_t>(idx, lastDef->idx_ + lastDef->size(lastTag, cfg()->group_));
 1360|  56.8k|  }
 1361|  73.3k|  return idx;
 1362|       |
 1363|  73.3k|}  // TiffBinaryArray::doSize
_ZNK5Exiv28Internal17TiffBinaryElement6doSizeEv:
 1365|  3.99M|size_t TiffBinaryElement::doSize() const {
 1366|  3.99M|  if (!pValue())
  ------------------
  |  Branch (1366:7): [True: 0, False: 3.99M]
  ------------------
 1367|      0|    return 0;
 1368|  3.99M|  return pValue()->size();
 1369|  3.99M|}
_ZNK5Exiv28Internal13TiffComponent8sizeDataEv:
 1371|  7.54M|size_t TiffComponent::sizeData() const {
 1372|  7.54M|  return doSizeData();
 1373|  7.54M|}
_ZNK5Exiv28Internal13TiffEntryBase10doSizeDataEv:
 1379|  7.43M|size_t TiffEntryBase::doSizeData() const {
 1380|  7.43M|  return 0;
 1381|  7.43M|}
_ZNK5Exiv28Internal14TiffImageEntry10doSizeDataEv:
 1383|  54.0k|size_t TiffImageEntry::doSizeData() const {
 1384|  54.0k|  size_t len = 0;
 1385|       |  // For makernotes, TIFF image data is written to the data area
 1386|  54.0k|  if (group() > IfdId::mnId) {  // Todo: Fix this hack!!
  ------------------
  |  Branch (1386:7): [True: 8.97k, False: 45.0k]
  ------------------
 1387|  8.97k|    len = sizeImage();
 1388|  8.97k|  }
 1389|  54.0k|  return len;
 1390|  54.0k|}
_ZNK5Exiv28Internal13TiffDataEntry10doSizeDataEv:
 1392|  22.4k|size_t TiffDataEntry::doSizeData() const {
 1393|  22.4k|  if (!pValue())
  ------------------
  |  Branch (1393:7): [True: 258, False: 22.1k]
  ------------------
 1394|    258|    return 0;
 1395|  22.1k|  return pValue()->sizeDataArea();
 1396|  22.4k|}
_ZNK5Exiv28Internal10TiffSubIfd10doSizeDataEv:
 1398|  28.5k|size_t TiffSubIfd::doSizeData() const {
 1399|  28.5k|  return std::transform_reduce(ifds_.begin(), ifds_.end(), size_t{}, std::plus(), std::mem_fn(&TiffSubIfd::size));
 1400|  28.5k|}
_ZNK5Exiv28Internal13TiffComponent9sizeImageEv:
 1406|  8.97k|size_t TiffComponent::sizeImage() const {
 1407|  8.97k|  return doSizeImage();
 1408|  8.97k|}
_ZNK5Exiv28Internal14TiffImageEntry11doSizeImageEv:
 1428|  8.97k|size_t TiffImageEntry::doSizeImage() const {
 1429|  8.97k|  if (!pValue())
  ------------------
  |  Branch (1429:7): [True: 0, False: 8.97k]
  ------------------
 1430|      0|    return 0;
 1431|  8.97k|  auto len = pValue()->sizeDataArea();
 1432|  8.97k|  if (len != 0)
  ------------------
  |  Branch (1432:7): [True: 0, False: 8.97k]
  ------------------
 1433|      0|    return len;
 1434|       |
 1435|  8.97k|  return std::transform_reduce(strips_.begin(), strips_.end(), len, std::plus(),
 1436|  8.97k|                               [](const auto& s) { return s.second; });
 1437|  8.97k|}  // TiffImageEntry::doSizeImage
_ZN5Exiv28Internal8toTypeIdENS0_8TiffTypeEtNS_5IfdIdE:
 1454|  7.99M|TypeId toTypeId(TiffType tiffType, uint16_t tag, IfdId group) {
 1455|  7.99M|  auto ti = static_cast<TypeId>(tiffType);
 1456|       |  // On the fly type conversion for Exif.Photo.UserComment, Exif.GPSProcessingMethod, GPSAreaInformation
 1457|  7.99M|  if (const TagInfo* pTag = ti == undefined ? findTagInfo(tag, group) : nullptr) {
  ------------------
  |  Branch (1457:22): [True: 7.57k, False: 7.98M]
  ------------------
 1458|  7.57k|    if (pTag->typeId_ == comment) {
  ------------------
  |  Branch (1458:9): [True: 5.14k, False: 2.42k]
  ------------------
 1459|  5.14k|      ti = comment;
 1460|  5.14k|    }
 1461|  7.57k|  }
 1462|       |  // http://dev.exiv2.org/boards/3/topics/1337 change unsignedByte to signedByte
 1463|       |  // Exif.NikonAFT.AFFineTuneAdj || Exif.Pentax.Temperature
 1464|  7.99M|  if (ti == Exiv2::unsignedByte &&
  ------------------
  |  Branch (1464:7): [True: 4.69M, False: 3.29M]
  ------------------
 1465|  4.69M|      ((tag == 0x0002 && group == IfdId::nikonAFTId) || (tag == 0x0047 && group == IfdId::pentaxId))) {
  ------------------
  |  Branch (1465:9): [True: 4.12k, False: 4.69M]
  |  Branch (1465:26): [True: 1.05k, False: 3.06k]
  |  Branch (1465:58): [True: 2.20k, False: 4.69M]
  |  Branch (1465:75): [True: 7, False: 2.19k]
  ------------------
 1466|  1.05k|    ti = Exiv2::signedByte;
 1467|  1.05k|  }
 1468|  7.99M|  return ti;
 1469|  7.99M|}
_ZN5Exiv28Internal10toTiffTypeENS_6TypeIdE:
 1471|  4.91M|TiffType toTiffType(TypeId typeId) {
 1472|  4.91M|  if (static_cast<uint32_t>(typeId) > 0xffff) {
  ------------------
  |  Branch (1472:7): [True: 0, False: 4.91M]
  ------------------
 1473|      0|#ifndef SUPPRESS_WARNINGS
 1474|      0|    EXV_ERROR << "'" << TypeInfo::typeName(typeId) << "' is not a valid Exif (TIFF) type; using type '"
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
 1475|      0|              << TypeInfo::typeName(undefined) << "'.\n";
 1476|      0|#endif
 1477|      0|    return ttUndefined;
 1478|      0|  }
 1479|  4.91M|  return static_cast<TiffType>(typeId);
 1480|  4.91M|}
_ZN5Exiv28Internal8cmpTagLtERKNSt3__110shared_ptrINS0_13TiffComponentEEES6_:
 1482|  23.5M|bool cmpTagLt(const TiffComponent::SharedPtr& lhs, const TiffComponent::SharedPtr& rhs) {
 1483|  23.5M|  if (lhs->tag() != rhs->tag())
  ------------------
  |  Branch (1483:7): [True: 17.2M, False: 6.30M]
  ------------------
 1484|  17.2M|    return lhs->tag() < rhs->tag();
 1485|  6.30M|  return lhs->idx() < rhs->idx();
 1486|  23.5M|}
_ZN5Exiv28Internal12newTiffEntryEtNS_5IfdIdE:
 1488|  3.28M|TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group) {
 1489|  3.28M|  return std::make_unique<TiffEntry>(tag, group);
 1490|  3.28M|}
_ZN5Exiv28Internal14newTiffMnEntryEtNS_5IfdIdE:
 1492|  29.1k|TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group) {
 1493|  29.1k|  return std::make_unique<TiffMnEntry>(tag, group, IfdId::mnId);
 1494|  29.1k|}
_ZN5Exiv28Internal20newTiffBinaryElementEtNS_5IfdIdE:
 1496|  2.63M|TiffComponent::UniquePtr newTiffBinaryElement(uint16_t tag, IfdId group) {
 1497|  2.63M|  return std::make_unique<TiffBinaryElement>(tag, group);
 1498|  2.63M|}
tiffcomposite_int.cpp:_ZZN5Exiv28Internal13TiffDirectory9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEEENK3$_0clEv:
  473|  1.15M|  auto atc = [&] {
  474|  1.15M|    if (tiffPath.size() == 1 && object) {
  ------------------
  |  Branch (474:9): [True: 1.13M, False: 17.8k]
  |  Branch (474:33): [True: 31.6k, False: 1.10M]
  ------------------
  475|  31.6k|      return std::move(object);
  476|  31.6k|    }
  477|  1.12M|    return TiffCreator::create(tpi.extendedTag(), tpi.group());
  478|  1.15M|  }();
tiffcomposite_int.cpp:_ZZN5Exiv28Internal13TiffDirectory9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEEENK3$_1clEv:
  485|  1.14M|  tc = [&] {
  486|  1.14M|    if (tpi.extendedTag() == Tag::next)
  ------------------
  |  Branch (486:9): [True: 701, False: 1.14M]
  ------------------
  487|    701|      return this->addNext(std::move(atc));
  488|  1.14M|    return this->addChild(std::move(atc));
  489|  1.14M|  }();
tiffcomposite_int.cpp:_ZZN5Exiv28Internal10TiffSubIfd9doAddPathEtRNSt3__15stackINS0_12TiffPathItemENS2_5dequeIS4_NS2_9allocatorIS4_EEEEEEPNS0_13TiffComponentENS2_10unique_ptrISB_NS2_14default_deleteISB_EEEEENK3$_0clEv:
  508|  9.24k|  auto tc = [&] {
  509|  9.24k|    if (tiffPath.size() == 1 && object) {
  ------------------
  |  Branch (509:9): [True: 0, False: 9.24k]
  |  Branch (509:33): [True: 0, False: 0]
  ------------------
  510|      0|      return addChild(std::move(object));
  511|      0|    }
  512|  9.24k|    return addChild(std::make_unique<TiffDirectory>(tpi1.tag(), tpi2.group()));
  513|  9.24k|  }();
tiffcomposite_int.cpp:_ZZN5Exiv28Internal10TiffSubIfd7doWriteERNS0_9IoWrapperENS_9ByteOrderEmmmRmENK3$_0clINSt3__110shared_ptrINS0_13TiffDirectoryEEESB_EEDaRKT_RKT0_:
 1038|  2.57k|  std::sort(ifds_.begin(), ifds_.end(), [](const auto& lhs, const auto& rhs) { return lhs->group() < rhs->group(); });
tiffcomposite_int.cpp:_ZZNK5Exiv28Internal10TiffSubIfd12doWriteImageERNS0_9IoWrapperENS_9ByteOrderEENK3$_0clINSt3__110shared_ptrINS0_13TiffDirectoryEEEEEDaRKT_:
 1234|  7.91k|                               [&](const auto& ifd) { return ifd->writeImage(ioWrapper, byteOrder); });
tiffcomposite_int.cpp:_ZZNK5Exiv28Internal14TiffImageEntry11doSizeImageEvENK3$_0clINSt3__14pairIPKhmEEEEDaRKT_:
 1436|  91.1k|                               [](const auto& s) { return s.second; });
tiffcomposite_int.cpp:_ZN5Exiv28InternalL11findTagInfoEtNS_5IfdIdE:
 1439|  48.4k|static const TagInfo* findTagInfo(uint16_t tag, IfdId group) {
 1440|  48.4k|  const TagInfo* tags = [=] {
 1441|  48.4k|    if (group == IfdId::gpsId)
 1442|  48.4k|      return Internal::gpsTagList();
 1443|  48.4k|    return group == IfdId::exifId ? Internal::exifTagList() : nullptr;
 1444|  48.4k|  }();
 1445|  48.4k|  if (tags)
  ------------------
  |  Branch (1445:7): [True: 8.23k, False: 40.2k]
  ------------------
 1446|   257k|    for (size_t idx = 0; tags[idx].tag_ != 0xffff; ++idx)
  ------------------
  |  Branch (1446:26): [True: 257k, False: 662]
  ------------------
 1447|   257k|      if (tags[idx].tag_ == tag)
  ------------------
  |  Branch (1447:11): [True: 7.57k, False: 249k]
  ------------------
 1448|  7.57k|        return tags + idx;
 1449|  40.8k|  return nullptr;
 1450|  48.4k|}
tiffcomposite_int.cpp:_ZZN5Exiv28InternalL11findTagInfoEtNS_5IfdIdEENK3$_0clEv:
 1440|  48.4k|  const TagInfo* tags = [=] {
 1441|  48.4k|    if (group == IfdId::gpsId)
  ------------------
  |  Branch (1441:9): [True: 5.35k, False: 43.1k]
  ------------------
 1442|  5.35k|      return Internal::gpsTagList();
 1443|  43.1k|    return group == IfdId::exifId ? Internal::exifTagList() : nullptr;
  ------------------
  |  Branch (1443:12): [True: 2.87k, False: 40.2k]
  ------------------
 1444|  48.4k|  }();
tiffcomposite_int.cpp:_ZN12_GLOBAL__N_17fillGapERN5Exiv28Internal9IoWrapperEmm:
 1505|  1.25M|size_t fillGap(Exiv2::Internal::IoWrapper& ioWrapper, size_t curr, size_t tobe) {
 1506|  1.25M|  if (curr < tobe) {
  ------------------
  |  Branch (1506:7): [True: 187k, False: 1.06M]
  ------------------
 1507|   187k|    Exiv2::DataBuf buf(tobe - curr);
 1508|   187k|    ioWrapper.write(buf.c_data(), buf.size());
 1509|   187k|    return tobe - curr;
 1510|   187k|  }
 1511|  1.06M|  return 0;
 1512|  1.25M|}

_ZN5Exiv28Internal12TiffPathItemC2EjNS_5IfdIdE:
   74|  9.63M|  constexpr TiffPathItem(uint32_t extendedTag, IfdId group) : extendedTag_(extendedTag), group_(group) {
   75|  9.63M|  }
_ZNK5Exiv28Internal12TiffPathItem3tagEv:
   81|  34.5M|  [[nodiscard]] uint16_t tag() const {
   82|  34.5M|    return static_cast<uint16_t>(extendedTag_);
   83|  34.5M|  }
_ZNK5Exiv28Internal12TiffPathItem11extendedTagEv:
   85|  9.51M|  [[nodiscard]] uint32_t extendedTag() const {
   86|  9.51M|    return extendedTag_;
   87|  9.51M|  }
_ZNK5Exiv28Internal12TiffPathItem5groupEv:
   89|  10.4M|  [[nodiscard]] IfdId group() const {
   90|  10.4M|    return group_;
   91|  10.4M|  }
_ZN5Exiv28Internal13TiffComponentC2EtNS_5IfdIdE:
  170|  6.25M|  constexpr TiffComponent(uint16_t tag, IfdId group) : tag_(tag), group_(group) {
  171|  6.25M|  }
_ZN5Exiv28Internal13TiffComponent8setStartEPKh:
  216|  3.84M|  void setStart(const byte* pStart) {
  217|  3.84M|    pStart_ = const_cast<byte*>(pStart);
  218|  3.84M|  }
_ZNK5Exiv28Internal13TiffComponent3tagEv:
  240|   185M|  [[nodiscard]] uint16_t tag() const {
  241|   185M|    return tag_;
  242|   185M|  }
_ZNK5Exiv28Internal13TiffComponent5groupEv:
  244|  25.6M|  [[nodiscard]] IfdId group() const {
  245|  25.6M|    return group_;
  246|  25.6M|  }
_ZNK5Exiv28Internal13TiffComponent5startEv:
  248|  3.94M|  [[nodiscard]] byte* start() const {
  249|  3.94M|    return pStart_;
  250|  3.94M|  }
_ZN5Exiv28Internal13TiffEntryBase9setOffsetEm:
  416|  2.61M|  void setOffset(size_t offset) {
  417|  2.61M|    offset_ = offset;
  418|  2.61M|  }
_ZNK5Exiv28Internal13TiffEntryBase8tiffTypeEv:
  458|  1.22M|  [[nodiscard]] TiffType tiffType() const {
  459|  1.22M|    return tiffType_;
  460|  1.22M|  }
_ZNK5Exiv28Internal13TiffEntryBase6offsetEv:
  465|  64.4k|  [[nodiscard]] size_t offset() const {
  466|  64.4k|    return offset_;
  467|  64.4k|  }
_ZNK5Exiv28Internal13TiffEntryBase5pDataEv:
  476|  2.80M|  [[nodiscard]] const byte* pData() const {
  477|  2.80M|    return pData_;
  478|  2.80M|  }
_ZNK5Exiv28Internal13TiffEntryBase6pValueEv:
  480|  19.6M|  [[nodiscard]] const Value* pValue() const {
  481|  19.6M|    return pValue_.get();
  482|  19.6M|  }
_ZN5Exiv28Internal13TiffEntryBase8setCountEm:
  497|  1.25M|  void setCount(size_t count) {
  498|  1.25M|    count_ = count;
  499|  1.25M|  }
_ZN5Exiv28Internal13TiffEntryBase6setIdxEi:
  501|  2.54M|  void setIdx(int idx) {
  502|  2.54M|    idx_ = idx;
  503|  2.54M|  }
_ZNK5Exiv28Internal13TiffEntryBase7storageEv:
  540|  1.35M|  [[nodiscard]] std::shared_ptr<DataBuf> storage() const {
  541|  1.35M|    return storage_;
  542|  1.35M|  }
_ZNK5Exiv28Internal17TiffDataEntryBase5szTagEv:
  623|  48.4k|  [[nodiscard]] uint16_t szTag() const {
  624|  48.4k|    return szTag_;
  625|  48.4k|  }
_ZNK5Exiv28Internal17TiffDataEntryBase7szGroupEv:
  627|  48.4k|  [[nodiscard]] IfdId szGroup() const {
  628|  48.4k|    return szGroup_;
  629|  48.4k|  }
_ZNK5Exiv28Internal13TiffSizeEntry5dtTagEv:
  789|  48.3k|  [[nodiscard]] uint16_t dtTag() const {
  790|  48.3k|    return dtTag_;
  791|  48.3k|  }
_ZNK5Exiv28Internal13TiffSizeEntry7dtGroupEv:
  793|  48.3k|  [[nodiscard]] IfdId dtGroup() const {
  794|  48.3k|    return dtGroup_;
  795|  48.3k|  }
_ZNK5Exiv28Internal13TiffDirectory7hasNextEv:
  842|  22.5k|  [[nodiscard]] bool hasNext() const {
  843|  22.5k|    return hasNext_;
  844|  22.5k|  }
_ZN5Exiv28Internal16TiffIfdMakernote17setImageByteOrderENS_9ByteOrderE:
 1106|  11.6k|  void setImageByteOrder(ByteOrder byteOrder) {
 1107|  11.6k|    imageByteOrder_ = byteOrder;
 1108|  11.6k|  }
_ZNK5Exiv28Internal8ArrayDefeqEm:
 1217|  6.70M|  bool operator==(size_t idx) const {
 1218|  6.70M|    return idx_ == idx;
 1219|  6.70M|  }
_ZNK5Exiv28Internal8ArrayCfg7tagStepEv:
 1234|  2.81M|  [[nodiscard]] size_t tagStep() const {
 1235|  2.81M|    return elDefaultDef_.size(0, group_);
 1236|  2.81M|  }
_ZN5Exiv28Internal15TiffBinaryArray10setDecodedEb:
 1310|  2.60M|  void setDecoded(bool decoded) {
 1311|  2.60M|    decoded_ = decoded;
 1312|  2.60M|  }
_ZNK5Exiv28Internal15TiffBinaryArray3cfgEv:
 1318|  8.54M|  [[nodiscard]] const ArrayCfg* cfg() const {
 1319|  8.54M|    return arrayCfg_;
 1320|  8.54M|  }
_ZNK5Exiv28Internal15TiffBinaryArray3defEv:
 1322|   124k|  [[nodiscard]] const ArrayDef* def() const {
 1323|   124k|    return arrayDef_;
 1324|   124k|  }
_ZNK5Exiv28Internal15TiffBinaryArray7defSizeEv:
 1326|  63.5k|  [[nodiscard]] size_t defSize() const {
 1327|  63.5k|    return defSize_;
 1328|  63.5k|  }
_ZNK5Exiv28Internal15TiffBinaryArray7decodedEv:
 1330|   243k|  [[nodiscard]] bool decoded() const {
 1331|   243k|    return decoded_;
 1332|   243k|  }
_ZN5Exiv28Internal17TiffBinaryElement8setElDefERKNS0_8ArrayDefE:
 1404|  1.35M|  void setElDef(const ArrayDef& def) {
 1405|  1.35M|    elDef_ = def;
 1406|  1.35M|  }
_ZN5Exiv28Internal17TiffBinaryElement14setElByteOrderENS_9ByteOrderE:
 1410|  1.35M|  void setElByteOrder(ByteOrder byteOrder) {
 1411|  1.35M|    elByteOrder_ = byteOrder;
 1412|  1.35M|  }
_ZNK5Exiv28Internal17TiffBinaryElement5elDefEv:
 1420|  1.38M|  [[nodiscard]] const ArrayDef* elDef() const {
 1421|  1.38M|    return &elDef_;
 1422|  1.38M|  }
_ZNK5Exiv28Internal17TiffBinaryElement11elByteOrderEv:
 1426|  1.38M|  [[nodiscard]] ByteOrder elByteOrder() const {
 1427|  1.38M|    return elByteOrder_;
 1428|  1.38M|  }
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|  22.4k|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|  22.4k|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|  22.4k|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE56EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|      4|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|      4|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|      4|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE56EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|     80|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|     80|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|     80|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE5EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|     13|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|     13|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|     13|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE21EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|    261|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|    261|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|    261|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE6EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|     26|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|     26|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|     26|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE5EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  8.73k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  8.73k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  8.73k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE6EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  6.94k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  6.94k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  6.94k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  2.28k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  2.28k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  2.28k|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  2.05k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  2.05k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  2.05k|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    528|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    528|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    528|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  1.16k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  1.16k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  1.16k|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  6.98k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  6.98k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  6.98k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE1EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  9.37k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  9.37k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  9.37k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  2.87k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  2.87k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  2.87k|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|  3.96k|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|  3.96k|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|  3.96k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    837|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    837|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    837|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    996|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    996|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    996|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    434|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    434|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    434|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    521|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    521|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    521|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  8.49k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  8.49k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  8.49k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE9EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  8.79k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  8.79k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  8.79k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    831|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    831|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    831|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  1.11k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  1.11k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  1.11k|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    465|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    465|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    465|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    463|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    463|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    463|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  6.55k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  6.55k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  6.55k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE10EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  8.10k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  8.10k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  8.10k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    861|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    861|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    861|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    822|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    822|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    822|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    236|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    236|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    236|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    272|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    272|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    272|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  5.10k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  5.10k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  5.10k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE11EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  6.00k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  6.00k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  6.00k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    339|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    339|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    339|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    431|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    431|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    431|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    117|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    117|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    117|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    549|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    549|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    549|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  3.00k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  3.00k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  3.00k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE12EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  3.25k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  3.25k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  3.25k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    221|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    221|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    221|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    143|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    143|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    143|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    361|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    361|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    361|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    340|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    340|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    340|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  1.82k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  1.82k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  1.82k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE13EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  1.82k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  1.82k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  1.82k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    173|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    173|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    173|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    111|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    111|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    111|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    200|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    200|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    200|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     70|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     70|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     70|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  1.44k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  1.44k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  1.44k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE14EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  1.12k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  1.12k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  1.12k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|     87|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|     87|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|     87|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    283|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    283|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    283|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    120|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    120|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    120|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     44|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     44|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     44|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  1.73k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  1.73k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  1.73k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE15EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|  2.00k|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|  2.00k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|  2.00k|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    153|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    153|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    153|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     59|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     59|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     59|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    183|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    183|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    183|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     71|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     71|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     71|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  1.03k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  1.03k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  1.03k|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE16EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    414|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    414|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    414|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    199|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    199|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    199|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     86|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     86|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     86|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    206|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    206|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    206|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    310|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    310|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    310|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    522|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    522|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    522|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE17EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    433|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    433|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    433|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE7EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    233|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    233|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    233|}
_ZN5Exiv28Internal16newTiffThumbDataILt279ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    149|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    149|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    149|}
_ZN5Exiv28Internal16newTiffThumbSizeILt273ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|    300|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|    300|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|    300|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    107|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    107|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    107|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    219|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    219|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    219|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  1.25k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  1.25k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  1.25k|}
_ZN5Exiv28Internal16newTiffThumbDataILt514ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|  12.1k|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|  12.1k|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|  12.1k|}
_ZN5Exiv28Internal16newTiffThumbSizeILt513ELNS_5IfdIdE2EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|  8.39k|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|  8.39k|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|  8.39k|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE3EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|    432|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|    432|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|    432|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    218|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    218|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    218|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    219|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    219|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    219|}
_ZN5Exiv28Internal16newTiffImageDataILt325ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    130|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    130|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    130|}
_ZN5Exiv28Internal16newTiffImageSizeILt324ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     63|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     63|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     63|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    250|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    250|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    250|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE18EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    259|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    259|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    259|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE3EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|     65|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|     65|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|     65|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE3EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|     97|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|     97|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|     97|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE3EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    202|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    202|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    202|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE3EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    187|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    187|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    187|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE4EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|    167|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|    167|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|    167|}
_ZN5Exiv28Internal16newTiffImageDataILt279ELNS_5IfdIdE4EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|     91|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|     91|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|     91|}
_ZN5Exiv28Internal16newTiffImageSizeILt273ELNS_5IfdIdE4EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    194|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    194|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    194|}
_ZN5Exiv28Internal16newTiffImageDataILt514ELNS_5IfdIdE4EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|    111|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|    111|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|    111|}
_ZN5Exiv28Internal16newTiffImageSizeILt513ELNS_5IfdIdE4EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    245|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    245|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    245|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10minoCsoCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|  8.70k|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|  8.70k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|  8.70k|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10minoCsnCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|  1.58k|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|  1.58k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|  1.58k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE100EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    369|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    369|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    369|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE99EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  2.66k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  2.66k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  2.66k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE101EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    181|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    181|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    181|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE102EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    104|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    104|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    104|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE103EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    159|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    159|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    159|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE104EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    172|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    172|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    172|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE105EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    378|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    378|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    378|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE106EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    477|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    477|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    477|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE107EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    220|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    220|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    220|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE108EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    233|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    233|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    233|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE109EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  3.56k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  3.56k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  3.56k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE110EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    395|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    395|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    395|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE111EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    656|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    656|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    656|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE112EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  4.31k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  4.31k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  4.31k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE113EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  1.31k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  1.31k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  1.31k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE114EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|  1.90k|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|  1.90k|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|  1.90k|}
_ZN5Exiv28Internal16newTiffImageDataILt258ELNS_5IfdIdE99EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1531|  1.96k|TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group) {
 1532|  1.96k|  return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
 1533|  1.96k|}
_ZN5Exiv28Internal16newTiffImageSizeILt257ELNS_5IfdIdE99EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1537|    263|TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group) {
 1538|       |  // Todo: Same as newTiffThumbSize - consolidate (rename)?
 1539|    263|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1540|    263|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10canonCsCfgEELm1ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10canonCsDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|  1.28k|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|  1.28k|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|  1.28k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|  1.28k|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonSiCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|  1.15k|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|  1.15k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|  1.15k|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonPaCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    199|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    199|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    199|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonCfCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|     32|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|     32|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|     32|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonPiCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    123|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    123|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    123|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonTiCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    165|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    165|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    165|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10canonFiCfgEELm1ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10canonFiDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     96|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     96|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     96|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     96|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonPrCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|     86|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|     86|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|     86|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L15canonAfMiAdjCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    176|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    176|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    176|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L15canonVigCor2CfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|     24|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|     24|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|     24|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L12canonLiOpCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    124|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    124|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    124|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10canonLeCfgEELm2ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10canonLeDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     71|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     71|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     71|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     71|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonAmCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    117|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    117|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    117|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L10canonMeCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    205|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    205|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    205|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L11canonFilCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    129|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    129|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    129|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L11canonHdrCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    276|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    276|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    276|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L11canonAfCCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    250|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    250|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    250|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L12canonRawBCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|     40|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|     40|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|     40|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE65EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    328|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    328|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    328|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonVrCfgEELm2ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonVrDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    211|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    211|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    211|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    211|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonPcCfgEELm13ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonPcDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     55|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     55|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     55|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     55|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonWtCfgEELm3ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonWtDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    111|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    111|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    111|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    111|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonIiCfgEELm5ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonIiDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    180|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    180|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    180|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    180|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonAfCfgEELm3ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonAfDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    324|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    324|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    324|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    324|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm6ETnRAT__KNS0_8ArraySetEL_ZNS0_L10nikonSiSetEEXadL_ZNS0_13nikonSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    209|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    209|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    209|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    209|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm6ETnRAT__KNS0_8ArraySetEL_ZNS0_L10nikonCbSetEEXadL_ZNS0_13nikonSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    249|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    249|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    249|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    249|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm4ETnRAT__KNS0_8ArraySetEL_ZNS0_L10nikonLdSetEEXadL_ZNS0_13nikonSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    270|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    270|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    270|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    270|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm5ETnRAT__KNS0_8ArraySetEL_ZNS0_L10nikonFlSetEEXadL_ZNS0_13nikonSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|  1.61k|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|  1.61k|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|  1.61k|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|  1.61k|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonMeCfgEELm4ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonMeDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    218|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    218|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    218|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    218|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm2ETnRAT__KNS0_8ArraySetEL_ZNS0_L11nikonAf2SetEEXadL_ZNS0_13nikonSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    227|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    227|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    227|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    227|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10nikonFiCfgEELm3ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10nikonFiDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    488|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    488|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    488|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    488|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L11nikonAFTCfgEELm3ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L11nikonAFTDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    148|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    148|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    148|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    148|}
_ZN5Exiv28Internal16newTiffThumbDataILt514ELNS_5IfdIdE65EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    240|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    240|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    240|}
_ZN5Exiv28Internal16newTiffThumbSizeILt513ELNS_5IfdIdE65EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|    279|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|    279|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|    279|}
_ZN5Exiv28Internal16newTiffThumbSizeILt4ELNS_5IfdIdE117EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|    575|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|    575|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|    575|}
_ZN5Exiv28Internal16newTiffThumbDataILt3ELNS_5IfdIdE117EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    548|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    548|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    548|}
_ZN5Exiv28Internal16newTiffThumbSizeILt4ELNS_5IfdIdE116EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|    335|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|    335|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|    335|}
_ZN5Exiv28Internal16newTiffThumbDataILt3ELNS_5IfdIdE116EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    936|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    936|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    936|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L12samsungPwCfgEELm5ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L12samsungPwDefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|  3.96k|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|  3.96k|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|  3.96k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|  3.96k|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE119EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|    576|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|    576|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|    576|}
_ZN5Exiv28Internal16newTiffThumbDataILt514ELNS_5IfdIdE119EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    259|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    259|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    259|}
_ZN5Exiv28Internal16newTiffThumbSizeILt513ELNS_5IfdIdE119EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|    365|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|    365|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|    365|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm1ETnRAT__KNS0_8ArraySetEL_ZNS0_L12sony2010eSetEEXadL_ZNS0_17sony2010eSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    163|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    163|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    163|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    163|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm1ETnRAT__KNS0_8ArraySetEL_ZNS0_L10sony2FpSetEEXadL_ZNS0_15sony2FpSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    647|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    647|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    647|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    647|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm1ETnRAT__KNS0_8ArraySetEL_ZNS0_L13sonyMisc2bSetEEXadL_ZNS0_18sonyMisc2bSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    233|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    233|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    233|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    233|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm1ETnRAT__KNS0_8ArraySetEL_ZNS0_L13sonyMisc3cSetEEXadL_ZNS0_18sonyMisc3cSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    455|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    455|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    455|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    455|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L12sonyMisc1CfgEELm1ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L12sonyMisc1DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     91|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     91|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     91|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     91|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L13sonySInfo1CfgEELm5ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L13sonySInfo1DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|  1.40k|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|  1.40k|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|  1.40k|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|  1.40k|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm2ETnRAT__KNS0_8ArraySetEL_ZNS0_L10sony1CsSetEEXadL_ZNS0_14sonyCsSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    190|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    190|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    190|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    190|}
_ZN5Exiv28Internal13newTiffSubIfdILNS_5IfdIdE124EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1493|     70|TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
 1494|     70|  return std::make_unique<TiffSubIfd>(tag, group, newGroup);
 1495|     70|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray2ILm2ETnRAT__KNS0_8ArraySetEL_ZNS0_L10sony2CsSetEEXadL_ZNS0_14sonyCsSelectorEtPKhmPNS0_13TiffComponentEEEEENSt3__110unique_ptrIS8_NSA_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1512|    231|TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group) {
 1513|    231|  static_assert(N > 0, "Passed zero length newTiffBinaryArray2");
 1514|    231|  return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
 1515|    231|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L12sony1MCsoCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    116|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    116|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    116|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray1IL_ZNS0_L12sony1MCsnCfgEEEENSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEEtNS_5IfdIdE:
 1506|    126|TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
 1507|    126|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
 1508|    126|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L12sony1MCs7CfgEELm2ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10minoCs7DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    154|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    154|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    154|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    154|}
_ZN5Exiv28Internal16newTiffThumbDataILt137ELNS_5IfdIdE124EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|     21|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|     21|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|     21|}
_ZN5Exiv28Internal16newTiffThumbSizeILt136ELNS_5IfdIdE124EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|     18|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|     18|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|     18|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L15sony1MCsA100CfgEELm3ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L15sony1MCsA100DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     63|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     63|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     63|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     63|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10minoCs7CfgEELm2ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10minoCs7DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|    488|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|    488|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|    488|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|    488|}
_ZN5Exiv28Internal16newTiffThumbDataILt137ELNS_5IfdIdE57EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1519|    427|TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group) {
 1520|    427|  return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
 1521|    427|}
_ZN5Exiv28Internal16newTiffThumbSizeILt136ELNS_5IfdIdE57EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1525|     41|TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group) {
 1526|     41|  return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
 1527|     41|}
tiffimage_int.cpp:_ZN5Exiv28Internal19newTiffBinaryArray0IL_ZNS0_L10minoCs5CfgEELm1ETnRAT0__KNS0_8ArrayDefEL_ZNS0_L10minoCs5DefEEEENSt3__110unique_ptrINS0_13TiffComponentENS6_14default_deleteIS8_EEEEtNS_5IfdIdE:
 1499|     38|TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
 1500|     38|  static_assert(N > 0, "Passed zero length newTiffBinaryArray0");
 1501|     38|  return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
 1502|     38|}
_ZN5Exiv28Internal16newTiffDirectoryILNS_5IfdIdE19EEENSt3__110unique_ptrINS0_13TiffComponentENS3_14default_deleteIS5_EEEEtS2_:
 1487|  6.34k|TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId /*group*/) {
 1488|  6.34k|  return std::make_unique<TiffDirectory>(tag, newGroup);
 1489|  6.34k|}
_ZN5Exiv28Internal13TiffComponentD2Ev:
  173|  6.29M|  virtual ~TiffComponent() = default;
_ZN5Exiv28Internal13TiffDirectoryD2Ev:
  830|   111k|  ~TiffDirectory() override = default;
_ZN5Exiv28Internal10TiffSubIfdD2Ev:
  937|  38.4k|  ~TiffSubIfd() override = default;
_ZN5Exiv28Internal15TiffBinaryArrayD2Ev:
 1269|  27.5k|  ~TiffBinaryArray() override = default;

_ZN5Exiv29TiffImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   44|  5.48k|    Image(ImageType::tiff, mdExif | mdIptc | mdXmp, std::move(io), params) {
   45|  5.48k|}  // TiffImage::TiffImage
_ZNK5Exiv29TiffImage12primaryGroupEv:
   76|  1.86k|std::string TiffImage::primaryGroup() const {
   77|  1.86k|  if (!primaryGroup_.empty())
  ------------------
  |  Branch (77:7): [True: 930, False: 935]
  ------------------
   78|    930|    return primaryGroup_;
   79|       |
   80|    935|  static constexpr auto keys = std::array{
   81|    935|      "Exif.Image.NewSubfileType",     "Exif.SubImage1.NewSubfileType", "Exif.SubImage2.NewSubfileType",
   82|    935|      "Exif.SubImage3.NewSubfileType", "Exif.SubImage4.NewSubfileType", "Exif.SubImage5.NewSubfileType",
   83|    935|      "Exif.SubImage6.NewSubfileType", "Exif.SubImage7.NewSubfileType", "Exif.SubImage8.NewSubfileType",
   84|    935|      "Exif.SubImage9.NewSubfileType",
   85|    935|  };
   86|       |  // Find the group of the primary image, default to "Image"
   87|    935|  primaryGroup_ = std::string("Image");
   88|  8.89k|  for (auto i : keys) {
  ------------------
  |  Branch (88:15): [True: 8.89k, False: 878]
  ------------------
   89|  8.89k|    auto md = exifData_.findKey(ExifKey(i));
   90|       |    // Is it the primary image?
   91|  8.89k|    if (md != exifData_.end() && md->count() > 0 && md->toInt64() == 0) {
  ------------------
  |  Branch (91:9): [True: 304, False: 8.58k]
  |  Branch (91:9): [True: 116, False: 8.77k]
  |  Branch (91:34): [True: 269, False: 35]
  |  Branch (91:53): [True: 116, False: 153]
  ------------------
   92|       |      // Sometimes there is a JPEG primary image; that's not our first choice
   93|    116|      primaryGroup_ = md->groupName();
   94|    116|      std::string key = "Exif." + primaryGroup_ + ".JPEGInterchangeFormat";
   95|    116|      if (exifData_.findKey(ExifKey(key)) == exifData_.end())
  ------------------
  |  Branch (95:11): [True: 57, False: 59]
  ------------------
   96|     57|        break;
   97|    116|    }
   98|  8.89k|  }
   99|    935|  return primaryGroup_;
  100|  1.86k|}
_ZNK5Exiv29TiffImage10pixelWidthEv:
  102|    935|uint32_t TiffImage::pixelWidth() const {
  103|    935|  if (pixelWidthPrimary_ != 0) {
  ------------------
  |  Branch (103:7): [True: 0, False: 935]
  ------------------
  104|      0|    return pixelWidthPrimary_;
  105|      0|  }
  106|       |
  107|    935|  ExifKey key(std::string("Exif.") + primaryGroup() + std::string(".ImageWidth"));
  108|    935|  auto imageWidth = exifData_.findKey(key);
  109|    935|  if (imageWidth != exifData_.end() && imageWidth->count() > 0) {
  ------------------
  |  Branch (109:7): [True: 231, False: 704]
  |  Branch (109:7): [True: 97, False: 838]
  |  Branch (109:40): [True: 97, False: 134]
  ------------------
  110|     97|    pixelWidthPrimary_ = imageWidth->toUint32();
  111|     97|  }
  112|    935|  return pixelWidthPrimary_;
  113|    935|}
_ZNK5Exiv29TiffImage11pixelHeightEv:
  115|    930|uint32_t TiffImage::pixelHeight() const {
  116|    930|  if (pixelHeightPrimary_ != 0) {
  ------------------
  |  Branch (116:7): [True: 0, False: 930]
  ------------------
  117|      0|    return pixelHeightPrimary_;
  118|      0|  }
  119|       |
  120|    930|  ExifKey key(std::string("Exif.") + primaryGroup() + std::string(".ImageLength"));
  121|    930|  auto imageHeight = exifData_.findKey(key);
  122|    930|  if (imageHeight != exifData_.end() && imageHeight->count() > 0) {
  ------------------
  |  Branch (122:7): [True: 219, False: 711]
  |  Branch (122:7): [True: 110, False: 820]
  |  Branch (122:41): [True: 110, False: 109]
  ------------------
  123|    110|    pixelHeightPrimary_ = imageHeight->toUint32();
  124|    110|  }
  125|    930|  return pixelHeightPrimary_;
  126|    930|}
_ZN5Exiv29TiffImage12readMetadataEv:
  133|  5.36k|void TiffImage::readMetadata() {
  134|       |#ifdef EXIV2_DEBUG_MESSAGES
  135|       |  std::cerr << "Reading TIFF file " << io_->path() << "\n";
  136|       |#endif
  137|  5.36k|  if (io_->open() != 0) {
  ------------------
  |  Branch (137:7): [True: 0, False: 5.36k]
  ------------------
  138|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  139|      0|  }
  140|       |
  141|  5.36k|  IoCloser closer(*io_);
  142|       |  // Ensure that this is the correct image type
  143|  5.36k|  if (!isTiffType(*io_, false)) {
  ------------------
  |  Branch (143:7): [True: 0, False: 5.36k]
  ------------------
  144|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (144:9): [True: 0, False: 0]
  |  Branch (144:25): [True: 0, False: 0]
  ------------------
  145|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  146|      0|    throw Error(ErrorCode::kerNotAnImage, "TIFF");
  147|      0|  }
  148|  5.36k|  clearMetadata();
  149|       |
  150|  5.36k|  const DecodeParams dp(max_recursion_depth_);
  151|  5.36k|  ByteOrder bo = TiffParser::decode(exifData_, iptcData_, xmpData_, io_->mmap(), io_->size(), dp);
  152|  5.36k|  setByteOrder(bo);
  153|       |
  154|       |  // read profile from the metadata
  155|  5.36k|  Exiv2::ExifKey key("Exif.Image.InterColorProfile");
  156|  5.36k|  auto pos = exifData_.findKey(key);
  157|  5.36k|  if (pos != exifData_.end()) {
  ------------------
  |  Branch (157:7): [True: 80, False: 5.28k]
  ------------------
  158|     80|    size_t size = pos->count() * pos->typeSize();
  159|     80|    if (size == 0) {
  ------------------
  |  Branch (159:9): [True: 62, False: 18]
  ------------------
  160|     62|      throw Error(ErrorCode::kerFailedToReadImageData);
  161|     62|    }
  162|     18|    iccProfile_.alloc(size);
  163|     18|    pos->copy(iccProfile_.data(), bo);
  164|     18|  }
  165|  5.36k|}
_ZN5Exiv29TiffImage13writeMetadataEv:
  167|  4.00k|void TiffImage::writeMetadata() {
  168|       |#ifdef EXIV2_DEBUG_MESSAGES
  169|       |  std::cerr << "Writing TIFF file " << io_->path() << "\n";
  170|       |#endif
  171|  4.00k|  ByteOrder bo = byteOrder();
  172|  4.00k|  const byte* pData = nullptr;
  173|  4.00k|  size_t size = 0;
  174|  4.00k|  IoCloser closer(*io_);
  175|       |  // Ensure that this is the correct image type
  176|  4.00k|  if (io_->open() == 0 && isTiffType(*io_, false)) {
  ------------------
  |  Branch (176:7): [True: 4.00k, False: 0]
  |  Branch (176:27): [True: 4.00k, False: 0]
  ------------------
  177|  4.00k|    pData = io_->mmap(true);
  178|  4.00k|    size = io_->size();
  179|  4.00k|    TiffHeader tiffHeader;
  180|  4.00k|    if (0 == tiffHeader.read(pData, 8)) {
  ------------------
  |  Branch (180:9): [True: 0, False: 4.00k]
  ------------------
  181|      0|      bo = tiffHeader.byteOrder();
  182|      0|    }
  183|  4.00k|  }
  184|  4.00k|  if (bo == invalidByteOrder) {
  ------------------
  |  Branch (184:7): [True: 0, False: 4.00k]
  ------------------
  185|      0|    bo = littleEndian;
  186|      0|  }
  187|  4.00k|  setByteOrder(bo);
  188|       |
  189|       |  // fixup ICC profile
  190|  4.00k|  Exiv2::ExifKey key("Exif.Image.InterColorProfile");
  191|  4.00k|  auto pos = exifData_.findKey(key);
  192|  4.00k|  bool found = pos != exifData_.end();
  193|  4.00k|  if (iccProfileDefined()) {
  ------------------
  |  Branch (193:7): [True: 13, False: 3.99k]
  ------------------
  194|     13|    Exiv2::DataValue value(iccProfile_.c_data(), iccProfile_.size());
  195|     13|    if (found)
  ------------------
  |  Branch (195:9): [True: 13, False: 0]
  ------------------
  196|     13|      pos->setValue(&value);
  197|      0|    else
  198|      0|      exifData_.add(key, &value);
  199|  3.99k|  } else {
  200|  3.99k|    if (found)
  ------------------
  |  Branch (200:9): [True: 0, False: 3.99k]
  ------------------
  201|      0|      exifData_.erase(pos);
  202|  3.99k|  }
  203|       |
  204|       |  // set usePacket to influence TiffEncoder::encodeXmp() called by TiffVisitor.encode()
  205|  4.00k|  xmpData().usePacket(writeXmpFromPacket());
  206|       |
  207|  4.00k|  TiffParser::encode(*io_, pData, size, bo, exifData_, iptcData_, xmpData_);  // may throw
  208|  4.00k|}  // TiffImage::writeMetadata
_ZN5Exiv210TiffParser6decodeERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPKhmRKNS_12DecodeParamsE:
  211|  6.32k|                             const DecodeParams& dp) {
  212|  6.32k|  uint32_t root = Tag::root;
  213|       |
  214|       |  // #1402  Fujifilm RAF. Change root when parsing embedded tiff
  215|  6.32k|  Exiv2::ExifKey key("Exif.Image.Make");
  216|  6.32k|  if (exifData.findKey(key) != exifData.end() && exifData.findKey(key)->toString() == "FUJIFILM") {
  ------------------
  |  Branch (216:7): [True: 152, False: 6.16k]
  |  Branch (216:7): [True: 4, False: 6.31k]
  |  Branch (216:50): [True: 4, False: 148]
  ------------------
  217|      4|    root = Tag::fuji;
  218|      4|  }
  219|       |
  220|  6.32k|  return TiffParserWorker::decode(exifData, iptcData, xmpData, pData, size, root, TiffMapping::findDecoder, dp);
  221|  6.32k|}  // TiffParser::decode
_ZN5Exiv210TiffParser6encodeERNS_7BasicIoEPKhmNS_9ByteOrderERNS_8ExifDataERKNS_8IptcDataERKNS_7XmpDataE:
  224|  5.53k|                               const IptcData& iptcData, const XmpData& xmpData) {
  225|       |  // Delete IFDs which do not occur in TIFF images
  226|  5.53k|  static constexpr auto filteredIfds = std::array{
  227|  5.53k|      IfdId::panaRawId,
  228|  5.53k|  };
  229|  5.53k|  for (auto filteredIfd : filteredIfds) {
  ------------------
  |  Branch (229:25): [True: 5.53k, False: 5.53k]
  ------------------
  230|       |#ifdef EXIV2_DEBUG_MESSAGES
  231|       |    std::cerr << "Warning: Exif IFD " << filteredIfd << " not encoded\n";
  232|       |#endif
  233|  5.53k|    exifData.erase(std::remove_if(exifData.begin(), exifData.end(), FindExifdatum(filteredIfd)), exifData.end());
  234|  5.53k|  }
  235|       |
  236|  5.53k|  TiffHeader header(byteOrder);
  237|  5.53k|  return TiffParserWorker::encode(io, pData, size, exifData, iptcData, xmpData, Tag::root, TiffMapping::findEncoder,
  238|  5.53k|                                  &header, nullptr);
  239|  5.53k|}  // TiffParser::encode
_ZN5Exiv215newTiffInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  243|  5.36k|Image::UniquePtr newTiffInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  244|  5.36k|  auto image = std::make_unique<TiffImage>(std::move(io), params);
  245|  5.36k|  if (!image->good()) {
  ------------------
  |  Branch (245:7): [True: 0, False: 5.36k]
  ------------------
  246|      0|    return nullptr;
  247|      0|  }
  248|  5.36k|  return image;
  249|  5.36k|}
_ZN5Exiv210isTiffTypeERNS_7BasicIoEb:
  251|   181k|bool isTiffType(BasicIo& iIo, bool advance) {
  252|   181k|  const int32_t len = 8;
  253|   181k|  byte buf[len];
  254|   181k|  iIo.read(buf, len);
  255|   181k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (255:7): [True: 0, False: 181k]
  |  Branch (255:22): [True: 1.18k, False: 180k]
  ------------------
  256|  1.18k|    return false;
  257|  1.18k|  }
  258|   180k|  TiffHeader tiffHeader;
  259|   180k|  bool rc = tiffHeader.read(buf, len);
  260|   180k|  if (!advance || !rc) {
  ------------------
  |  Branch (260:7): [True: 180k, False: 0]
  |  Branch (260:19): [True: 0, False: 0]
  ------------------
  261|   180k|    iIo.seek(-len, BasicIo::cur);
  262|   180k|  }
  263|   180k|  return rc;
  264|   181k|}

_ZNK5Exiv28Internal13FindExifdatumclERKNS_9ExifdatumE:
   29|  11.6M|bool FindExifdatum::operator()(const Exiv2::Exifdatum& md) const {
   30|  11.6M|  return ifdId_ == md.ifdId();
   31|  11.6M|}
_ZN5Exiv28Internal11TiffMapping11findDecoderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEjNS_5IfdIdE:
 1991|  1.67M|DecoderFct TiffMapping::findDecoder(std::string_view make, uint32_t extendedTag, IfdId group) {
 1992|  1.67M|  DecoderFct decoderFct = &TiffDecoder::decodeStdTiffEntry;
 1993|  1.67M|  if (auto td = Exiv2::find(tiffMappingInfo_, TiffMappingInfo::Key{make, extendedTag, group})) {
  ------------------
  |  Branch (1993:12): [True: 5.07k, False: 1.67M]
  ------------------
 1994|       |    // This may set decoderFct to 0, meaning that the tag should not be decoded
 1995|  5.07k|    decoderFct = td->decoderFct_;
 1996|  5.07k|  }
 1997|  1.67M|  return decoderFct;
 1998|  1.67M|}
_ZN5Exiv28Internal11TiffMapping11findEncoderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEjNS_5IfdIdE:
 2000|  2.37M|EncoderFct TiffMapping::findEncoder(std::string_view make, uint32_t extendedTag, IfdId group) {
 2001|  2.37M|  EncoderFct encoderFct = nullptr;
 2002|  2.37M|  if (auto td = Exiv2::find(tiffMappingInfo_, TiffMappingInfo::Key{make, extendedTag, group})) {
  ------------------
  |  Branch (2002:12): [True: 3.72k, False: 2.36M]
  ------------------
 2003|       |    // Returns 0 if no special encoder function is found
 2004|  3.72k|    encoderFct = td->encoderFct_;
 2005|  3.72k|  }
 2006|  2.37M|  return encoderFct;
 2007|  2.37M|}
_ZN5Exiv28Internal11TiffCreator6createEjNS_5IfdIdE:
 2009|  6.33M|TiffComponent::UniquePtr TiffCreator::create(uint32_t extendedTag, IfdId group) {
 2010|  6.33M|  auto tag = static_cast<uint16_t>(extendedTag);
 2011|  6.33M|  auto i = tiffGroupTable_.find(TiffGroupKey(extendedTag, group));
 2012|       |  // If the lookup failed then try again with Tag::all.
 2013|  6.33M|  if (i == tiffGroupTable_.end()) {
  ------------------
  |  Branch (2013:7): [True: 6.06M, False: 269k]
  ------------------
 2014|  6.06M|    i = tiffGroupTable_.find(TiffGroupKey(Tag::all, group));
 2015|  6.06M|  }
 2016|  6.33M|  if (i != tiffGroupTable_.end() && i->second) {
  ------------------
  |  Branch (2016:7): [True: 6.18M, False: 148k]
  |  Branch (2016:7): [True: 6.16M, False: 163k]
  |  Branch (2016:37): [True: 6.16M, False: 14.7k]
  ------------------
 2017|  6.16M|    return i->second(tag, group);
 2018|  6.16M|  }
 2019|       |#ifdef EXIV2_DEBUG_MESSAGES
 2020|       |  if (i == tiffGroupTable_.end())
 2021|       |    std::cerr << "Warning: No TIFF structure entry found for ";
 2022|       |  else
 2023|       |    std::cerr << "Warning: No TIFF component creator found for ";
 2024|       |  std::cerr << "extended tag 0x" << std::setw(4) << std::setfill('0') << std::hex << std::right << extendedTag
 2025|       |            << ", group " << groupName(group) << "\n";
 2026|       |#endif
 2027|   163k|  return nullptr;
 2028|  6.33M|}  // TiffCreator::create
_ZN5Exiv28Internal11TiffCreator7getPathEjNS_5IfdIdEj:
 2030|  2.38M|TiffPath TiffCreator::getPath(uint32_t extendedTag, IfdId group, uint32_t root) {
 2031|  2.38M|  TiffPath ret;
 2032|  9.63M|  while (true) {
  ------------------
  |  Branch (2032:10): [True: 9.63M, Folded]
  ------------------
 2033|  9.63M|    ret.emplace(extendedTag, group);
 2034|  9.63M|    const auto ts = tiffTreeTable_.find(TiffGroupKey(root, group));
 2035|  9.63M|    assert(ts != tiffTreeTable_.end());
 2036|  9.63M|    extendedTag = ts->second.second;
 2037|  9.63M|    group = ts->second.first;
 2038|  9.63M|    if (ts->first == TiffGroupKey(root, IfdId::ifdIdNotSet)) {
  ------------------
  |  Branch (2038:9): [True: 2.38M, False: 7.24M]
  ------------------
 2039|  2.38M|      break;
 2040|  2.38M|    }
 2041|  9.63M|  }
 2042|  2.38M|  return ret;
 2043|  2.38M|}
_ZN5Exiv28Internal16TiffParserWorker6decodeERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPKhmjPFMNS0_11TiffDecoderEFvPKNS0_13TiffEntryBaseEENSt3__117basic_string_viewIcNSG_11char_traitsIcEEEEjNS_5IfdIdEERKNS_12DecodeParamsEPNS0_14TiffHeaderBaseE:
 2047|  14.4k|                                   TiffHeaderBase* pHeader) {
 2048|       |  // Create standard TIFF header if necessary
 2049|  14.4k|  std::unique_ptr<TiffHeaderBase> ph;
 2050|  14.4k|  if (!pHeader) {
  ------------------
  |  Branch (2050:7): [True: 7.57k, False: 6.89k]
  ------------------
 2051|  7.57k|    ph = std::make_unique<TiffHeader>();
 2052|  7.57k|    pHeader = ph.get();
 2053|  7.57k|  }
 2054|       |
 2055|  14.4k|  if (auto rootDir = parse(pData, size, root, pHeader)) {
  ------------------
  |  Branch (2055:12): [True: 14.0k, False: 428]
  ------------------
 2056|  14.0k|    auto decoder = TiffDecoder(exifData, iptcData, xmpData, rootDir.get(), findDecoderFct, dp);
 2057|  14.0k|    rootDir->accept(decoder);
 2058|  14.0k|  }
 2059|  14.4k|  return pHeader->byteOrder();
 2060|       |
 2061|  14.4k|}  // TiffParserWorker::decode
_ZN5Exiv28Internal16TiffParserWorker6encodeERNS_7BasicIoEPKhmRKNS_8ExifDataERKNS_8IptcDataERKNS_7XmpDataEjPFMNS0_11TiffEncoderEFvPNS0_13TiffEntryBaseEPKNS_9ExifdatumEENSt3__117basic_string_viewIcNSN_11char_traitsIcEEEEjNS_5IfdIdEEPNS0_14TiffHeaderBaseEPNS0_12OffsetWriterE:
 2066|  11.3k|                                     OffsetWriter* pOffsetWriter) {
 2067|       |  /*
 2068|       |     1) parse the binary image, if one is provided, and
 2069|       |     2) attempt updating the parsed tree in-place ("non-intrusive writing")
 2070|       |     3) else, create a new tree and write a new TIFF structure ("intrusive
 2071|       |        writing"). If there is a parsed tree, it is only used to access the
 2072|       |        image data in this case.
 2073|       |   */
 2074|  11.3k|  WriteMethod writeMethod = wmIntrusive;
 2075|  11.3k|  auto parsedTree = parse(pData, size, root, pHeader);
 2076|  11.3k|  auto primaryGroups = findPrimaryGroups(parsedTree);
 2077|  11.3k|  if (parsedTree) {
  ------------------
  |  Branch (2077:7): [True: 4.25k, False: 7.06k]
  ------------------
 2078|       |    // Attempt to update existing TIFF components based on metadata entries
 2079|  4.25k|    TiffEncoder encoder(exifData, iptcData, xmpData, parsedTree.get(), false, primaryGroups, pHeader, findEncoderFct);
 2080|  4.25k|    parsedTree->accept(encoder);
 2081|  4.25k|    if (!encoder.dirty())
  ------------------
  |  Branch (2081:9): [True: 566, False: 3.69k]
  ------------------
 2082|    566|      writeMethod = wmNonIntrusive;
 2083|  4.25k|  }
 2084|  11.3k|  if (writeMethod == wmIntrusive) {
  ------------------
  |  Branch (2084:7): [True: 10.7k, False: 573]
  ------------------
 2085|  10.7k|    auto createdTree = TiffCreator::create(root, IfdId::ifdIdNotSet);
 2086|  10.7k|    if (parsedTree) {
  ------------------
  |  Branch (2086:9): [True: 3.68k, False: 7.06k]
  ------------------
 2087|       |      // Copy image tags from the original image to the composite
 2088|  3.68k|      TiffCopier copier(createdTree.get(), root, pHeader, primaryGroups);
 2089|  3.68k|      parsedTree->accept(copier);
 2090|  3.68k|    }
 2091|       |    // Add entries from metadata to composite
 2092|  10.7k|    TiffEncoder encoder(exifData, iptcData, xmpData, createdTree.get(), !parsedTree, std::move(primaryGroups), pHeader,
 2093|  10.7k|                        findEncoderFct);
 2094|  10.7k|    encoder.add(createdTree.get(), std::move(parsedTree), root);
 2095|       |    // Write binary representation from the composite tree
 2096|  10.7k|    DataBuf header = pHeader->write();
 2097|  10.7k|    auto tempIo = MemIo();
 2098|  10.7k|    IoWrapper ioWrapper(tempIo, header.c_data(), header.size(), pOffsetWriter);
 2099|  10.7k|    auto imageIdx(std::string::npos);
 2100|  10.7k|    createdTree->write(ioWrapper, pHeader->byteOrder(), header.size(), std::string::npos, std::string::npos, imageIdx);
 2101|  10.7k|    if (pOffsetWriter)
  ------------------
  |  Branch (2101:9): [True: 118, False: 10.6k]
  ------------------
 2102|    118|      pOffsetWriter->writeOffsets(tempIo);
 2103|  10.7k|    io.transfer(tempIo);  // may throw
 2104|  10.7k|#ifndef SUPPRESS_WARNINGS
 2105|  10.7k|    EXV_INFO << "Write strategy: Intrusive\n";
  ------------------
  |  |  134|  10.7k|  if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (134:7): [True: 0, False: 10.7k]
  |  |  |  Branch (134:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|  10.7k|  LogMsg(LogMsg::info).os()
  ------------------
 2106|  10.7k|#endif
 2107|  10.7k|  }
 2108|    573|#ifndef SUPPRESS_WARNINGS
 2109|    573|  else {
 2110|    573|    EXV_INFO << "Write strategy: Non-intrusive\n";
  ------------------
  |  |  134|    573|  if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (134:7): [True: 0, False: 573]
  |  |  |  Branch (134:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|    573|  LogMsg(LogMsg::info).os()
  ------------------
 2111|    573|  }
 2112|  11.3k|#endif
 2113|  11.3k|  return writeMethod;
 2114|  11.3k|}  // TiffParserWorker::encode
_ZN5Exiv28Internal16TiffParserWorker5parseEPKhmjPNS0_14TiffHeaderBaseE:
 2117|  25.7k|                                                 TiffHeaderBase* pHeader) {
 2118|  25.7k|  TiffComponent::UniquePtr rootDir;
 2119|  25.7k|  if (!pData || size == 0)
  ------------------
  |  Branch (2119:7): [True: 7.16k, False: 18.6k]
  |  Branch (2119:17): [True: 0, False: 18.6k]
  ------------------
 2120|  7.16k|    return rootDir;
 2121|  18.6k|  if (!pHeader->read(pData, size) || pHeader->offset() >= size) {
  ------------------
  |  Branch (2121:7): [True: 165, False: 18.4k]
  |  Branch (2121:38): [True: 154, False: 18.3k]
  ------------------
 2122|    319|    throw Error(ErrorCode::kerNotAnImage, "TIFF");
 2123|    319|  }
 2124|  18.3k|  rootDir = TiffCreator::create(root, IfdId::ifdIdNotSet);
 2125|  18.3k|  if (rootDir) {
  ------------------
  |  Branch (2125:7): [True: 18.3k, False: 0]
  ------------------
 2126|  18.3k|    rootDir->setStart(pData + pHeader->offset());
 2127|  18.3k|    auto state = TiffRwState{pHeader->byteOrder(), 0};
 2128|  18.3k|    auto reader = TiffReader{pData, size, rootDir.get(), state};
 2129|  18.3k|    rootDir->accept(reader);
 2130|  18.3k|    reader.postProcess();
 2131|  18.3k|  }
 2132|  18.3k|  return rootDir;
 2133|       |
 2134|  18.6k|}  // TiffParserWorker::parse
_ZN5Exiv28Internal16TiffParserWorker17findPrimaryGroupsERKNSt3__110unique_ptrINS0_13TiffComponentENS2_14default_deleteIS4_EEEE:
 2136|  11.3k|PrimaryGroups TiffParserWorker::findPrimaryGroups(const TiffComponent::UniquePtr& pSourceDir) {
 2137|  11.3k|  PrimaryGroups ret;
 2138|  11.3k|  if (!pSourceDir)
  ------------------
  |  Branch (2138:7): [True: 7.06k, False: 4.25k]
  ------------------
 2139|  7.06k|    return ret;
 2140|       |
 2141|  4.25k|  static constexpr auto imageGroups = std::array{
 2142|  4.25k|      IfdId::ifd0Id,      IfdId::ifd1Id,      IfdId::ifd2Id,      IfdId::ifd3Id,      IfdId::subImage1Id,
 2143|  4.25k|      IfdId::subImage2Id, IfdId::subImage3Id, IfdId::subImage4Id, IfdId::subImage5Id, IfdId::subImage6Id,
 2144|  4.25k|      IfdId::subImage7Id, IfdId::subImage8Id, IfdId::subImage9Id,
 2145|  4.25k|  };
 2146|       |
 2147|  55.3k|  for (auto imageGroup : imageGroups) {
  ------------------
  |  Branch (2147:24): [True: 55.3k, False: 4.25k]
  ------------------
 2148|  55.3k|    TiffFinder finder(0x00fe, imageGroup);
 2149|  55.3k|    pSourceDir->accept(finder);
 2150|  55.3k|    auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
 2151|  55.3k|    if (!te)
  ------------------
  |  Branch (2151:9): [True: 54.4k, False: 925]
  ------------------
 2152|  54.4k|      continue;
 2153|    925|    const Value* pV = te->pValue();
 2154|    925|    if (pV && pV->typeId() == unsignedLong && pV->count() == 1 && (pV->toInt64() & 1) == 0) {
  ------------------
  |  Branch (2154:9): [True: 807, False: 118]
  |  Branch (2154:15): [True: 689, False: 118]
  |  Branch (2154:47): [True: 654, False: 35]
  |  Branch (2154:67): [True: 596, False: 58]
  ------------------
 2155|    596|      ret.push_back(te->group());
 2156|    596|    }
 2157|    925|  }
 2158|  4.25k|  return ret;
 2159|  11.3k|}  // TiffParserWorker::findPrimaryGroups
_ZN5Exiv28Internal14TiffHeaderBaseC2EtjNS_9ByteOrderEj:
 2162|   298k|    tag_(tag), size_(size), byteOrder_(byteOrder), offset_(offset) {
 2163|   298k|}
_ZN5Exiv28Internal14TiffHeaderBase4readEPKhm:
 2165|   240k|bool TiffHeaderBase::read(const byte* pData, size_t size) {
 2166|   240k|  if (!pData || size < 8)
  ------------------
  |  Branch (2166:7): [True: 0, False: 240k]
  |  Branch (2166:17): [True: 58, False: 240k]
  ------------------
 2167|     58|    return false;
 2168|       |
 2169|   240k|  if (pData[0] == 'I' && pData[0] == pData[1]) {
  ------------------
  |  Branch (2169:7): [True: 6.26k, False: 234k]
  |  Branch (2169:26): [True: 5.74k, False: 520]
  ------------------
 2170|  5.74k|    byteOrder_ = littleEndian;
 2171|   234k|  } else if (pData[0] == 'M' && pData[0] == pData[1]) {
  ------------------
  |  Branch (2171:14): [True: 90.6k, False: 144k]
  |  Branch (2171:33): [True: 90.2k, False: 366]
  ------------------
 2172|  90.2k|    byteOrder_ = bigEndian;
 2173|   144k|  } else {
 2174|   144k|    return false;
 2175|   144k|  }
 2176|  96.0k|  uint16_t t = getUShort(pData + 2, byteOrder_);
 2177|  96.0k|  if (t != 444 && t != 17234 && tag_ != t)
  ------------------
  |  Branch (2177:7): [True: 96.0k, False: 18]
  |  Branch (2177:19): [True: 95.9k, False: 43]
  |  Branch (2177:33): [True: 33.8k, False: 62.1k]
  ------------------
 2178|  33.8k|    return false;  // 444 is for the JPEG-XR; 17234 is for DCP
 2179|  62.2k|  tag_ = t;
 2180|  62.2k|  offset_ = getULong(pData + 4, byteOrder_);
 2181|       |
 2182|  62.2k|  return true;
 2183|  96.0k|}
_ZNK5Exiv28Internal14TiffHeaderBase5writeEv:
 2185|  10.9k|DataBuf TiffHeaderBase::write() const {
 2186|  10.9k|  DataBuf buf(8);
 2187|  10.9k|  switch (byteOrder_) {
  ------------------
  |  Branch (2187:11): [True: 10.9k, False: 0]
  ------------------
 2188|  7.57k|    case littleEndian:
  ------------------
  |  Branch (2188:5): [True: 7.57k, False: 3.33k]
  ------------------
 2189|  7.57k|      buf.write_uint8(0, 'I');
 2190|  7.57k|      break;
 2191|  3.33k|    case bigEndian:
  ------------------
  |  Branch (2191:5): [True: 3.33k, False: 7.57k]
  ------------------
 2192|  3.33k|      buf.write_uint8(0, 'M');
 2193|  3.33k|      break;
 2194|      0|    case invalidByteOrder:
  ------------------
  |  Branch (2194:5): [True: 0, False: 10.9k]
  ------------------
 2195|      0|      break;
 2196|  10.9k|  }
 2197|  10.9k|  buf.write_uint8(1, buf.read_uint8(0));
 2198|  10.9k|  buf.write_uint16(2, tag_, byteOrder_);
 2199|  10.9k|  buf.write_uint32(4, 0x00000008, byteOrder_);
 2200|  10.9k|  return buf;
 2201|  10.9k|}
_ZNK5Exiv28Internal14TiffHeaderBase9byteOrderEv:
 2219|  84.8k|ByteOrder TiffHeaderBase::byteOrder() const {
 2220|  84.8k|  return byteOrder_;
 2221|  84.8k|}
_ZN5Exiv28Internal14TiffHeaderBase12setByteOrderENS_9ByteOrderE:
 2223|  15.3k|void TiffHeaderBase::setByteOrder(ByteOrder byteOrder) {
 2224|  15.3k|  byteOrder_ = byteOrder;
 2225|  15.3k|}
_ZNK5Exiv28Internal14TiffHeaderBase6offsetEv:
 2227|  37.3k|uint32_t TiffHeaderBase::offset() const {
 2228|  37.3k|  return offset_;
 2229|  37.3k|}
_ZN5Exiv28Internal14TiffHeaderBase9setOffsetEj:
 2231|  8.02k|void TiffHeaderBase::setOffset(uint32_t offset) {
 2232|  8.02k|  offset_ = offset;
 2233|  8.02k|}
_ZNK5Exiv28Internal14TiffHeaderBase3tagEv:
 2239|  16.1k|uint16_t TiffHeaderBase::tag() const {
 2240|  16.1k|  return tag_;
 2241|  16.1k|}
_ZNK5Exiv28Internal14TiffHeaderBase10isImageTagEtNS_5IfdIdERKNSt3__16vectorIS2_NS3_9allocatorIS2_EEEE:
 2243|    768|bool TiffHeaderBase::isImageTag(uint16_t /*tag*/, IfdId /*group*/, const PrimaryGroups& /*primaryGroups*/) const {
 2244|    768|  return false;
 2245|    768|}
_ZN5Exiv28Internal14isTiffImageTagEtNS_5IfdIdE:
 2325|  2.69M|bool isTiffImageTag(uint16_t tag, IfdId group) {
 2326|  2.69M|  const bool result = isTiffImageTagLookup(tag, group);
 2327|       |#ifdef EXIV2_DEBUG_MESSAGES
 2328|       |  if (result) {
 2329|       |    ExifKey key(tag, groupName(group));
 2330|       |    std::cerr << "Image tag: " << key << " (3)\n";
 2331|       |  } else {
 2332|       |    std::cerr << "Not an image tag: " << tag << " (4)\n";
 2333|       |  }
 2334|       |#endif
 2335|  2.69M|  return result;
 2336|  2.69M|}
_ZN5Exiv28Internal10TiffHeaderC2ENS_9ByteOrderEjb:
 2339|   202k|    TiffHeaderBase(42, 8, byteOrder, offset), hasImageTags_(hasImageTags) {
 2340|   202k|}
_ZNK5Exiv28Internal10TiffHeader10isImageTagEtNS_5IfdIdERKNSt3__16vectorIS2_NS3_9allocatorIS2_EEEE:
 2342|  2.70M|bool TiffHeader::isImageTag(uint16_t tag, IfdId group, const PrimaryGroups& pPrimaryGroups) const {
 2343|  2.70M|  if (!hasImageTags_) {
  ------------------
  |  Branch (2343:7): [True: 43.7k, False: 2.66M]
  ------------------
 2344|       |#ifdef EXIV2_DEBUG_MESSAGES
 2345|       |    std::cerr << "No image tags in this image\n";
 2346|       |#endif
 2347|  43.7k|    return false;
 2348|  43.7k|  }
 2349|       |#ifdef EXIV2_DEBUG_MESSAGES
 2350|       |  ExifKey key(tag, groupName(group));
 2351|       |#endif
 2352|       |  // If there are primary groups and none matches group, we're done
 2353|  2.66M|  if (!pPrimaryGroups.empty() &&
  ------------------
  |  Branch (2353:7): [True: 56.2k, False: 2.60M]
  |  Branch (2353:7): [True: 24.7k, False: 2.63M]
  ------------------
 2354|  56.2k|      std::find(pPrimaryGroups.begin(), pPrimaryGroups.end(), group) == pPrimaryGroups.end()) {
  ------------------
  |  Branch (2354:7): [True: 24.7k, False: 31.5k]
  ------------------
 2355|       |#ifdef EXIV2_DEBUG_MESSAGES
 2356|       |    std::cerr << "Not an image tag: " << key << " (1)\n";
 2357|       |#endif
 2358|  24.7k|    return false;
 2359|  24.7k|  }
 2360|       |  // All tags of marked primary groups other than IFD0 are considered
 2361|       |  // image tags. That should take care of NEFs until we know better.
 2362|  2.63M|  if (!pPrimaryGroups.empty() && group != IfdId::ifd0Id) {
  ------------------
  |  Branch (2362:7): [True: 31.5k, False: 2.60M]
  |  Branch (2362:34): [True: 30.2k, False: 1.25k]
  ------------------
 2363|       |#ifdef EXIV2_DEBUG_MESSAGES
 2364|       |    ExifKey key(tag, groupName(group));
 2365|       |    std::cerr << "Image tag: " << key << " (2)\n";
 2366|       |#endif
 2367|  30.2k|    return true;
 2368|  30.2k|  }
 2369|       |  // Finally, if tag, group is one of the TIFF image tags -> bingo!
 2370|  2.60M|  return isTiffImageTag(tag, group);
 2371|  2.63M|}  // TiffHeader::isImageTag
_ZN5Exiv28Internal12OffsetWriter9setOriginENS1_8OffsetIdEjNS_9ByteOrderE:
 2373|    144|void OffsetWriter::setOrigin(OffsetId id, uint32_t origin, ByteOrder byteOrder) {
 2374|    144|  offsetList_[id] = OffsetData{origin, 0, byteOrder};
 2375|    144|}
_ZN5Exiv28Internal12OffsetWriter9setTargetENS1_8OffsetIdEj:
 2377|     14|void OffsetWriter::setTarget(OffsetId id, uint32_t target) {
 2378|     14|  auto it = offsetList_.find(id);
 2379|     14|  if (it != offsetList_.end())
  ------------------
  |  Branch (2379:7): [True: 14, False: 0]
  ------------------
 2380|     14|    it->second.target_ = target;
 2381|     14|}
_ZNK5Exiv28Internal12OffsetWriter12writeOffsetsERNS_7BasicIoE:
 2383|    118|void OffsetWriter::writeOffsets(BasicIo& io) const {
 2384|    118|  for (const auto& [_, off] : offsetList_) {
  ------------------
  |  Branch (2384:29): [True: 118, False: 118]
  ------------------
 2385|    118|    io.seek(off.origin_, BasicIo::beg);
 2386|    118|    byte buf[4] = {0, 0, 0, 0};
 2387|    118|    l2Data(buf, off.target_, off.byteOrder_);
 2388|    118|    io.write(buf, 4);
 2389|    118|  }
 2390|    118|}
tiffimage_int.cpp:_ZN5Exiv28InternalL20isTiffImageTagLookupEtNS_5IfdIdE:
 2247|  2.69M|static bool isTiffImageTagLookup(uint16_t tag, IfdId group) {
 2248|  2.69M|  if (group != IfdId::ifd0Id) {
  ------------------
  |  Branch (2248:7): [True: 2.37M, False: 318k]
  ------------------
 2249|  2.37M|    return false;
 2250|  2.37M|  }
 2251|       |  //! List of TIFF image tags
 2252|   318k|  switch (tag) {
 2253|    594|    case 0x00fe:  // Exif.Image.NewSubfileType
  ------------------
  |  Branch (2253:5): [True: 594, False: 317k]
  ------------------
 2254|  1.33k|    case 0x00ff:  // Exif.Image.SubfileType
  ------------------
  |  Branch (2254:5): [True: 740, False: 317k]
  ------------------
 2255|  7.66k|    case 0x0100:  // Exif.Image.ImageWidth
  ------------------
  |  Branch (2255:5): [True: 6.32k, False: 312k]
  ------------------
 2256|  12.9k|    case 0x0101:  // Exif.Image.ImageLength
  ------------------
  |  Branch (2256:5): [True: 5.30k, False: 313k]
  ------------------
 2257|  15.8k|    case 0x0102:  // Exif.Image.BitsPerSample
  ------------------
  |  Branch (2257:5): [True: 2.87k, False: 315k]
  ------------------
 2258|  16.1k|    case 0x0103:  // Exif.Image.Compression
  ------------------
  |  Branch (2258:5): [True: 350, False: 318k]
  ------------------
 2259|  16.4k|    case 0x0106:  // Exif.Image.PhotometricInterpretation
  ------------------
  |  Branch (2259:5): [True: 245, False: 318k]
  ------------------
 2260|  16.5k|    case 0x010a:  // Exif.Image.FillOrder
  ------------------
  |  Branch (2260:5): [True: 124, False: 318k]
  ------------------
 2261|  18.5k|    case 0x0111:  // Exif.Image.StripOffsets
  ------------------
  |  Branch (2261:5): [True: 2.03k, False: 316k]
  ------------------
 2262|  18.7k|    case 0x0115:  // Exif.Image.SamplesPerPixel
  ------------------
  |  Branch (2262:5): [True: 160, False: 318k]
  ------------------
 2263|  19.0k|    case 0x0116:  // Exif.Image.RowsPerStrip
  ------------------
  |  Branch (2263:5): [True: 331, False: 318k]
  ------------------
 2264|  20.9k|    case 0x0117:  // Exif.Image.StripByteCounts
  ------------------
  |  Branch (2264:5): [True: 1.86k, False: 316k]
  ------------------
 2265|  21.2k|    case 0x011a:  // Exif.Image.XResolution
  ------------------
  |  Branch (2265:5): [True: 283, False: 318k]
  ------------------
 2266|  21.5k|    case 0x011b:  // Exif.Image.YResolution
  ------------------
  |  Branch (2266:5): [True: 331, False: 318k]
  ------------------
 2267|  21.6k|    case 0x011c:  // Exif.Image.PlanarConfiguration
  ------------------
  |  Branch (2267:5): [True: 112, False: 318k]
  ------------------
 2268|  21.7k|    case 0x0122:  // Exif.Image.GrayResponseUnit
  ------------------
  |  Branch (2268:5): [True: 33, False: 318k]
  ------------------
 2269|  21.8k|    case 0x0123:  // Exif.Image.GrayResponseCurve
  ------------------
  |  Branch (2269:5): [True: 174, False: 318k]
  ------------------
 2270|  22.0k|    case 0x0124:  // Exif.Image.T4Options
  ------------------
  |  Branch (2270:5): [True: 127, False: 318k]
  ------------------
 2271|  22.2k|    case 0x0125:  // Exif.Image.T6Options
  ------------------
  |  Branch (2271:5): [True: 203, False: 318k]
  ------------------
 2272|  22.4k|    case 0x0128:  // Exif.Image.ResolutionUnit
  ------------------
  |  Branch (2272:5): [True: 237, False: 318k]
  ------------------
 2273|  22.7k|    case 0x0129:  // Exif.Image.PageNumber
  ------------------
  |  Branch (2273:5): [True: 297, False: 318k]
  ------------------
 2274|  22.9k|    case 0x012d:  // Exif.Image.TransferFunction
  ------------------
  |  Branch (2274:5): [True: 236, False: 318k]
  ------------------
 2275|  23.1k|    case 0x013d:  // Exif.Image.Predictor
  ------------------
  |  Branch (2275:5): [True: 196, False: 318k]
  ------------------
 2276|  23.2k|    case 0x013e:  // Exif.Image.WhitePoint
  ------------------
  |  Branch (2276:5): [True: 112, False: 318k]
  ------------------
 2277|  23.7k|    case 0x013f:  // Exif.Image.PrimaryChromaticities
  ------------------
  |  Branch (2277:5): [True: 452, False: 318k]
  ------------------
 2278|  23.9k|    case 0x0140:  // Exif.Image.ColorMap
  ------------------
  |  Branch (2278:5): [True: 219, False: 318k]
  ------------------
 2279|  24.0k|    case 0x0141:  // Exif.Image.HalftoneHints
  ------------------
  |  Branch (2279:5): [True: 112, False: 318k]
  ------------------
 2280|  24.2k|    case 0x0142:  // Exif.Image.TileWidth
  ------------------
  |  Branch (2280:5): [True: 202, False: 318k]
  ------------------
 2281|  24.3k|    case 0x0143:  // Exif.Image.TileLength
  ------------------
  |  Branch (2281:5): [True: 83, False: 318k]
  ------------------
 2282|  24.6k|    case 0x0144:  // Exif.Image.TileOffsets
  ------------------
  |  Branch (2282:5): [True: 290, False: 318k]
  ------------------
 2283|  25.3k|    case 0x0145:  // Exif.Image.TileByteCounts
  ------------------
  |  Branch (2283:5): [True: 706, False: 317k]
  ------------------
 2284|  25.3k|    case 0x014c:  // Exif.Image.InkSet
  ------------------
  |  Branch (2284:5): [True: 27, False: 318k]
  ------------------
 2285|  25.7k|    case 0x014d:  // Exif.Image.InkNames
  ------------------
  |  Branch (2285:5): [True: 385, False: 318k]
  ------------------
 2286|  25.8k|    case 0x014e:  // Exif.Image.NumberOfInks
  ------------------
  |  Branch (2286:5): [True: 52, False: 318k]
  ------------------
 2287|  26.0k|    case 0x0150:  // Exif.Image.DotRange
  ------------------
  |  Branch (2287:5): [True: 193, False: 318k]
  ------------------
 2288|  26.0k|    case 0x0151:  // Exif.Image.TargetPrinter
  ------------------
  |  Branch (2288:5): [True: 79, False: 318k]
  ------------------
 2289|  26.1k|    case 0x0152:  // Exif.Image.ExtraSamples
  ------------------
  |  Branch (2289:5): [True: 68, False: 318k]
  ------------------
 2290|  26.3k|    case 0x0153:  // Exif.Image.SampleFormat
  ------------------
  |  Branch (2290:5): [True: 145, False: 318k]
  ------------------
 2291|  26.4k|    case 0x0154:  // Exif.Image.SMinSampleValue
  ------------------
  |  Branch (2291:5): [True: 105, False: 318k]
  ------------------
 2292|  26.5k|    case 0x0155:  // Exif.Image.SMaxSampleValue
  ------------------
  |  Branch (2292:5): [True: 101, False: 318k]
  ------------------
 2293|  26.5k|    case 0x0156:  // Exif.Image.TransferRange
  ------------------
  |  Branch (2293:5): [True: 82, False: 318k]
  ------------------
 2294|  26.6k|    case 0x0157:  // Exif.Image.ClipPath
  ------------------
  |  Branch (2294:5): [True: 40, False: 318k]
  ------------------
 2295|  26.8k|    case 0x0158:  // Exif.Image.XClipPathUnits
  ------------------
  |  Branch (2295:5): [True: 179, False: 318k]
  ------------------
 2296|  26.8k|    case 0x0159:  // Exif.Image.YClipPathUnits
  ------------------
  |  Branch (2296:5): [True: 78, False: 318k]
  ------------------
 2297|  26.9k|    case 0x015a:  // Exif.Image.Indexed
  ------------------
  |  Branch (2297:5): [True: 53, False: 318k]
  ------------------
 2298|  27.0k|    case 0x015b:  // Exif.Image.JPEGTables
  ------------------
  |  Branch (2298:5): [True: 150, False: 318k]
  ------------------
 2299|  28.2k|    case 0x0200:  // Exif.Image.JPEGProc
  ------------------
  |  Branch (2299:5): [True: 1.17k, False: 317k]
  ------------------
 2300|  33.2k|    case 0x0201:  // Exif.Image.JPEGInterchangeFormat
  ------------------
  |  Branch (2300:5): [True: 4.93k, False: 313k]
  ------------------
 2301|  38.6k|    case 0x0202:  // Exif.Image.JPEGInterchangeFormatLength
  ------------------
  |  Branch (2301:5): [True: 5.43k, False: 313k]
  ------------------
 2302|  38.7k|    case 0x0203:  // Exif.Image.JPEGRestartInterval
  ------------------
  |  Branch (2302:5): [True: 140, False: 318k]
  ------------------
 2303|  38.8k|    case 0x0205:  // Exif.Image.JPEGLosslessPredictors
  ------------------
  |  Branch (2303:5): [True: 69, False: 318k]
  ------------------
 2304|  38.9k|    case 0x0206:  // Exif.Image.JPEGPointTransforms
  ------------------
  |  Branch (2304:5): [True: 98, False: 318k]
  ------------------
 2305|  39.0k|    case 0x0207:  // Exif.Image.JPEGQTables
  ------------------
  |  Branch (2305:5): [True: 79, False: 318k]
  ------------------
 2306|  39.2k|    case 0x0208:  // Exif.Image.JPEGDCTables
  ------------------
  |  Branch (2306:5): [True: 201, False: 318k]
  ------------------
 2307|  39.3k|    case 0x0209:  // Exif.Image.JPEGACTables
  ------------------
  |  Branch (2307:5): [True: 106, False: 318k]
  ------------------
 2308|  39.4k|    case 0x0211:  // Exif.Image.YCbCrCoefficients
  ------------------
  |  Branch (2308:5): [True: 71, False: 318k]
  ------------------
 2309|  39.5k|    case 0x0212:  // Exif.Image.YCbCrSubSampling
  ------------------
  |  Branch (2309:5): [True: 149, False: 318k]
  ------------------
 2310|  39.5k|    case 0x0213:  // Exif.Image.YCbCrPositioning
  ------------------
  |  Branch (2310:5): [True: 33, False: 318k]
  ------------------
 2311|  39.7k|    case 0x0214:  // Exif.Image.ReferenceBlackWhite
  ------------------
  |  Branch (2311:5): [True: 138, False: 318k]
  ------------------
 2312|  39.8k|    case 0x828d:  // Exif.Image.CFARepeatPatternDim
  ------------------
  |  Branch (2312:5): [True: 86, False: 318k]
  ------------------
 2313|  39.8k|    case 0x828e:  // Exif.Image.CFAPattern
  ------------------
  |  Branch (2313:5): [True: 16, False: 318k]
  ------------------
 2314|       |    // case 0x8773:  // Exif.Image.InterColorProfile
 2315|  39.8k|    case 0x8824:  // Exif.Image.SpectralSensitivity
  ------------------
  |  Branch (2315:5): [True: 34, False: 318k]
  ------------------
 2316|  39.8k|    case 0x8828:  // Exif.Image.OECF
  ------------------
  |  Branch (2316:5): [True: 35, False: 318k]
  ------------------
 2317|  39.9k|    case 0x9102:  // Exif.Image.CompressedBitsPerPixel
  ------------------
  |  Branch (2317:5): [True: 72, False: 318k]
  ------------------
 2318|  40.1k|    case 0x9217:  // Exif.Image.SensingMethod
  ------------------
  |  Branch (2318:5): [True: 172, False: 318k]
  ------------------
 2319|  40.1k|      return true;
 2320|   278k|    default:
  ------------------
  |  Branch (2320:5): [True: 278k, False: 40.1k]
  ------------------
 2321|   278k|      return false;
 2322|   318k|  }
 2323|   318k|}

_ZN5Exiv28Internal13FindExifdatumC2ENS_5IfdIdE:
  359|  53.9k|  explicit FindExifdatum(Exiv2::IfdId ifdId) : ifdId_(ifdId) {
  360|  53.9k|  }
_ZNK5Exiv28Internal17TiffGroupKey_hashclENSt3__14pairIjNS_5IfdIdEEE:
  151|  22.0M|  std::size_t operator()(TiffGroupKey pair) const noexcept {
  152|  22.0M|    return std::hash<uint64_t>{}(static_cast<uint64_t>(pair.first) << 32 | static_cast<uint64_t>(pair.second));
  153|  22.0M|  }
_ZN5Exiv28Internal14TiffHeaderBaseD2Ev:
   49|  7.57k|  virtual ~TiffHeaderBase() = default;

_ZN5Exiv28Internal11TiffVisitor5setGoENS1_7GoEventEb:
   61|   888k|void TiffVisitor::setGo(GoEvent event, bool go) {
   62|   888k|  go_[event] = go;
   63|   888k|}
_ZNK5Exiv28Internal11TiffVisitor2goENS1_7GoEventE:
   65|  80.5M|bool TiffVisitor::go(GoEvent event) const {
   66|  80.5M|  return go_[event];
   67|  80.5M|}
_ZN5Exiv28Internal11TiffVisitor18visitDirectoryNextEPNS0_13TiffDirectoryE:
   69|   890k|void TiffVisitor::visitDirectoryNext(TiffDirectory* /*object*/) {
   70|   890k|}
_ZN5Exiv28Internal11TiffVisitor17visitDirectoryEndEPNS0_13TiffDirectoryE:
   72|   878k|void TiffVisitor::visitDirectoryEnd(TiffDirectory* /*object*/) {
   73|   878k|}
_ZN5Exiv28Internal11TiffVisitor20visitIfdMakernoteEndEPNS0_16TiffIfdMakernoteE:
   75|  37.8k|void TiffVisitor::visitIfdMakernoteEnd(TiffIfdMakernote* /*object*/) {
   76|  37.8k|}
_ZN5Exiv28Internal11TiffVisitor19visitBinaryArrayEndEPNS0_15TiffBinaryArrayE:
   78|   111k|void TiffVisitor::visitBinaryArrayEnd(TiffBinaryArray* /*object*/) {
   79|   111k|}
_ZN5Exiv28Internal10TiffFinder4initEtNS_5IfdIdE:
   81|    229|void TiffFinder::init(uint16_t tag, IfdId group) {
   82|    229|  tag_ = tag;
   83|    229|  group_ = group;
   84|    229|  tiffComponent_ = nullptr;
   85|    229|  setGo(geTraverse, true);
   86|    229|}
_ZN5Exiv28Internal10TiffFinder10findObjectEPNS0_13TiffComponentE:
   88|  31.2M|void TiffFinder::findObject(TiffComponent* object) {
   89|  31.2M|  if (object->tag() == tag_ && object->group() == group_) {
  ------------------
  |  Branch (89:7): [True: 443k, False: 30.8M]
  |  Branch (89:32): [True: 110k, False: 333k]
  ------------------
   90|   110k|    tiffComponent_ = object;
   91|   110k|    setGo(geTraverse, false);
   92|   110k|  }
   93|  31.2M|}
_ZN5Exiv28Internal10TiffFinder10visitEntryEPNS0_9TiffEntryE:
   95|  17.8M|void TiffFinder::visitEntry(TiffEntry* object) {
   96|  17.8M|  findObject(object);
   97|  17.8M|}
_ZN5Exiv28Internal10TiffFinder14visitDataEntryEPNS0_13TiffDataEntryE:
   99|   137k|void TiffFinder::visitDataEntry(TiffDataEntry* object) {
  100|   137k|  findObject(object);
  101|   137k|}
_ZN5Exiv28Internal10TiffFinder15visitImageEntryEPNS0_14TiffImageEntryE:
  103|  1.26M|void TiffFinder::visitImageEntry(TiffImageEntry* object) {
  104|  1.26M|  findObject(object);
  105|  1.26M|}
_ZN5Exiv28Internal10TiffFinder14visitSizeEntryEPNS0_13TiffSizeEntryE:
  107|  1.08M|void TiffFinder::visitSizeEntry(TiffSizeEntry* object) {
  108|  1.08M|  findObject(object);
  109|  1.08M|}
_ZN5Exiv28Internal10TiffFinder14visitDirectoryEPNS0_13TiffDirectoryE:
  111|   917k|void TiffFinder::visitDirectory(TiffDirectory* object) {
  112|   917k|  findObject(object);
  113|   917k|}
_ZN5Exiv28Internal10TiffFinder11visitSubIfdEPNS0_10TiffSubIfdE:
  115|   170k|void TiffFinder::visitSubIfd(TiffSubIfd* object) {
  116|   170k|  findObject(object);
  117|   170k|}
_ZN5Exiv28Internal10TiffFinder12visitMnEntryEPNS0_11TiffMnEntryE:
  119|   158k|void TiffFinder::visitMnEntry(TiffMnEntry* object) {
  120|   158k|  findObject(object);
  121|   158k|}
_ZN5Exiv28Internal10TiffFinder17visitIfdMakernoteEPNS0_16TiffIfdMakernoteE:
  123|  46.1k|void TiffFinder::visitIfdMakernote(TiffIfdMakernote* object) {
  124|  46.1k|  findObject(object);
  125|  46.1k|}
_ZN5Exiv28Internal10TiffFinder16visitBinaryArrayEPNS0_15TiffBinaryArrayE:
  127|  90.4k|void TiffFinder::visitBinaryArray(TiffBinaryArray* object) {
  128|  90.4k|  findObject(object);
  129|  90.4k|}
_ZN5Exiv28Internal10TiffFinder18visitBinaryElementEPNS0_17TiffBinaryElementE:
  131|  9.54M|void TiffFinder::visitBinaryElement(TiffBinaryElement* object) {
  132|  9.54M|  findObject(object);
  133|  9.54M|}
_ZN5Exiv28Internal10TiffCopierC2EPNS0_13TiffComponentEjPKNS0_14TiffHeaderBaseENSt3__16vectorINS_5IfdIdENS7_9allocatorIS9_EEEE:
  137|  3.68k|    pRoot_(pRoot), root_(root), pHeader_(pHeader), pPrimaryGroups_(std::move(pPrimaryGroups)) {
  138|  3.68k|}
_ZN5Exiv28Internal10TiffCopier10copyObjectEPKNS0_13TiffComponentE:
  140|  1.00M|void TiffCopier::copyObject(const TiffComponent* object) {
  141|  1.00M|  if (pHeader_->isImageTag(object->tag(), object->group(), pPrimaryGroups_)) {
  ------------------
  |  Branch (141:7): [True: 32.2k, False: 977k]
  ------------------
  142|  32.2k|    auto clone = object->clone();
  143|       |    // Assumption is that the corresponding TIFF entry doesn't exist
  144|  32.2k|    auto tiffPath = TiffCreator::getPath(object->tag(), object->group(), root_);
  145|  32.2k|    pRoot_->addPath(object->tag(), tiffPath, pRoot_, std::move(clone));
  146|       |#ifdef EXIV2_DEBUG_MESSAGES
  147|       |    ExifKey key(object->tag(), groupName(object->group()));
  148|       |    std::cerr << "Copied " << key << "\n";
  149|       |#endif
  150|  32.2k|  }
  151|  1.00M|}
_ZN5Exiv28Internal10TiffCopier10visitEntryEPNS0_9TiffEntryE:
  153|   307k|void TiffCopier::visitEntry(TiffEntry* object) {
  154|   307k|  copyObject(object);
  155|   307k|}
_ZN5Exiv28Internal10TiffCopier14visitDataEntryEPNS0_13TiffDataEntryE:
  157|  4.17k|void TiffCopier::visitDataEntry(TiffDataEntry* object) {
  158|  4.17k|  copyObject(object);
  159|  4.17k|}
_ZN5Exiv28Internal10TiffCopier15visitImageEntryEPNS0_14TiffImageEntryE:
  161|  7.75k|void TiffCopier::visitImageEntry(TiffImageEntry* object) {
  162|  7.75k|  copyObject(object);
  163|  7.75k|}
_ZN5Exiv28Internal10TiffCopier14visitSizeEntryEPNS0_13TiffSizeEntryE:
  165|  10.5k|void TiffCopier::visitSizeEntry(TiffSizeEntry* object) {
  166|  10.5k|  copyObject(object);
  167|  10.5k|}
_ZN5Exiv28Internal10TiffCopier14visitDirectoryEPNS0_13TiffDirectoryE:
  169|  13.7k|void TiffCopier::visitDirectory(TiffDirectory* /*object*/) {
  170|       |  // Do not copy directories (avoids problems with SubIfds)
  171|  13.7k|}
_ZN5Exiv28Internal10TiffCopier11visitSubIfdEPNS0_10TiffSubIfdE:
  173|  3.54k|void TiffCopier::visitSubIfd(TiffSubIfd* object) {
  174|  3.54k|  copyObject(object);
  175|  3.54k|}
_ZN5Exiv28Internal10TiffCopier12visitMnEntryEPNS0_11TiffMnEntryE:
  177|  6.59k|void TiffCopier::visitMnEntry(TiffMnEntry* object) {
  178|  6.59k|  copyObject(object);
  179|  6.59k|}
_ZN5Exiv28Internal10TiffCopier17visitIfdMakernoteEPNS0_16TiffIfdMakernoteE:
  181|  1.78k|void TiffCopier::visitIfdMakernote(TiffIfdMakernote* object) {
  182|  1.78k|  copyObject(object);
  183|  1.78k|}
_ZN5Exiv28Internal10TiffCopier16visitBinaryArrayEPNS0_15TiffBinaryArrayE:
  185|  4.18k|void TiffCopier::visitBinaryArray(TiffBinaryArray* object) {
  186|  4.18k|  copyObject(object);
  187|  4.18k|}
_ZN5Exiv28Internal10TiffCopier18visitBinaryElementEPNS0_17TiffBinaryElementE:
  189|   662k|void TiffCopier::visitBinaryElement(TiffBinaryElement* object) {
  190|   662k|  copyObject(object);
  191|   662k|}
_ZN5Exiv28Internal11TiffDecoderC2ERNS_8ExifDataERNS_8IptcDataERNS_7XmpDataEPNS0_13TiffComponentEPFMS1_FvPKNS0_13TiffEntryBaseEENSt3__117basic_string_viewIcNSF_11char_traitsIcEEEEjNS_5IfdIdEERKNS_12DecodeParamsE:
  195|  14.0k|    exifData_(exifData),
  196|  14.0k|    iptcData_(iptcData),
  197|  14.0k|    xmpData_(xmpData),
  198|  14.0k|    pRoot_(pRoot),
  199|  14.0k|    findDecoderFct_(findDecoderFct),
  200|  14.0k|    max_recursion_depth_(dp.max_recursion_depth()) {
  201|       |  // #1402 Fujifilm RAF. Search for the make
  202|       |  // Find camera make in existing metadata (read from the JPEG)
  203|  14.0k|  ExifKey key("Exif.Image.Make");
  204|  14.0k|  if (exifData_.findKey(key) != exifData_.end()) {
  ------------------
  |  Branch (204:7): [True: 152, False: 13.8k]
  ------------------
  205|    152|    make_ = exifData_.findKey(key)->toString();
  206|  13.8k|  } else {
  207|       |    // Find camera make by looking for tag 0x010f in IFD0
  208|  13.8k|    TiffFinder finder(0x010f, IfdId::ifd0Id);
  209|  13.8k|    pRoot_->accept(finder);
  210|  13.8k|    auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
  211|  13.8k|    if (te && te->pValue()) {
  ------------------
  |  Branch (211:9): [True: 2.39k, False: 11.4k]
  |  Branch (211:15): [True: 2.22k, False: 167]
  ------------------
  212|  2.22k|      make_ = te->pValue()->toString();
  213|  2.22k|    }
  214|  13.8k|  }
  215|  14.0k|}
_ZN5Exiv28Internal11TiffDecoder10visitEntryEPNS0_9TiffEntryE:
  217|  1.92M|void TiffDecoder::visitEntry(TiffEntry* object) {
  218|  1.92M|  decodeTiffEntry(object);
  219|  1.92M|}
_ZN5Exiv28Internal11TiffDecoder14visitDataEntryEPNS0_13TiffDataEntryE:
  221|  5.12k|void TiffDecoder::visitDataEntry(TiffDataEntry* object) {
  222|  5.12k|  decodeTiffEntry(object);
  223|  5.12k|}
_ZN5Exiv28Internal11TiffDecoder15visitImageEntryEPNS0_14TiffImageEntryE:
  225|  30.6k|void TiffDecoder::visitImageEntry(TiffImageEntry* object) {
  226|  30.6k|  decodeTiffEntry(object);
  227|  30.6k|}
_ZN5Exiv28Internal11TiffDecoder14visitSizeEntryEPNS0_13TiffSizeEntryE:
  229|  37.4k|void TiffDecoder::visitSizeEntry(TiffSizeEntry* object) {
  230|  37.4k|  decodeTiffEntry(object);
  231|  37.4k|}
_ZN5Exiv28Internal11TiffDecoder14visitDirectoryEPNS0_13TiffDirectoryE:
  233|  66.5k|void TiffDecoder::visitDirectory(TiffDirectory* /* object */) {
  234|       |  // Nothing to do
  235|  66.5k|}
_ZN5Exiv28Internal11TiffDecoder11visitSubIfdEPNS0_10TiffSubIfdE:
  237|  12.4k|void TiffDecoder::visitSubIfd(TiffSubIfd* object) {
  238|  12.4k|  decodeTiffEntry(object);
  239|  12.4k|}
_ZN5Exiv28Internal11TiffDecoder12visitMnEntryEPNS0_11TiffMnEntryE:
  241|  8.25k|void TiffDecoder::visitMnEntry(TiffMnEntry* object) {
  242|       |  // Always decode binary makernote tag
  243|  8.25k|  decodeTiffEntry(object);
  244|  8.25k|}
_ZN5Exiv28Internal11TiffDecoder17visitIfdMakernoteEPNS0_16TiffIfdMakernoteE:
  246|  2.91k|void TiffDecoder::visitIfdMakernote(TiffIfdMakernote* object) {
  247|  2.91k|  exifData_["Exif.MakerNote.Offset"] = static_cast<uint32_t>(object->mnOffset());
  248|  2.91k|  switch (object->byteOrder()) {
  ------------------
  |  Branch (248:11): [True: 2.91k, False: 0]
  ------------------
  249|    370|    case littleEndian:
  ------------------
  |  Branch (249:5): [True: 370, False: 2.54k]
  ------------------
  250|    370|      exifData_["Exif.MakerNote.ByteOrder"] = "II";
  251|    370|      break;
  252|  2.54k|    case bigEndian:
  ------------------
  |  Branch (252:5): [True: 2.54k, False: 370]
  ------------------
  253|  2.54k|      exifData_["Exif.MakerNote.ByteOrder"] = "MM";
  254|  2.54k|      break;
  255|      0|    case invalidByteOrder:
  ------------------
  |  Branch (255:5): [True: 0, False: 2.91k]
  ------------------
  256|      0|      break;
  257|  2.91k|  }
  258|  2.91k|}
_ZN5Exiv28Internal11TiffDecoder10getObjDataERPKhRmtNS_5IfdIdEPKNS0_13TiffEntryBaseE:
  260|  4.43k|void TiffDecoder::getObjData(const byte*& pData, size_t& size, uint16_t tag, IfdId group, const TiffEntryBase* object) {
  261|  4.43k|  if (object && object->tag() == tag && object->group() == group) {
  ------------------
  |  Branch (261:7): [True: 4.43k, False: 0]
  |  Branch (261:17): [True: 3.76k, False: 670]
  |  Branch (261:41): [True: 3.76k, False: 0]
  ------------------
  262|  3.76k|    pData = object->pData();
  263|  3.76k|    size = object->size();
  264|  3.76k|    return;
  265|  3.76k|  }
  266|    670|  TiffFinder finder(tag, group);
  267|    670|  pRoot_->accept(finder);
  268|    670|  if (auto te = dynamic_cast<const TiffEntryBase*>(finder.result())) {
  ------------------
  |  Branch (268:12): [True: 52, False: 618]
  ------------------
  269|     52|    pData = te->pData();
  270|     52|    size = te->size();
  271|     52|    return;
  272|     52|  }
  273|    670|}
_ZN5Exiv28Internal11TiffDecoder9decodeXmpEPKNS0_13TiffEntryBaseE:
  275|  2.69k|void TiffDecoder::decodeXmp(const TiffEntryBase* object) {
  276|       |  // add Exif tag anyway
  277|  2.69k|  decodeStdTiffEntry(object);
  278|       |
  279|  2.69k|  const byte* pData = nullptr;
  280|  2.69k|  size_t size = 0;
  281|  2.69k|  getObjData(pData, size, 0x02bc, IfdId::ifd0Id, object);
  282|  2.69k|  if (pData) {
  ------------------
  |  Branch (282:7): [True: 2.69k, False: 0]
  ------------------
  283|  2.69k|    std::string xmpPacket;
  284|  2.69k|    xmpPacket.assign(reinterpret_cast<const char*>(pData), size);
  285|  2.69k|    std::string::size_type idx = xmpPacket.find_first_of('<');
  286|  2.69k|    if (idx != std::string::npos && idx > 0) {
  ------------------
  |  Branch (286:9): [True: 2.21k, False: 479]
  |  Branch (286:37): [True: 2.18k, False: 37]
  ------------------
  287|  2.18k|#ifndef SUPPRESS_WARNINGS
  288|  2.18k|      EXV_WARNING << "Removing " << idx << " characters from the beginning of the XMP packet\n";
  ------------------
  |  |  138|  2.18k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 2.18k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  2.18k|  LogMsg(LogMsg::warn).os()
  ------------------
  289|  2.18k|#endif
  290|  2.18k|      xmpPacket = xmpPacket.substr(idx);
  291|  2.18k|    }
  292|  2.69k|    const DecodeParams dp(max_recursion_depth_);
  293|  2.69k|    if (XmpParser::decode(xmpData_, xmpPacket, dp)) {
  ------------------
  |  Branch (293:9): [True: 1.20k, False: 1.49k]
  ------------------
  294|  1.20k|#ifndef SUPPRESS_WARNINGS
  295|  1.20k|      EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|  1.20k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 1.20k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  1.20k|  LogMsg(LogMsg::warn).os()
  ------------------
  296|  1.20k|#endif
  297|  1.20k|    }
  298|  2.69k|  }
  299|  2.69k|}  // TiffDecoder::decodeXmp
_ZN5Exiv28Internal11TiffDecoder10decodeIptcEPKNS0_13TiffEntryBaseE:
  301|  1.40k|void TiffDecoder::decodeIptc(const TiffEntryBase* object) {
  302|       |  // add Exif tag anyway
  303|  1.40k|  decodeStdTiffEntry(object);
  304|       |
  305|       |  // All tags are read at this point, so the first time we come here,
  306|       |  // find the relevant IPTC tag and decode IPTC if found
  307|  1.40k|  if (decodedIptc_) {
  ------------------
  |  Branch (307:7): [True: 325, False: 1.08k]
  ------------------
  308|    325|    return;
  309|    325|  }
  310|  1.08k|  decodedIptc_ = true;
  311|       |  // 1st choice: IPTCNAA
  312|  1.08k|  const byte* pData = nullptr;
  313|  1.08k|  size_t size = 0;
  314|  1.08k|  getObjData(pData, size, 0x83bb, IfdId::ifd0Id, object);
  315|  1.08k|  if (pData) {
  ------------------
  |  Branch (315:7): [True: 674, False: 410]
  ------------------
  316|    674|    if (0 == IptcParser::decode(iptcData_, pData, size)) {
  ------------------
  |  Branch (316:9): [True: 427, False: 247]
  ------------------
  317|    427|      return;
  318|    427|    }
  319|    247|#ifndef SUPPRESS_WARNINGS
  320|    247|    EXV_WARNING << "Failed to decode IPTC block found in " << "Directory Image, entry 0x83bb\n";
  ------------------
  |  |  138|    247|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 247]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    247|  LogMsg(LogMsg::warn).os()
  ------------------
  321|       |
  322|    247|#endif
  323|    247|  }
  324|       |
  325|       |  // 2nd choice if no IPTCNAA record found or failed to decode it:
  326|       |  // ImageResources
  327|    657|  pData = nullptr;
  328|    657|  size = 0;
  329|    657|  getObjData(pData, size, 0x8649, IfdId::ifd0Id, object);
  330|    657|  if (pData) {
  ------------------
  |  Branch (330:7): [True: 426, False: 231]
  ------------------
  331|    426|    const byte* record = nullptr;
  332|    426|    uint32_t sizeHdr = 0;
  333|    426|    uint32_t sizeData = 0;
  334|    426|    if (0 != Photoshop::locateIptcIrb(pData, size, &record, sizeHdr, sizeData)) {
  ------------------
  |  Branch (334:9): [True: 406, False: 20]
  ------------------
  335|    406|      return;
  336|    406|    }
  337|     20|    if (0 == IptcParser::decode(iptcData_, record + sizeHdr, sizeData)) {
  ------------------
  |  Branch (337:9): [True: 13, False: 7]
  ------------------
  338|     13|      return;
  339|     13|    }
  340|      7|#ifndef SUPPRESS_WARNINGS
  341|      7|    EXV_WARNING << "Failed to decode IPTC block found in " << "Directory Image, entry 0x8649\n";
  ------------------
  |  |  138|      7|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 7]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|      7|  LogMsg(LogMsg::warn).os()
  ------------------
  342|       |
  343|      7|#endif
  344|      7|  }
  345|    657|}  // TiffMetadataDecoder::decodeIptc
_ZN5Exiv28Internal11TiffDecoder17decodeCanonAFInfoEPKNS0_13TiffEntryBaseE:
  353|    969|void TiffDecoder::decodeCanonAFInfo(const TiffEntryBase* object) {
  354|       |  // report Exif.Canon.AFInfo as usual
  355|    969|  TiffDecoder::decodeStdTiffEntry(object);
  356|    969|  if (object->pValue()->count() < 3 || object->pValue()->typeId() != unsignedShort)
  ------------------
  |  Branch (356:7): [True: 183, False: 786]
  |  Branch (356:40): [True: 33, False: 753]
  ------------------
  357|    216|    return;  // insufficient data
  358|       |
  359|       |  // create vector of signedShorts from unsignedShorts in Exif.Canon.AFInfo
  360|    753|  std::vector<int16_t> ints;
  361|    753|  std::vector<uint16_t> uint;
  362|   102k|  for (size_t i = 0; i < object->pValue()->count(); i++) {
  ------------------
  |  Branch (362:22): [True: 101k, False: 753]
  ------------------
  363|   101k|    ints.push_back(object->pValue()->toInt64(i));
  364|   101k|    uint.push_back(object->pValue()->toUint32(i));
  365|   101k|  }
  366|       |  // Check this is AFInfo2 (ints[0] = bytes in object)
  367|    753|  if (ints.front() != static_cast<int16_t>(object->pValue()->count()) * 2)
  ------------------
  |  Branch (367:7): [True: 174, False: 579]
  ------------------
  368|    174|    return;
  369|       |
  370|    579|  std::string familyGroup(std::string("Exif.") + groupName(object->group()) + ".");
  371|       |
  372|    579|  const uint16_t nPoints = uint.at(2);
  373|    579|  const uint16_t nMasks = (nPoints + 15) / (sizeof(uint16_t) * 8);
  374|    579|  int nStart = 0;
  375|       |
  376|    579|  const std::tuple<uint16_t, uint16_t, bool> records[] = {
  377|    579|      {0x2600, 1, true},        // AFInfoSize
  378|    579|      {0x2601, 1, true},        // AFAreaMode
  379|    579|      {0x2602, 1, true},        // AFNumPoints
  380|    579|      {0x2603, 1, true},        // AFValidPoints
  381|    579|      {0x2604, 1, true},        // AFCanonImageWidth
  382|    579|      {0x2605, 1, true},        // AFCanonImageHeight
  383|    579|      {0x2606, 1, true},        // AFImageWidth"
  384|    579|      {0x2607, 1, true},        // AFImageHeight
  385|    579|      {0x2608, nPoints, true},  // AFAreaWidths
  386|    579|      {0x2609, nPoints, true},  // AFAreaHeights
  387|    579|      {0x260a, nPoints, true},  // AFXPositions
  388|    579|      {0x260b, nPoints, true},  // AFYPositions
  389|    579|      {0x260c, nMasks, false},  // AFPointsInFocus
  390|    579|      {0x260d, nMasks, false},  // AFPointsSelected
  391|    579|      {0x260e, nMasks, false},  // AFPointsUnusable
  392|    579|  };
  393|       |  // check we have enough data!
  394|    579|  uint16_t count = 0;
  395|  7.39k|  for (const auto& [tag, size, bSigned] : records) {
  ------------------
  |  Branch (395:41): [True: 7.39k, False: 288]
  ------------------
  396|  7.39k|    count += size;
  397|  7.39k|    if (count > ints.size())
  ------------------
  |  Branch (397:9): [True: 291, False: 7.10k]
  ------------------
  398|    291|      return;
  399|  7.39k|  }
  400|       |
  401|  4.32k|  for (const auto& [tag, size, bSigned] : records) {
  ------------------
  |  Branch (401:41): [True: 4.32k, False: 288]
  ------------------
  402|  4.32k|    auto pTags = ExifTags::tagList("Canon");
  403|  4.32k|    if (auto pTag = findTag(pTags, tag)) {
  ------------------
  |  Branch (403:14): [True: 4.32k, False: 0]
  ------------------
  404|  4.32k|      auto v = Exiv2::Value::create(bSigned ? Exiv2::signedShort : Exiv2::unsignedShort);
  ------------------
  |  Branch (404:37): [True: 3.45k, False: 864]
  ------------------
  405|  4.32k|      std::string s;
  406|  4.32k|      if (bSigned) {
  ------------------
  |  Branch (406:11): [True: 3.45k, False: 864]
  ------------------
  407|  23.0k|        for (uint16_t k = 0; k < size; k++)
  ------------------
  |  Branch (407:30): [True: 19.6k, False: 3.45k]
  ------------------
  408|  19.6k|          s += stringFormat(" {}", ints.at(nStart++));
  ------------------
  |  |   18|  19.6k|#define stringFormat std::format
  ------------------
  409|  3.45k|      } else {
  410|  1.99k|        for (uint16_t k = 0; k < size; k++)
  ------------------
  |  Branch (410:30): [True: 1.13k, False: 864]
  ------------------
  411|  1.13k|          s += stringFormat(" {}", uint.at(nStart++));
  ------------------
  |  |   18|  1.13k|#define stringFormat std::format
  ------------------
  412|    864|      }
  413|       |
  414|  4.32k|      v->read(s);
  415|  4.32k|      exifData_[familyGroup + pTag->name_] = *v;
  416|  4.32k|    }
  417|  4.32k|  }
  418|    288|}
_ZN5Exiv28Internal11TiffDecoder15decodeTiffEntryEPKNS0_13TiffEntryBaseE:
  420|  2.74M|void TiffDecoder::decodeTiffEntry(const TiffEntryBase* object) {
  421|       |  // Don't decode the entry if value is not set
  422|  2.74M|  if (!object->pValue())
  ------------------
  |  Branch (422:7): [True: 1.06M, False: 1.67M]
  ------------------
  423|  1.06M|    return;
  424|       |
  425|       |  // skip decoding if decoderFct == 0
  426|  1.67M|  if (auto decoderFct = findDecoderFct_(make_, object->tag(), object->group()))
  ------------------
  |  Branch (426:12): [True: 1.67M, False: 0]
  ------------------
  427|  1.67M|    std::invoke(decoderFct, *this, object);
  428|  1.67M|}  // TiffDecoder::decodeTiffEntry
_ZN5Exiv28Internal11TiffDecoder18decodeStdTiffEntryEPKNS0_13TiffEntryBaseE:
  430|  1.67M|void TiffDecoder::decodeStdTiffEntry(const TiffEntryBase* object) {
  431|  1.67M|  ExifKey key(object->tag(), groupName(object->group()));
  432|  1.67M|  key.setIdx(object->idx());
  433|  1.67M|  exifData_.add(key, object->pValue());
  434|       |
  435|  1.67M|}  // TiffDecoder::decodeTiffEntry
_ZN5Exiv28Internal11TiffDecoder16visitBinaryArrayEPNS0_15TiffBinaryArrayE:
  437|  5.98k|void TiffDecoder::visitBinaryArray(TiffBinaryArray* object) {
  438|  5.98k|  if (!object->cfg() || !object->decoded()) {
  ------------------
  |  Branch (438:7): [True: 969, False: 5.01k]
  |  Branch (438:25): [True: 3.40k, False: 1.60k]
  ------------------
  439|  4.37k|    decodeTiffEntry(object);
  440|  4.37k|  }
  441|  5.98k|}
_ZN5Exiv28Internal11TiffDecoder18visitBinaryElementEPNS0_17TiffBinaryElementE:
  443|   721k|void TiffDecoder::visitBinaryElement(TiffBinaryElement* object) {
  444|   721k|  decodeTiffEntry(object);
  445|   721k|}
_ZN5Exiv28Internal11TiffEncoderC2ENS_8ExifDataERKNS_8IptcDataERKNS_7XmpDataEPNS0_13TiffComponentEbNSt3__16vectorINS_5IfdIdENSB_9allocatorISD_EEEEPKNS0_14TiffHeaderBaseEPFMS1_FvPNS0_13TiffEntryBaseEPKNS_9ExifdatumEENSB_17basic_string_viewIcNSB_11char_traitsIcEEEEjSD_E:
  450|  15.0k|    exifData_(std::move(exifData)),
  451|  15.0k|    iptcData_(iptcData),
  452|  15.0k|    xmpData_(xmpData),
  453|  15.0k|    pHeader_(pHeader),
  454|  15.0k|    pRoot_(pRoot),
  455|  15.0k|    isNewImage_(isNewImage),
  456|  15.0k|    pPrimaryGroups_(std::move(pPrimaryGroups)),
  457|  15.0k|    byteOrder_(pHeader->byteOrder()),
  458|  15.0k|    origByteOrder_(byteOrder_),
  459|  15.0k|    findEncoderFct_(findEncoderFct) {
  460|  15.0k|  encodeIptc();
  461|  15.0k|  encodeXmp();
  462|       |
  463|       |  // Find camera make
  464|  15.0k|  ExifKey key("Exif.Image.Make");
  465|  15.0k|  if (auto pos = exifData_.findKey(key); pos != exifData_.end()) {
  ------------------
  |  Branch (465:42): [True: 7.34k, False: 7.66k]
  ------------------
  466|  7.34k|    make_ = pos->toString();
  467|  7.34k|  }
  468|  15.0k|  if (make_.empty() && pRoot_) {
  ------------------
  |  Branch (468:7): [True: 8.20k, False: 6.79k]
  |  Branch (468:24): [True: 8.20k, False: 0]
  ------------------
  469|  8.20k|    TiffFinder finder(0x010f, IfdId::ifd0Id);
  470|  8.20k|    pRoot_->accept(finder);
  471|  8.20k|    auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
  472|  8.20k|    if (te && te->pValue()) {
  ------------------
  |  Branch (472:9): [True: 133, False: 8.07k]
  |  Branch (472:15): [True: 110, False: 23]
  ------------------
  473|    110|      make_ = te->pValue()->toString();
  474|    110|    }
  475|  8.20k|  }
  476|  15.0k|}
_ZN5Exiv28Internal11TiffEncoder10encodeIptcEv:
  478|  15.0k|void TiffEncoder::encodeIptc() {
  479|       |  // Update IPTCNAA Exif tag, if it exists. Delete the tag if there
  480|       |  // is no IPTC data anymore.
  481|       |  // If there is new IPTC data and Exif.Image.ImageResources does
  482|       |  // not exist, create a new IPTCNAA Exif tag.
  483|  15.0k|  bool del = false;
  484|  15.0k|  ExifKey iptcNaaKey("Exif.Image.IPTCNAA");
  485|  15.0k|  auto pos = exifData_.findKey(iptcNaaKey);
  486|  15.0k|  if (pos != exifData_.end()) {
  ------------------
  |  Branch (486:7): [True: 983, False: 14.0k]
  ------------------
  487|    983|    iptcNaaKey.setIdx(pos->idx());
  488|    983|    exifData_.erase(pos);
  489|    983|    del = true;
  490|    983|  }
  491|  15.0k|  DataBuf rawIptc = IptcParser::encode(iptcData_);
  492|  15.0k|  ExifKey irbKey("Exif.Image.ImageResources");
  493|  15.0k|  pos = exifData_.findKey(irbKey);
  494|  15.0k|  if (pos != exifData_.end()) {
  ------------------
  |  Branch (494:7): [True: 350, False: 14.6k]
  ------------------
  495|    350|    irbKey.setIdx(pos->idx());
  496|    350|  }
  497|  15.0k|  if (!rawIptc.empty() && (del || pos == exifData_.end())) {
  ------------------
  |  Branch (497:7): [True: 548, False: 14.4k]
  |  Branch (497:7): [True: 544, False: 14.4k]
  |  Branch (497:28): [True: 544, False: 4]
  |  Branch (497:35): [True: 0, False: 4]
  ------------------
  498|    544|    auto value = Value::create(unsignedLong);
  499|    544|    DataBuf buf;
  500|    544|    if (rawIptc.size() % 4 != 0) {
  ------------------
  |  Branch (500:9): [True: 406, False: 138]
  ------------------
  501|       |      // Pad the last unsignedLong value with 0s
  502|    406|      buf.alloc(((rawIptc.size() / 4) * 4) + 4);
  503|    406|      std::move(rawIptc.begin(), rawIptc.end(), buf.begin());
  504|    406|    } else {
  505|    138|      buf = std::move(rawIptc);  // Note: This resets rawIptc
  506|    138|    }
  507|    544|    value->read(buf.data(), buf.size(), byteOrder_);
  508|    544|    Exifdatum iptcDatum(iptcNaaKey, value.get());
  509|    544|    exifData_.add(iptcDatum);
  510|    544|    pos = exifData_.findKey(irbKey);  // needed after add()
  511|    544|  }
  512|       |  // Also update IPTC IRB in Exif.Image.ImageResources if it exists,
  513|       |  // but don't create it if not.
  514|  15.0k|  if (pos != exifData_.end()) {
  ------------------
  |  Branch (514:7): [True: 350, False: 14.6k]
  ------------------
  515|    350|    DataBuf irbBuf(pos->value().size());
  516|    350|    pos->value().copy(irbBuf.data(), invalidByteOrder);
  517|    350|    irbBuf = Photoshop::setIptcIrb(irbBuf.c_data(), irbBuf.size(), iptcData_);
  518|    350|    exifData_.erase(pos);
  519|    350|    if (!irbBuf.empty()) {
  ------------------
  |  Branch (519:9): [True: 161, False: 189]
  ------------------
  520|    161|      auto value = Value::create(unsignedByte);
  521|    161|      value->read(irbBuf.data(), irbBuf.size(), invalidByteOrder);
  522|    161|      Exifdatum iptcDatum(irbKey, value.get());
  523|    161|      exifData_.add(iptcDatum);
  524|    161|    }
  525|    350|  }
  526|  15.0k|}  // TiffEncoder::encodeIptc
_ZN5Exiv28Internal11TiffEncoder9encodeXmpEv:
  528|  14.9k|void TiffEncoder::encodeXmp() {
  529|  14.9k|#ifdef EXV_HAVE_XMP_TOOLKIT
  530|  14.9k|  ExifKey xmpKey("Exif.Image.XMLPacket");
  531|       |  // Remove any existing XMP Exif tag
  532|  14.9k|  if (auto pos = exifData_.findKey(xmpKey); pos != exifData_.end()) {
  ------------------
  |  Branch (532:45): [True: 1.07k, False: 13.9k]
  ------------------
  533|  1.07k|    xmpKey.setIdx(pos->idx());
  534|  1.07k|    exifData_.erase(pos);
  535|  1.07k|  }
  536|  14.9k|  std::string xmpPacket;
  537|  14.9k|  if (xmpData_.usePacket()) {
  ------------------
  |  Branch (537:7): [True: 0, False: 14.9k]
  ------------------
  538|      0|    xmpPacket = xmpData_.xmpPacket();
  539|  14.9k|  } else {
  540|  14.9k|    if (XmpParser::encode(xmpPacket, xmpData_) > 1) {
  ------------------
  |  Branch (540:9): [True: 10, False: 14.9k]
  ------------------
  541|     10|#ifndef SUPPRESS_WARNINGS
  542|     10|      EXV_ERROR << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  142|     10|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 10]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|     10|  LogMsg(LogMsg::error).os()
  ------------------
  543|     10|#endif
  544|     10|    }
  545|  14.9k|  }
  546|  14.9k|  if (!xmpPacket.empty()) {
  ------------------
  |  Branch (546:7): [True: 354, False: 14.6k]
  ------------------
  547|       |    // Set the XMP Exif tag to the new value
  548|    354|    auto value = Value::create(unsignedByte);
  549|    354|    value->read(reinterpret_cast<const byte*>(xmpPacket.data()), xmpPacket.size(), invalidByteOrder);
  550|    354|    Exifdatum xmpDatum(xmpKey, value.get());
  551|    354|    exifData_.add(xmpDatum);
  552|    354|  }
  553|  14.9k|#endif
  554|  14.9k|}  // TiffEncoder::encodeXmp
_ZN5Exiv28Internal11TiffEncoder8setDirtyEb:
  556|   777k|void TiffEncoder::setDirty(bool flag) {
  557|   777k|  dirty_ = flag;
  558|   777k|  setGo(geTraverse, !flag);
  559|   777k|}
_ZNK5Exiv28Internal11TiffEncoder5dirtyEv:
  561|  4.25k|bool TiffEncoder::dirty() const {
  562|  4.25k|  return dirty_ || !exifData_.empty();
  ------------------
  |  Branch (562:10): [True: 3.68k, False: 567]
  |  Branch (562:20): [True: 1, False: 566]
  ------------------
  563|  4.25k|}
_ZN5Exiv28Internal11TiffEncoder10visitEntryEPNS0_9TiffEntryE:
  565|  29.9k|void TiffEncoder::visitEntry(TiffEntry* object) {
  566|  29.9k|  encodeTiffComponent(object);
  567|  29.9k|}
_ZN5Exiv28Internal11TiffEncoder14visitDataEntryEPNS0_13TiffDataEntryE:
  569|  1.20k|void TiffEncoder::visitDataEntry(TiffDataEntry* object) {
  570|  1.20k|  encodeTiffComponent(object);
  571|  1.20k|}
_ZN5Exiv28Internal11TiffEncoder15visitImageEntryEPNS0_14TiffImageEntryE:
  573|  1.47k|void TiffEncoder::visitImageEntry(TiffImageEntry* object) {
  574|  1.47k|  encodeTiffComponent(object);
  575|  1.47k|}
_ZN5Exiv28Internal11TiffEncoder14visitSizeEntryEPNS0_13TiffSizeEntryE:
  577|  1.40k|void TiffEncoder::visitSizeEntry(TiffSizeEntry* object) {
  578|  1.40k|  encodeTiffComponent(object);
  579|  1.40k|}
_ZN5Exiv28Internal11TiffEncoder14visitDirectoryEPNS0_13TiffDirectoryE:
  581|  7.96k|void TiffEncoder::visitDirectory(TiffDirectory* /*object*/) {
  582|       |  // Nothing to do
  583|  7.96k|}
_ZN5Exiv28Internal11TiffEncoder18visitDirectoryNextEPNS0_13TiffDirectoryE:
  585|  3.60k|void TiffEncoder::visitDirectoryNext(TiffDirectory* object) {
  586|       |  // Update type and count in IFD entries, in case they changed
  587|  3.60k|  byte* p = object->start() + 2;
  588|  12.9k|  for (const auto& component : object->components_) {
  ------------------
  |  Branch (588:30): [True: 12.9k, False: 3.60k]
  ------------------
  589|  12.9k|    p += updateDirEntry(p, byteOrder(), component);
  590|  12.9k|  }
  591|  3.60k|}
_ZN5Exiv28Internal11TiffEncoder14updateDirEntryEPhNS_9ByteOrderERKNSt3__110shared_ptrINS0_13TiffComponentEEE:
  593|  12.9k|uint32_t TiffEncoder::updateDirEntry(byte* buf, ByteOrder byteOrder, const TiffComponent::SharedPtr& tiffComponent) {
  594|  12.9k|  auto pTiffEntry = std::dynamic_pointer_cast<TiffEntryBase>(tiffComponent);
  595|  12.9k|  if (!pTiffEntry)
  ------------------
  |  Branch (595:7): [True: 0, False: 12.9k]
  ------------------
  596|      0|    return 0;
  597|  12.9k|  us2Data(buf + 2, pTiffEntry->tiffType(), byteOrder);
  598|  12.9k|  ul2Data(buf + 4, static_cast<uint32_t>(pTiffEntry->count()), byteOrder);
  599|       |  // Move data to offset field, if it fits and is not yet there.
  600|  12.9k|  if (pTiffEntry->size() <= 4 && buf + 8 != pTiffEntry->pData()) {
  ------------------
  |  Branch (600:7): [True: 10.7k, False: 2.21k]
  |  Branch (600:34): [True: 2.89k, False: 7.80k]
  ------------------
  601|       |#ifdef EXIV2_DEBUG_MESSAGES
  602|       |    std::cerr << "Copying data for tag " << pTiffEntry->tag() << " to offset area.\n";
  603|       |#endif
  604|  2.89k|    memset(buf + 8, 0x0, 4);
  605|  2.89k|    if (pTiffEntry->size() > 0) {
  ------------------
  |  Branch (605:9): [True: 52, False: 2.84k]
  ------------------
  606|     52|      std::copy_n(pTiffEntry->pData(), pTiffEntry->size(), buf + 8);
  607|     52|      memset(const_cast<byte*>(pTiffEntry->pData()), 0x0, pTiffEntry->size());
  608|     52|    }
  609|  2.89k|  }
  610|  12.9k|  return 12;
  611|  12.9k|}
_ZN5Exiv28Internal11TiffEncoder11visitSubIfdEPNS0_10TiffSubIfdE:
  613|  1.27k|void TiffEncoder::visitSubIfd(TiffSubIfd* object) {
  614|  1.27k|  encodeTiffComponent(object);
  615|  1.27k|}
_ZN5Exiv28Internal11TiffEncoder12visitMnEntryEPNS0_11TiffMnEntryE:
  617|    916|void TiffEncoder::visitMnEntry(TiffMnEntry* object) {
  618|       |  // Test is required here as well as in the callback encoder function
  619|    916|  if (!object->mn_) {
  ------------------
  |  Branch (619:7): [True: 531, False: 385]
  ------------------
  620|    531|    encodeTiffComponent(object);
  621|    531|  } else if (del_) {
  ------------------
  |  Branch (621:14): [True: 385, False: 0]
  ------------------
  622|       |    // The makernote is made up of decoded tags, delete binary tag
  623|    385|    ExifKey key(object->tag(), groupName(object->group()));
  624|    385|    auto pos = exifData_.findKey(key);
  625|    385|    if (pos != exifData_.end())
  ------------------
  |  Branch (625:9): [True: 374, False: 11]
  ------------------
  626|    374|      exifData_.erase(pos);
  627|    385|  }
  628|    916|}
_ZN5Exiv28Internal11TiffEncoder17visitIfdMakernoteEPNS0_16TiffIfdMakernoteE:
  630|    385|void TiffEncoder::visitIfdMakernote(TiffIfdMakernote* object) {
  631|    385|  auto pos = exifData_.findKey(ExifKey("Exif.MakerNote.ByteOrder"));
  632|    385|  if (pos != exifData_.end()) {
  ------------------
  |  Branch (632:7): [True: 169, False: 216]
  ------------------
  633|       |    // Set Makernote byte order
  634|    169|    ByteOrder bo = stringToByteOrder(pos->toString());
  635|    169|    if (bo != invalidByteOrder && bo != object->byteOrder()) {
  ------------------
  |  Branch (635:9): [True: 169, False: 0]
  |  Branch (635:35): [True: 0, False: 169]
  ------------------
  636|      0|      object->setByteOrder(bo);
  637|      0|      setDirty();
  638|      0|    }
  639|    169|    if (del_)
  ------------------
  |  Branch (639:9): [True: 169, False: 0]
  ------------------
  640|    169|      exifData_.erase(pos);
  641|    169|  }
  642|    385|  if (del_) {
  ------------------
  |  Branch (642:7): [True: 385, False: 0]
  ------------------
  643|       |    // Remove remaining synthesized tags
  644|    385|    for (auto synthesizedTag : {"Exif.MakerNote.Offset"}) {
  ------------------
  |  Branch (644:30): [True: 385, False: 385]
  ------------------
  645|    385|      pos = exifData_.findKey(ExifKey(synthesizedTag));
  646|    385|      if (pos != exifData_.end())
  ------------------
  |  Branch (646:11): [True: 169, False: 216]
  ------------------
  647|    169|        exifData_.erase(pos);
  648|    385|    }
  649|    385|  }
  650|       |  // Modify encoder for Makernote peculiarities, byte order
  651|    385|  byteOrder_ = object->byteOrder();
  652|       |
  653|    385|}  // TiffEncoder::visitIfdMakernote
_ZN5Exiv28Internal11TiffEncoder20visitIfdMakernoteEndEPNS0_16TiffIfdMakernoteE:
  655|    281|void TiffEncoder::visitIfdMakernoteEnd(TiffIfdMakernote* /*object*/) {
  656|       |  // Reset byte order back to that from the c'tor
  657|    281|  byteOrder_ = origByteOrder_;
  658|       |
  659|    281|}  // TiffEncoder::visitIfdMakernoteEnd
_ZN5Exiv28Internal11TiffEncoder16visitBinaryArrayEPNS0_15TiffBinaryArrayE:
  661|    364|void TiffEncoder::visitBinaryArray(TiffBinaryArray* object) {
  662|    364|  if (!object->cfg() || !object->decoded()) {
  ------------------
  |  Branch (662:7): [True: 84, False: 280]
  |  Branch (662:25): [True: 134, False: 146]
  ------------------
  663|    218|    encodeTiffComponent(object);
  664|    218|  }
  665|    364|}
_ZN5Exiv28Internal11TiffEncoder19visitBinaryArrayEndEPNS0_15TiffBinaryArrayE:
  667|    362|void TiffEncoder::visitBinaryArrayEnd(TiffBinaryArray* object) {
  668|    362|  if (!object->cfg() || !object->decoded())
  ------------------
  |  Branch (668:7): [True: 84, False: 278]
  |  Branch (668:25): [True: 132, False: 146]
  ------------------
  669|    216|    return;
  670|    146|  size_t size = object->TiffEntryBase::doSize();
  671|    146|  if (size == 0)
  ------------------
  |  Branch (671:7): [True: 0, False: 146]
  ------------------
  672|      0|    return;
  673|    146|  if (!object->initialize(pRoot_))
  ------------------
  |  Branch (673:7): [True: 0, False: 146]
  ------------------
  674|      0|    return;
  675|       |
  676|       |  // Re-encrypt buffer if necessary
  677|    146|  CryptFct cryptFct = object->cfg()->cryptFct_;
  678|    146|  if (cryptFct == &sonyTagDecipher) {
  ------------------
  |  Branch (678:7): [True: 15, False: 131]
  ------------------
  679|     15|    cryptFct = sonyTagEncipher;
  680|     15|  }
  681|    146|  if (cryptFct) {
  ------------------
  |  Branch (681:7): [True: 47, False: 99]
  ------------------
  682|     47|    const byte* pData = object->pData();
  683|     47|    DataBuf buf = cryptFct(object->tag(), pData, size, pRoot_);
  684|     47|    if (!buf.empty()) {
  ------------------
  |  Branch (684:9): [True: 23, False: 24]
  ------------------
  685|     23|      pData = buf.c_data();
  686|     23|      size = buf.size();
  687|     23|    }
  688|     47|    if (!object->updOrigDataBuf(pData, size)) {
  ------------------
  |  Branch (688:9): [True: 0, False: 47]
  ------------------
  689|      0|      setDirty();
  690|      0|    }
  691|     47|  }
  692|    146|}
_ZN5Exiv28Internal11TiffEncoder18visitBinaryElementEPNS0_17TiffBinaryElementE:
  694|  3.05k|void TiffEncoder::visitBinaryElement(TiffBinaryElement* object) {
  695|       |  // Temporarily overwrite byte order according to that of the binary element
  696|  3.05k|  ByteOrder boOrig = byteOrder_;
  697|  3.05k|  if (object->elByteOrder() != invalidByteOrder)
  ------------------
  |  Branch (697:7): [True: 965, False: 2.08k]
  ------------------
  698|    965|    byteOrder_ = object->elByteOrder();
  699|  3.05k|  encodeTiffComponent(object);
  700|  3.05k|  byteOrder_ = boOrig;
  701|  3.05k|}
_ZNK5Exiv28Internal11TiffEncoder10isImageTagEtNS_5IfdIdE:
  703|  4.75M|bool TiffEncoder::isImageTag(uint16_t tag, IfdId group) const {
  704|  4.75M|  return !isNewImage_ && pHeader_->isImageTag(tag, group, pPrimaryGroups_);
  ------------------
  |  Branch (704:10): [True: 1.73M, False: 3.01M]
  |  Branch (704:26): [True: 22.2k, False: 1.71M]
  ------------------
  705|  4.75M|}
_ZN5Exiv28Internal11TiffEncoder19encodeTiffComponentEPNS0_13TiffEntryBaseEPKNS_9ExifdatumE:
  707|  2.38M|void TiffEncoder::encodeTiffComponent(TiffEntryBase* object, const Exifdatum* datum) {
  708|  2.38M|  auto pos = exifData_.end();
  709|  2.38M|  const Exifdatum* ed = datum;
  710|  2.38M|  if (!ed) {
  ------------------
  |  Branch (710:7): [True: 39.1k, False: 2.34M]
  ------------------
  711|       |    // Non-intrusive writing: find matching tag
  712|  39.1k|    ExifKey key(object->tag(), groupName(object->group()));
  713|  39.1k|    pos = exifData_.findKey(key);
  714|  39.1k|    if (pos != exifData_.end()) {
  ------------------
  |  Branch (714:9): [True: 35.6k, False: 3.48k]
  ------------------
  715|  35.6k|      ed = &(*pos);
  716|  35.6k|      if (object->idx() != pos->idx()) {
  ------------------
  |  Branch (716:11): [True: 3.76k, False: 31.8k]
  ------------------
  717|       |        // Try to find exact match (in case of duplicate tags)
  718|  3.76k|        auto pos2 = std::find_if(exifData_.begin(), exifData_.end(), FindExifdatum2(object->group(), object->idx()));
  719|  3.76k|        if (pos2 != exifData_.end() && pos2->key() == key.key()) {
  ------------------
  |  Branch (719:13): [True: 115, False: 3.64k]
  |  Branch (719:13): [True: 47, False: 3.71k]
  |  Branch (719:40): [True: 47, False: 68]
  ------------------
  720|     47|          ed = &(*pos2);
  721|     47|          pos = pos2;  // make sure we delete the correct tag below
  722|     47|        }
  723|  3.76k|      }
  724|  35.6k|    } else {
  725|  3.48k|      setDirty();
  726|       |#ifdef EXIV2_DEBUG_MESSAGES
  727|       |      std::cerr << "DELETING          " << key << ", idx = " << object->idx() << "\n";
  728|       |#endif
  729|  3.48k|    }
  730|  2.34M|  } else {
  731|       |    // For intrusive writing, the index is used to preserve the order of
  732|       |    // duplicate tags
  733|  2.34M|    object->idx_ = ed->idx();
  734|  2.34M|  }
  735|       |  // Skip encoding image tags of existing TIFF image - they were copied earlier -
  736|       |  // but encode image tags of new images (creation)
  737|  2.38M|  if (ed && !isImageTag(object->tag(), object->group())) {
  ------------------
  |  Branch (737:7): [True: 2.37M, False: 3.48k]
  |  Branch (737:13): [True: 2.37M, False: 4.10k]
  ------------------
  738|  2.37M|    if (auto fct = findEncoderFct_(make_, object->tag(), object->group())) {
  ------------------
  |  Branch (738:14): [True: 0, False: 2.37M]
  ------------------
  739|       |      // If an encoding function is registered for the tag, use it
  740|      0|      std::invoke(fct, *this, object, ed);
  741|  2.37M|    } else {
  742|       |      // Else use the encode function at the object (results in a double-dispatch
  743|       |      // to the appropriate encoding function of the encoder.
  744|  2.37M|      object->encode(*this, ed);
  745|  2.37M|    }
  746|  2.37M|  }
  747|  2.38M|  if (del_ && pos != exifData_.end()) {
  ------------------
  |  Branch (747:7): [True: 39.1k, False: 2.34M]
  |  Branch (747:7): [True: 35.6k, False: 2.34M]
  |  Branch (747:15): [True: 35.6k, False: 3.48k]
  ------------------
  748|  35.6k|    exifData_.erase(pos);
  749|  35.6k|  }
  750|       |#ifdef EXIV2_DEBUG_MESSAGES
  751|       |  std::cerr << "\n";
  752|       |#endif
  753|  2.38M|}  // TiffEncoder::encodeTiffComponent
_ZN5Exiv28Internal11TiffEncoder17encodeBinaryArrayEPNS0_15TiffBinaryArrayEPKNS_9ExifdatumE:
  755|  12.2k|void TiffEncoder::encodeBinaryArray(TiffBinaryArray* object, const Exifdatum* datum) {
  756|  12.2k|  encodeOffsetEntry(object, datum);
  757|  12.2k|}  // TiffEncoder::encodeBinaryArray
_ZN5Exiv28Internal11TiffEncoder19encodeBinaryElementEPNS0_17TiffBinaryElementEPKNS_9ExifdatumE:
  759|  1.25M|void TiffEncoder::encodeBinaryElement(TiffBinaryElement* object, const Exifdatum* datum) {
  760|  1.25M|  encodeTiffEntryBase(object, datum);
  761|  1.25M|}  // TiffEncoder::encodeArrayElement
_ZN5Exiv28Internal11TiffEncoder15encodeDataEntryEPNS0_13TiffDataEntryEPKNS_9ExifdatumE:
  763|  6.19k|void TiffEncoder::encodeDataEntry(TiffDataEntry* object, const Exifdatum* datum) {
  764|  6.19k|  encodeOffsetEntry(object, datum);
  765|       |
  766|  6.19k|  if (!dirty_ && writeMethod() == wmNonIntrusive) {
  ------------------
  |  Branch (766:7): [True: 1.45k, False: 4.73k]
  |  Branch (766:18): [True: 1.12k, False: 332]
  ------------------
  767|  1.12k|    if (object->sizeDataArea_ < object->pValue()->sizeDataArea()) {
  ------------------
  |  Branch (767:9): [True: 0, False: 1.12k]
  ------------------
  768|       |#ifdef EXIV2_DEBUG_MESSAGES
  769|       |      ExifKey key(object->tag(), groupName(object->group()));
  770|       |      std::cerr << "DATAAREA GREW     " << key << "\n";
  771|       |#endif
  772|      0|      setDirty();
  773|  1.12k|    } else {
  774|       |      // Write the new dataarea, fill with 0x0
  775|       |#ifdef EXIV2_DEBUG_MESSAGES
  776|       |      ExifKey key(object->tag(), groupName(object->group()));
  777|       |      std::cerr << "Writing data area for " << key << "\n";
  778|       |#endif
  779|  1.12k|      DataBuf buf = object->pValue()->dataArea();
  780|  1.12k|      if (!buf.empty()) {
  ------------------
  |  Branch (780:11): [True: 453, False: 674]
  ------------------
  781|    453|        std::copy(buf.begin(), buf.end(), object->pDataArea_);
  782|    453|        if (object->sizeDataArea_ > buf.size()) {
  ------------------
  |  Branch (782:13): [True: 0, False: 453]
  ------------------
  783|      0|          memset(object->pDataArea_ + buf.size(), 0x0, object->sizeDataArea_ - buf.size());
  784|      0|        }
  785|    453|      }
  786|  1.12k|    }
  787|  1.12k|  }
  788|       |
  789|  6.19k|}  // TiffEncoder::encodeDataEntry
_ZN5Exiv28Internal11TiffEncoder15encodeTiffEntryEPNS0_9TiffEntryEPKNS_9ExifdatumE:
  791|  1.06M|void TiffEncoder::encodeTiffEntry(TiffEntry* object, const Exifdatum* datum) {
  792|  1.06M|  encodeTiffEntryBase(object, datum);
  793|  1.06M|}  // TiffEncoder::encodeTiffEntry
_ZN5Exiv28Internal11TiffEncoder16encodeImageEntryEPNS0_14TiffImageEntryEPKNS_9ExifdatumE:
  795|  11.0k|void TiffEncoder::encodeImageEntry(TiffImageEntry* object, const Exifdatum* datum) {
  796|  11.0k|  encodeOffsetEntry(object, datum);
  797|       |
  798|  11.0k|  size_t sizeDataArea = object->pValue()->sizeDataArea();
  799|       |
  800|  11.0k|  if (sizeDataArea > 0 && writeMethod() == wmNonIntrusive) {
  ------------------
  |  Branch (800:7): [True: 165, False: 10.8k]
  |  Branch (800:27): [True: 0, False: 165]
  ------------------
  801|       |#ifdef EXIV2_DEBUG_MESSAGES
  802|       |    std::cerr << "\t DATAAREA IS SET (NON-INTRUSIVE WRITING)";
  803|       |#endif
  804|      0|    setDirty();
  805|      0|  }
  806|       |
  807|  11.0k|  if (sizeDataArea > 0 && writeMethod() == wmIntrusive) {
  ------------------
  |  Branch (807:7): [True: 165, False: 10.8k]
  |  Branch (807:27): [True: 165, False: 0]
  ------------------
  808|       |#ifdef EXIV2_DEBUG_MESSAGES
  809|       |    std::cerr << "\t DATAAREA IS SET (INTRUSIVE WRITING)";
  810|       |#endif
  811|       |    // Set pseudo strips (without a data pointer) from the size tag
  812|    165|    ExifKey key(object->szTag(), groupName(object->szGroup()));
  813|    165|    auto pos = exifData_.findKey(key);
  814|    165|    const byte* zero = nullptr;
  815|    165|    if (pos == exifData_.end()) {
  ------------------
  |  Branch (815:9): [True: 0, False: 165]
  ------------------
  816|      0|#ifndef SUPPRESS_WARNINGS
  817|      0|      EXV_ERROR << "Size tag " << key << " not found. Writing only one strip.\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  818|      0|#endif
  819|      0|      object->strips_.clear();
  820|      0|      object->strips_.emplace_back(zero, sizeDataArea);
  821|    165|    } else {
  822|    165|      size_t sizeTotal = 0;
  823|    165|      object->strips_.clear();
  824|  3.79k|      for (size_t i = 0; i < pos->count(); ++i) {
  ------------------
  |  Branch (824:26): [True: 3.63k, False: 165]
  ------------------
  825|  3.63k|        uint32_t len = pos->toUint32(i);
  826|  3.63k|        object->strips_.emplace_back(zero, len);
  827|  3.63k|        sizeTotal += len;
  828|  3.63k|      }
  829|    165|      if (sizeTotal != sizeDataArea) {
  ------------------
  |  Branch (829:11): [True: 0, False: 165]
  ------------------
  830|      0|#ifndef SUPPRESS_WARNINGS
  831|      0|        ExifKey key2(object->tag(), groupName(object->group()));
  832|      0|        EXV_ERROR << "Sum of all sizes of " << key << " != data size of " << key2 << ". "
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  833|      0|                  << "This results in an invalid image.\n";
  834|      0|#endif
  835|       |        // Todo: How to fix? Write only one strip?
  836|      0|      }
  837|    165|    }
  838|    165|  }
  839|       |
  840|  11.0k|  if (sizeDataArea == 0 && writeMethod() == wmIntrusive) {
  ------------------
  |  Branch (840:7): [True: 10.8k, False: 165]
  |  Branch (840:28): [True: 9.89k, False: 975]
  ------------------
  841|       |#ifdef EXIV2_DEBUG_MESSAGES
  842|       |    std::cerr << "\t USE STRIPS FROM SOURCE TREE IMAGE ENTRY";
  843|       |#endif
  844|       |    // Set strips from source tree
  845|  9.89k|    if (pSourceTree_) {
  ------------------
  |  Branch (845:9): [True: 4.43k, False: 5.46k]
  ------------------
  846|  4.43k|      TiffFinder finder(object->tag(), object->group());
  847|  4.43k|      pSourceTree_->accept(finder);
  848|  4.43k|      if (auto ti = dynamic_cast<const TiffImageEntry*>(finder.result())) {
  ------------------
  |  Branch (848:16): [True: 4.43k, False: 1]
  ------------------
  849|  4.43k|        object->strips_ = ti->strips_;
  850|  4.43k|      }
  851|  4.43k|    }
  852|  5.46k|#ifndef SUPPRESS_WARNINGS
  853|  5.46k|    else {
  854|  5.46k|      ExifKey key2(object->tag(), groupName(object->group()));
  855|  5.46k|      EXV_WARNING << "No image data to encode " << key2 << ".\n";
  ------------------
  |  |  138|  5.46k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 5.46k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  5.46k|  LogMsg(LogMsg::warn).os()
  ------------------
  856|  5.46k|    }
  857|  9.89k|#endif
  858|  9.89k|  }
  859|       |
  860|  11.0k|}  // TiffEncoder::encodeImageEntry
_ZN5Exiv28Internal11TiffEncoder13encodeMnEntryEPNS0_11TiffMnEntryEPKNS_9ExifdatumE:
  862|  10.1k|void TiffEncoder::encodeMnEntry(TiffMnEntry* object, const Exifdatum* datum) {
  863|       |  // Test is required here as well as in the visit function
  864|  10.1k|  if (!object->mn_)
  ------------------
  |  Branch (864:7): [True: 9.92k, False: 173]
  ------------------
  865|  9.92k|    encodeTiffEntryBase(object, datum);
  866|  10.1k|}  // TiffEncoder::encodeMnEntry
_ZN5Exiv28Internal11TiffEncoder15encodeSizeEntryEPNS0_13TiffSizeEntryEPKNS_9ExifdatumE:
  868|  15.9k|void TiffEncoder::encodeSizeEntry(TiffSizeEntry* object, const Exifdatum* datum) {
  869|  15.9k|  encodeTiffEntryBase(object, datum);
  870|  15.9k|}  // TiffEncoder::encodeSizeEntry
_ZN5Exiv28Internal11TiffEncoder12encodeSubIfdEPNS0_10TiffSubIfdEPKNS_9ExifdatumE:
  872|  1.25k|void TiffEncoder::encodeSubIfd(TiffSubIfd* object, const Exifdatum* datum) {
  873|  1.25k|  encodeOffsetEntry(object, datum);
  874|  1.25k|}  // TiffEncoder::encodeSubIfd
_ZN5Exiv28Internal11TiffEncoder19encodeTiffEntryBaseEPNS0_13TiffEntryBaseEPKNS_9ExifdatumE:
  876|  2.34M|void TiffEncoder::encodeTiffEntryBase(TiffEntryBase* object, const Exifdatum* datum) {
  877|       |#ifdef EXIV2_DEBUG_MESSAGES
  878|       |  bool tooLarge = false;
  879|       |#endif
  880|  2.34M|  if (datum->size() > object->size_) {  // value doesn't fit, encode for intrusive writing
  ------------------
  |  Branch (880:7): [True: 766k, False: 1.57M]
  ------------------
  881|   766k|    setDirty();
  882|       |#ifdef EXIV2_DEBUG_MESSAGES
  883|       |    tooLarge = true;
  884|       |#endif
  885|   766k|  }
  886|  2.34M|  object->updateValue(datum->getValue(), byteOrder());  // clones the value
  887|       |#ifdef EXIV2_DEBUG_MESSAGES
  888|       |  ExifKey key(object->tag(), groupName(object->group()));
  889|       |  std::cerr << "UPDATING DATA     " << key;
  890|       |  if (tooLarge) {
  891|       |    std::cerr << "\t\t\t ALLOCATED " << std::dec << object->size_ << " BYTES";
  892|       |  }
  893|       |#endif
  894|  2.34M|}
_ZN5Exiv28Internal11TiffEncoder17encodeOffsetEntryEPNS0_13TiffEntryBaseEPKNS_9ExifdatumE:
  896|  30.7k|void TiffEncoder::encodeOffsetEntry(TiffEntryBase* object, const Exifdatum* datum) {
  897|  30.7k|  size_t newSize = datum->size();
  898|  30.7k|  if (newSize > object->size_) {  // value doesn't fit, encode for intrusive writing
  ------------------
  |  Branch (898:7): [True: 7.60k, False: 23.1k]
  ------------------
  899|  7.60k|    setDirty();
  900|  7.60k|    object->updateValue(datum->getValue(), byteOrder());  // clones the value
  901|       |#ifdef EXIV2_DEBUG_MESSAGES
  902|       |    ExifKey key(object->tag(), groupName(object->group()));
  903|       |    std::cerr << "UPDATING DATA     " << key;
  904|       |    std::cerr << "\t\t\t ALLOCATED " << object->size() << " BYTES";
  905|       |#endif
  906|  23.1k|  } else {
  907|  23.1k|    object->setValue(datum->getValue());  // clones the value
  908|       |#ifdef EXIV2_DEBUG_MESSAGES
  909|       |    ExifKey key(object->tag(), groupName(object->group()));
  910|       |    std::cerr << "NOT UPDATING      " << key;
  911|       |    std::cerr << "\t\t\t PRESERVE VALUE DATA";
  912|       |#endif
  913|  23.1k|  }
  914|  30.7k|}
_ZN5Exiv28Internal11TiffEncoder3addEPNS0_13TiffComponentENSt3__110unique_ptrIS2_NS4_14default_deleteIS2_EEEEj:
  916|  10.7k|void TiffEncoder::add(TiffComponent* pRootDir, TiffComponent::UniquePtr pSourceDir, uint32_t root) {
  917|  10.7k|  writeMethod_ = wmIntrusive;
  918|  10.7k|  pSourceTree_ = std::move(pSourceDir);
  919|       |
  920|       |  // Ensure that the exifData_ entries are not deleted, to be able to
  921|       |  // iterate over all remaining entries.
  922|  10.7k|  del_ = false;
  923|       |
  924|  10.7k|  auto posBo = exifData_.end();
  925|  2.39M|  for (auto i = exifData_.begin(); i != exifData_.end(); ++i) {
  ------------------
  |  Branch (925:36): [True: 2.38M, False: 10.7k]
  ------------------
  926|  2.38M|    IfdId group = groupId(i->groupName());
  927|       |    // Skip synthesized info tags
  928|  2.38M|    if (group == IfdId::mnId) {
  ------------------
  |  Branch (928:9): [True: 10.1k, False: 2.37M]
  ------------------
  929|  10.1k|      if (i->tag() == 0x0002) {
  ------------------
  |  Branch (929:11): [True: 5.06k, False: 5.06k]
  ------------------
  930|  5.06k|        posBo = i;
  931|  5.06k|      }
  932|  10.1k|      continue;
  933|  10.1k|    }
  934|       |
  935|       |    // Skip image tags of existing TIFF image - they were copied earlier -
  936|       |    // but add and encode image tags of new images (creation)
  937|  2.37M|    if (isImageTag(i->tag(), group))
  ------------------
  |  Branch (937:9): [True: 18.1k, False: 2.35M]
  ------------------
  938|  18.1k|      continue;
  939|       |
  940|       |    // Assumption is that the corresponding TIFF entry doesn't exist
  941|  2.35M|    auto tiffPath = TiffCreator::getPath(i->tag(), group, root);
  942|  2.35M|    TiffComponent* tc = pRootDir->addPath(i->tag(), tiffPath, pRootDir);
  943|  2.35M|    auto object = dynamic_cast<TiffEntryBase*>(tc);
  944|       |#ifdef EXIV2_DEBUG_MESSAGES
  945|       |    if (!object) {
  946|       |      std::cerr << "Warning: addPath() didn't add an entry for " << i->groupName() << " tag 0x" << std::setw(4)
  947|       |                << std::setfill('0') << std::hex << i->tag() << "\n";
  948|       |    }
  949|       |#endif
  950|  2.35M|    if (object) {
  ------------------
  |  Branch (950:9): [True: 2.34M, False: 14.8k]
  ------------------
  951|  2.34M|      encodeTiffComponent(object, &(*i));
  952|  2.34M|    }
  953|  2.35M|  }
  954|       |
  955|       |  /*
  956|       |    What follows is a hack. I can't think of a better way to set
  957|       |    the makernote byte order (and other properties maybe) in the
  958|       |    makernote header during intrusive writing. The thing is that
  959|       |    visit/encodeIfdMakernote is not called in this case and there
  960|       |    can't be an Exif tag which corresponds to this component.
  961|       |   */
  962|  10.7k|  if (posBo == exifData_.end())
  ------------------
  |  Branch (962:7): [True: 5.68k, False: 5.06k]
  ------------------
  963|  5.68k|    return;
  964|       |
  965|  5.06k|  TiffFinder finder(0x927c, IfdId::exifId);
  966|  5.06k|  pRootDir->accept(finder);
  967|  5.06k|  if (auto te = dynamic_cast<const TiffMnEntry*>(finder.result())) {
  ------------------
  |  Branch (967:12): [True: 5.01k, False: 57]
  ------------------
  968|  5.01k|    if (const auto& mn = te->mn_) {
  ------------------
  |  Branch (968:21): [True: 4.99k, False: 12]
  ------------------
  969|       |      // Set Makernote byte order
  970|  4.99k|      ByteOrder bo = stringToByteOrder(posBo->toString());
  971|  4.99k|      if (bo != invalidByteOrder)
  ------------------
  |  Branch (971:11): [True: 4.99k, False: 0]
  ------------------
  972|  4.99k|        mn->setByteOrder(bo);
  973|  4.99k|    }
  974|  5.01k|  }
  975|       |
  976|  5.06k|}  // TiffEncoder::add
_ZN5Exiv28Internal10TiffReaderC2EPKhmPNS0_13TiffComponentENS0_11TiffRwStateE:
  979|  18.3k|    pData_(pData), size_(size), pLast_(pData + size), pRoot_(pRoot), origState_(state), mnState_(state) {
  980|  18.3k|  pState_ = &origState_;
  981|       |
  982|  18.3k|}  // TiffReader::TiffReader
_ZN5Exiv28Internal10TiffReader12setOrigStateEv:
  984|  23.1k|void TiffReader::setOrigState() {
  985|  23.1k|  pState_ = &origState_;
  986|  23.1k|}
_ZN5Exiv28Internal10TiffReader10setMnStateEPKNS0_11TiffRwStateE:
  988|  23.2k|void TiffReader::setMnState(const TiffRwState* state) {
  989|  23.2k|  if (state) {
  ------------------
  |  Branch (989:7): [True: 4.97k, False: 18.2k]
  ------------------
  990|       |    // invalidByteOrder indicates 'no change'
  991|  4.97k|    if (state->byteOrder() == invalidByteOrder) {
  ------------------
  |  Branch (991:9): [True: 0, False: 4.97k]
  ------------------
  992|      0|      mnState_ = TiffRwState{origState_.byteOrder(), state->baseOffset()};
  993|  4.97k|    } else {
  994|  4.97k|      mnState_ = *state;
  995|  4.97k|    }
  996|  4.97k|  }
  997|  23.2k|  pState_ = &mnState_;
  998|  23.2k|}
_ZNK5Exiv28Internal10TiffReader9byteOrderEv:
 1000|  9.87M|ByteOrder TiffReader::byteOrder() const {
 1001|  9.87M|  return pState_->byteOrder();
 1002|  9.87M|}
_ZNK5Exiv28Internal10TiffReader10baseOffsetEv:
 1004|  1.45M|size_t TiffReader::baseOffset() const {
 1005|  1.45M|  return pState_->baseOffset();
 1006|  1.45M|}
_ZN5Exiv28Internal10TiffReader17readDataEntryBaseEPNS0_17TiffDataEntryBaseE:
 1008|  48.2k|void TiffReader::readDataEntryBase(TiffDataEntryBase* object) {
 1009|  48.2k|  readTiffEntry(object);
 1010|  48.2k|  TiffFinder finder(object->szTag(), object->szGroup());
 1011|  48.2k|  pRoot_->accept(finder);
 1012|  48.2k|  auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
 1013|  48.2k|  if (te && te->pValue()) {
  ------------------
  |  Branch (1013:7): [True: 36.7k, False: 11.4k]
  |  Branch (1013:13): [True: 20.6k, False: 16.1k]
  ------------------
 1014|  20.6k|    object->setStrips(te->pValue(), pData_, size_, baseOffset());
 1015|  20.6k|  }
 1016|  48.2k|}
_ZN5Exiv28Internal10TiffReader10visitEntryEPNS0_9TiffEntryE:
 1018|  2.23M|void TiffReader::visitEntry(TiffEntry* object) {
 1019|  2.23M|  readTiffEntry(object);
 1020|  2.23M|}
_ZN5Exiv28Internal10TiffReader14visitDataEntryEPNS0_13TiffDataEntryE:
 1022|  9.67k|void TiffReader::visitDataEntry(TiffDataEntry* object) {
 1023|  9.67k|  readDataEntryBase(object);
 1024|  9.67k|}
_ZN5Exiv28Internal10TiffReader15visitImageEntryEPNS0_14TiffImageEntryE:
 1026|  38.6k|void TiffReader::visitImageEntry(TiffImageEntry* object) {
 1027|  38.6k|  readDataEntryBase(object);
 1028|  38.6k|}
_ZN5Exiv28Internal10TiffReader14visitSizeEntryEPNS0_13TiffSizeEntryE:
 1030|  48.3k|void TiffReader::visitSizeEntry(TiffSizeEntry* object) {
 1031|  48.3k|  readTiffEntry(object);
 1032|  48.3k|  TiffFinder finder(object->dtTag(), object->dtGroup());
 1033|  48.3k|  pRoot_->accept(finder);
 1034|  48.3k|  auto te = dynamic_cast<TiffDataEntryBase*>(finder.result());
 1035|  48.3k|  if (te && te->pValue()) {
  ------------------
  |  Branch (1035:7): [True: 34.4k, False: 13.9k]
  |  Branch (1035:13): [True: 28.5k, False: 5.93k]
  ------------------
 1036|  28.5k|    te->setStrips(object->pValue(), pData_, size_, baseOffset());
 1037|  28.5k|  }
 1038|  48.3k|}
_ZN5Exiv28Internal10TiffReader17circularReferenceEPKhNS_5IfdIdE:
 1040|  81.5k|bool TiffReader::circularReference(const byte* start, IfdId group) {
 1041|  81.5k|  if (auto pos = dirList_.find(start); pos != dirList_.end()) {
  ------------------
  |  Branch (1041:40): [True: 8.45k, False: 73.0k]
  ------------------
 1042|  8.45k|#ifndef SUPPRESS_WARNINGS
 1043|  8.45k|    EXV_ERROR << groupName(group) << " pointer references previously read " << groupName(pos->second)
  ------------------
  |  |  142|  8.45k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 8.45k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  8.45k|  LogMsg(LogMsg::error).os()
  ------------------
 1044|      0|              << " directory; ignored.\n";
 1045|  8.45k|#endif
 1046|  8.45k|    return true;
 1047|  8.45k|  }
 1048|  73.0k|  dirList_[start] = group;
 1049|  73.0k|  return false;
 1050|  81.5k|}
_ZN5Exiv28Internal10TiffReader7nextIdxENS_5IfdIdE:
 1052|  2.54M|int TiffReader::nextIdx(IfdId group) {
 1053|  2.54M|  return ++idxSeq_[group];
 1054|  2.54M|}
_ZN5Exiv28Internal10TiffReader11postProcessEv:
 1056|  18.2k|void TiffReader::postProcess() {
 1057|  18.2k|  setMnState();  // All components to be post-processed must be from the Makernote
 1058|  18.2k|  postProc_ = true;
 1059|  18.2k|  for (auto pos : postList_) {
  ------------------
  |  Branch (1059:17): [True: 10.2k, False: 18.2k]
  ------------------
 1060|  10.2k|    pos->accept(*this);
 1061|  10.2k|  }
 1062|  18.2k|  postProc_ = false;
 1063|  18.2k|  setOrigState();
 1064|  18.2k|}
_ZN5Exiv28Internal10TiffReader14visitDirectoryEPNS0_13TiffDirectoryE:
 1066|  81.5k|void TiffReader::visitDirectory(TiffDirectory* object) {
 1067|  81.5k|  const byte* p = object->start();
 1068|       |
 1069|  81.5k|  if (circularReference(object->start(), object->group()))
  ------------------
  |  Branch (1069:7): [True: 8.45k, False: 73.0k]
  ------------------
 1070|  8.45k|    return;
 1071|       |
 1072|  73.0k|  if (p + 2 > pLast_) {
  ------------------
  |  Branch (1072:7): [True: 125, False: 72.9k]
  ------------------
 1073|    125|#ifndef SUPPRESS_WARNINGS
 1074|    125|    EXV_ERROR << "Directory " << groupName(object->group()) << ": IFD exceeds data buffer, cannot read entry count.\n";
  ------------------
  |  |  142|    125|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 125]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    125|  LogMsg(LogMsg::error).os()
  ------------------
 1075|    125|#endif
 1076|    125|    return;
 1077|    125|  }
 1078|  72.9k|  const uint16_t n = getUShort(p, byteOrder());
 1079|  72.9k|  p += 2;
 1080|       |  // Sanity check with an "unreasonably" large number
 1081|  72.9k|  if (n > 256) {
  ------------------
  |  Branch (1081:7): [True: 15.3k, False: 57.6k]
  ------------------
 1082|  15.3k|#ifndef SUPPRESS_WARNINGS
 1083|  15.3k|    EXV_ERROR << "Directory " << groupName(object->group()) << " with " << n
  ------------------
  |  |  142|  15.3k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 15.3k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  15.3k|  LogMsg(LogMsg::error).os()
  ------------------
 1084|      0|              << " entries considered invalid; not read.\n";
 1085|  15.3k|#endif
 1086|  15.3k|    return;
 1087|  15.3k|  }
 1088|  2.61M|  for (uint16_t i = 0; i < n; ++i) {
  ------------------
  |  Branch (1088:24): [True: 2.59M, False: 22.5k]
  ------------------
 1089|  2.59M|    if (p + 12 > pLast_) {
  ------------------
  |  Branch (1089:9): [True: 35.0k, False: 2.55M]
  ------------------
 1090|  35.0k|#ifndef SUPPRESS_WARNINGS
 1091|  35.0k|      EXV_ERROR << "Directory " << groupName(object->group()) << ": IFD entry " << i
  ------------------
  |  |  142|  35.0k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 35.0k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  35.0k|  LogMsg(LogMsg::error).os()
  ------------------
 1092|      0|                << " lies outside of the data buffer.\n";
 1093|  35.0k|#endif
 1094|  35.0k|      return;
 1095|  35.0k|    }
 1096|  2.55M|    uint16_t tag = getUShort(p, byteOrder());
 1097|  2.55M|    if (auto tc = TiffCreator::create(tag, object->group())) {
  ------------------
  |  Branch (1097:14): [True: 2.40M, False: 147k]
  ------------------
 1098|  2.40M|      tc->setStart(p);
 1099|  2.40M|      object->addChild(std::move(tc));
 1100|  2.40M|    } else {
 1101|   147k|#ifndef SUPPRESS_WARNINGS
 1102|   147k|      EXV_WARNING << "Unable to handle tag " << tag << ".\n";
  ------------------
  |  |  138|   147k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 147k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|   147k|  LogMsg(LogMsg::warn).os()
  ------------------
 1103|   147k|#endif
 1104|   147k|    }
 1105|  2.55M|    p += 12;
 1106|  2.55M|  }
 1107|       |
 1108|  22.5k|  if (object->hasNext()) {
  ------------------
  |  Branch (1108:7): [True: 22.5k, False: 38]
  ------------------
 1109|  22.5k|    if (p + 4 > pLast_) {
  ------------------
  |  Branch (1109:9): [True: 226, False: 22.2k]
  ------------------
 1110|    226|#ifndef SUPPRESS_WARNINGS
 1111|    226|      EXV_ERROR << "Directory " << groupName(object->group())
  ------------------
  |  |  142|    226|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 226]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    226|  LogMsg(LogMsg::error).os()
  ------------------
 1112|      0|                << ": IFD exceeds data buffer, cannot read next pointer.\n";
 1113|    226|#endif
 1114|    226|      return;
 1115|    226|    }
 1116|  22.2k|    TiffComponent::UniquePtr tc;
 1117|  22.2k|    uint32_t next = getULong(p, byteOrder());
 1118|  22.2k|    if (next) {
  ------------------
  |  Branch (1118:9): [True: 20.2k, False: 2.08k]
  ------------------
 1119|  20.2k|      tc = TiffCreator::create(Tag::next, object->group());
 1120|  20.2k|#ifndef SUPPRESS_WARNINGS
 1121|  20.2k|      if (!tc) {
  ------------------
  |  Branch (1121:11): [True: 15.9k, False: 4.21k]
  ------------------
 1122|  15.9k|        EXV_WARNING << "Directory " << groupName(object->group()) << " has an unexpected next pointer; ignored.\n";
  ------------------
  |  |  138|  15.9k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 15.9k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  15.9k|  LogMsg(LogMsg::warn).os()
  ------------------
 1123|  15.9k|      }
 1124|  20.2k|#endif
 1125|  20.2k|    }
 1126|  22.2k|    if (tc) {
  ------------------
  |  Branch (1126:9): [True: 4.21k, False: 18.0k]
  ------------------
 1127|  4.21k|      if (next > size_ || baseOffset() > size_ - next) {
  ------------------
  |  Branch (1127:11): [True: 2.34k, False: 1.87k]
  |  Branch (1127:27): [True: 7, False: 1.86k]
  ------------------
 1128|  2.34k|#ifndef SUPPRESS_WARNINGS
 1129|  2.34k|        EXV_ERROR << "Directory " << groupName(object->group()) << ": Next pointer is out of bounds; ignored.\n";
  ------------------
  |  |  142|  2.34k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 2.34k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  2.34k|  LogMsg(LogMsg::error).os()
  ------------------
 1130|  2.34k|#endif
 1131|  2.34k|        return;
 1132|  2.34k|      }
 1133|  1.86k|      tc->setStart(pData_ + baseOffset() + next);
 1134|  1.86k|      object->addNext(std::move(tc));
 1135|  1.86k|    }
 1136|  22.2k|  }  // object->hasNext()
 1137|       |
 1138|  22.5k|}  // TiffReader::visitDirectory
_ZN5Exiv28Internal10TiffReader11visitSubIfdEPNS0_10TiffSubIfdE:
 1140|  16.2k|void TiffReader::visitSubIfd(TiffSubIfd* object) {
 1141|  16.2k|  readTiffEntry(object);
 1142|  16.2k|  if ((object->tiffType() == ttUnsignedLong || object->tiffType() == ttSignedLong || object->tiffType() == ttTiffIfd) &&
  ------------------
  |  Branch (1142:8): [True: 8.80k, False: 7.44k]
  |  Branch (1142:48): [True: 2.32k, False: 5.11k]
  |  Branch (1142:86): [True: 3.72k, False: 1.39k]
  ------------------
 1143|  14.8k|      object->count() >= 1) {
  ------------------
  |  Branch (1143:7): [True: 11.0k, False: 3.84k]
  ------------------
 1144|       |    // Todo: Fix hack
 1145|  11.0k|    uint32_t maxi = 9;
 1146|  11.0k|    if (object->group() == IfdId::ifd1Id)
  ------------------
  |  Branch (1146:9): [True: 131, False: 10.8k]
  ------------------
 1147|    131|      maxi = 1;
 1148|  67.5k|    for (uint32_t i = 0; i < object->count(); ++i) {
  ------------------
  |  Branch (1148:26): [True: 66.2k, False: 1.33k]
  ------------------
 1149|  66.2k|      const uint32_t offset = getULong(object->pData() + (4 * i), byteOrder());
 1150|  66.2k|      if (offset > size_ || baseOffset() > size_ - offset) {
  ------------------
  |  Branch (1150:11): [True: 9.39k, False: 56.8k]
  |  Branch (1150:29): [True: 40, False: 56.7k]
  ------------------
 1151|  9.43k|#ifndef SUPPRESS_WARNINGS
 1152|  9.43k|        EXV_ERROR << "Directory " << groupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
  ------------------
  |  |  142|  9.43k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 9.43k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  9.43k|  LogMsg(LogMsg::error).os()
  ------------------
 1153|      0|                  << std::hex << object->tag() << " Sub-IFD pointer " << i << " is out of bounds; ignoring it.\n";
 1154|  9.43k|#endif
 1155|  9.43k|        return;
 1156|  9.43k|      }
 1157|  56.7k|      if (i >= maxi) {
  ------------------
  |  Branch (1157:11): [True: 233, False: 56.5k]
  ------------------
 1158|    233|#ifndef SUPPRESS_WARNINGS
 1159|    233|        EXV_WARNING << "Directory " << groupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
  ------------------
  |  |  138|    233|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 233]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    233|  LogMsg(LogMsg::warn).os()
  ------------------
 1160|      0|                    << std::hex << object->tag() << ": Skipping sub-IFDs beyond the first " << i << ".\n";
 1161|    233|#endif
 1162|    233|        break;
 1163|    233|      }
 1164|       |      // If there are multiple dirs, group is incremented for each
 1165|  56.5k|      auto td = std::make_unique<TiffDirectory>(object->tag(),
 1166|  56.5k|                                                static_cast<IfdId>(static_cast<uint32_t>(object->newGroup_) + i));
 1167|  56.5k|      td->setStart(pData_ + baseOffset() + offset);
 1168|  56.5k|      object->addChild(std::move(td));
 1169|  56.5k|    }
 1170|  11.0k|  }
 1171|  5.23k|#ifndef SUPPRESS_WARNINGS
 1172|  5.23k|  else {
 1173|  5.23k|    EXV_WARNING << "Directory " << groupName(object->group()) << ", entry 0x" << std::setw(4) << std::setfill('0')
  ------------------
  |  |  138|  5.23k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 5.23k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  5.23k|  LogMsg(LogMsg::warn).os()
  ------------------
 1174|      0|                << std::hex << object->tag() << " doesn't look like a sub-IFD.\n";
 1175|  5.23k|  }
 1176|  16.2k|#endif
 1177|       |
 1178|  16.2k|}  // TiffReader::visitSubIfd
_ZN5Exiv28Internal10TiffReader12visitMnEntryEPNS0_11TiffMnEntryE:
 1180|  15.1k|void TiffReader::visitMnEntry(TiffMnEntry* object) {
 1181|  15.1k|  readTiffEntry(object);
 1182|       |  // Find camera make
 1183|  15.1k|  TiffFinder finder(0x010f, IfdId::ifd0Id);
 1184|  15.1k|  pRoot_->accept(finder);
 1185|  15.1k|  auto te = dynamic_cast<const TiffEntryBase*>(finder.result());
 1186|  15.1k|  if (te && te->pValue()) {
  ------------------
  |  Branch (1186:7): [True: 14.5k, False: 614]
  |  Branch (1186:13): [True: 14.2k, False: 284]
  ------------------
 1187|  14.2k|    auto make = te->pValue()->toString();
 1188|       |    // create concrete makernote, based on make and makernote contents
 1189|  14.2k|    object->mn_ =
 1190|  14.2k|        TiffMnCreator::create(object->tag(), object->mnGroup_, make, object->pData_, object->size_, byteOrder());
 1191|  14.2k|  }
 1192|  15.1k|  if (object->mn_)
  ------------------
  |  Branch (1192:7): [True: 5.74k, False: 9.41k]
  ------------------
 1193|  5.74k|    object->mn_->setStart(object->pData());
 1194|       |
 1195|  15.1k|}  // TiffReader::visitMnEntry
_ZN5Exiv28Internal10TiffReader17visitIfdMakernoteEPNS0_16TiffIfdMakernoteE:
 1197|  5.74k|void TiffReader::visitIfdMakernote(TiffIfdMakernote* object) {
 1198|  5.74k|  object->setImageByteOrder(byteOrder());  // set the byte order for the image
 1199|       |
 1200|  5.74k|  if (!object->readHeader(object->start(), pLast_ - object->start(), byteOrder())) {
  ------------------
  |  Branch (1200:7): [True: 766, False: 4.98k]
  ------------------
 1201|    766|#ifndef SUPPRESS_WARNINGS
 1202|    766|    EXV_ERROR << "Failed to read " << groupName(object->ifd_.group()) << " IFD Makernote header.\n";
  ------------------
  |  |  142|    766|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 766]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|    766|  LogMsg(LogMsg::error).os()
  ------------------
 1203|       |#ifdef EXIV2_DEBUG_MESSAGES
 1204|       |    if (pLast_ - object->start() >= 16u) {
 1205|       |      hexdump(std::cerr, object->start(), 16u);
 1206|       |    }
 1207|       |#endif  // EXIV2_DEBUG_MESSAGES
 1208|    766|#endif  // SUPPRESS_WARNINGS
 1209|    766|    setGo(geKnownMakernote, false);
 1210|    766|    return;
 1211|    766|  }
 1212|       |
 1213|  4.98k|  auto start = object->start();
 1214|  4.98k|  auto offset = object->ifdOffset();
 1215|  4.98k|  enforce(pData_ <= start, ErrorCode::kerCorruptedMetadata);
 1216|  4.98k|  enforce(start <= pLast_, ErrorCode::kerCorruptedMetadata);
 1217|  4.98k|  enforce(offset <= static_cast<size_t>(pLast_ - start), ErrorCode::kerCorruptedMetadata);
 1218|  4.98k|  object->ifd_.setStart(start + offset);
 1219|       |
 1220|       |  // Modify reader for Makernote peculiarities, byte order and offset
 1221|  4.98k|  object->mnOffset_ = start - pData_;
 1222|  4.98k|  auto state = TiffRwState{object->byteOrder(), object->baseOffset()};
 1223|  4.98k|  setMnState(&state);
 1224|       |
 1225|  4.98k|}  // TiffReader::visitIfdMakernote
_ZN5Exiv28Internal10TiffReader20visitIfdMakernoteEndEPNS0_16TiffIfdMakernoteE:
 1227|  4.89k|void TiffReader::visitIfdMakernoteEnd(TiffIfdMakernote* /*object*/) {
 1228|       |  // Reset state (byte order, create function, offset) back to that for the image
 1229|  4.89k|  setOrigState();
 1230|  4.89k|}  // TiffReader::visitIfdMakernoteEnd
_ZN5Exiv28Internal10TiffReader13readTiffEntryEPNS0_13TiffEntryBaseE:
 1232|  2.37M|void TiffReader::readTiffEntry(TiffEntryBase* object) {
 1233|  2.37M|  try {
 1234|  2.37M|    byte* p = object->start();
 1235|       |
 1236|  2.37M|    if (p + 12 > pLast_) {
  ------------------
  |  Branch (1236:9): [True: 3, False: 2.37M]
  ------------------
 1237|      3|#ifndef SUPPRESS_WARNINGS
 1238|      3|      EXV_ERROR << "Entry in directory " << groupName(object->group())
  ------------------
  |  |  142|      3|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 3]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      3|  LogMsg(LogMsg::error).os()
  ------------------
 1239|      0|                << "requests access to memory beyond the data buffer. " << "Skipping entry.\n";
 1240|      3|#endif
 1241|      3|      return;
 1242|      3|    }
 1243|       |    // Component already has tag
 1244|  2.37M|    p += 2;
 1245|  2.37M|    auto tiffType = static_cast<TiffType>(getUShort(p, byteOrder()));
 1246|  2.37M|    TypeId typeId = toTypeId(tiffType, object->tag(), object->group());
 1247|  2.37M|    size_t typeSize = TypeInfo::typeSize(typeId);
 1248|  2.37M|    if (0 == typeSize) {
  ------------------
  |  Branch (1248:9): [True: 2.13M, False: 240k]
  ------------------
 1249|  2.13M|#ifndef SUPPRESS_WARNINGS
 1250|  2.13M|      EXV_WARNING << stringFormat(
  ------------------
  |  |  138|  2.13M|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 2.13M]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  2.13M|  LogMsg(LogMsg::warn).os()
  ------------------
                    EXV_WARNING << stringFormat(
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
 1251|      0|          "Directory {}, entry 0x{:04x} has unknown Exif (TIFF) type {}; setting type size 1.\n",
 1252|      0|          groupName(object->group()), object->tag(), static_cast<uint16_t>(tiffType));
 1253|  2.13M|#endif
 1254|  2.13M|      typeSize = 1;
 1255|  2.13M|    }
 1256|  2.37M|    p += 2;
 1257|  2.37M|    uint32_t count = getULong(p, byteOrder());
 1258|  2.37M|    if (count >= 0x10000000) {
  ------------------
  |  Branch (1258:9): [True: 1.21M, False: 1.16M]
  ------------------
 1259|  1.21M|#ifndef SUPPRESS_WARNINGS
 1260|  1.21M|      EXV_ERROR << stringFormat("Directory {}, entry 0x{:04x} has invalid size {}*{}; skipping entry.\n",
  ------------------
  |  |  142|  1.21M|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 1.21M]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  1.21M|  LogMsg(LogMsg::error).os()
  ------------------
                    EXV_ERROR << stringFormat("Directory {}, entry 0x{:04x} has invalid size {}*{}; skipping entry.\n",
  ------------------
  |  |   18|      0|#define stringFormat std::format
  ------------------
 1261|      0|                                groupName(object->group()), object->tag(), count, typeSize);
 1262|  1.21M|#endif
 1263|  1.21M|      return;
 1264|  1.21M|    }
 1265|  1.16M|    p += 4;
 1266|       |
 1267|  1.16M|    if (count > std::numeric_limits<size_t>::max() / typeSize) {
  ------------------
  |  Branch (1267:9): [True: 0, False: 1.16M]
  ------------------
 1268|      0|      throw Error(ErrorCode::kerArithmeticOverflow);
 1269|      0|    }
 1270|  1.16M|    size_t size = typeSize * count;
 1271|  1.16M|    size_t offset = getULong(p, byteOrder());
 1272|  1.16M|    byte* pData = p;
 1273|  1.16M|    if (size > 4 && Safe::add<size_t>(baseOffset(), offset) >= size_) {
  ------------------
  |  Branch (1273:9): [True: 885k, False: 275k]
  |  Branch (1273:21): [True: 686k, False: 199k]
  ------------------
 1274|       |      // #1143
 1275|   686k|      if (object->tag() == 0x2001 && std::string(groupName(object->group())) == "Sony1") {
  ------------------
  |  Branch (1275:11): [True: 542, False: 685k]
  |  Branch (1275:11): [True: 89, False: 685k]
  |  Branch (1275:38): [True: 89, False: 453]
  ------------------
 1276|       |        // This tag is Exif.Sony1.PreviewImage, which refers to a preview image which is
 1277|       |        // not stored in the metadata. Instead it is stored at the end of the file, after
 1278|       |        // the main image. The value of `size` refers to the size of the preview image, not
 1279|       |        // the size of the tag's payload, so we set it to zero here so that we don't attempt
 1280|       |        // to read those bytes from the metadata. We currently leave this tag as "undefined",
 1281|       |        // although we may attempt to handle it better in the future. More discussion of
 1282|       |        // this issue can be found here:
 1283|       |        //
 1284|       |        //   https://github.com/Exiv2/exiv2/issues/2001
 1285|       |        //   https://github.com/Exiv2/exiv2/pull/2008
 1286|       |        //   https://github.com/Exiv2/exiv2/pull/2013
 1287|     89|        typeId = undefined;
 1288|     89|        size = 0;
 1289|   685k|      } else {
 1290|   685k|#ifndef SUPPRESS_WARNINGS
 1291|   685k|        EXV_ERROR << "Offset of directory " << groupName(object->group()) << ", entry 0x" << std::setw(4)
  ------------------
  |  |  142|   685k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 685k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|   685k|  LogMsg(LogMsg::error).os()
  ------------------
 1292|      0|                  << std::setfill('0') << std::hex << object->tag() << " is out of bounds: " << "Offset = 0x"
 1293|      0|                  << std::setw(8) << std::setfill('0') << std::hex << offset << "; truncating the entry\n";
 1294|   685k|#endif
 1295|   685k|      }
 1296|   686k|      size = 0;
 1297|   686k|    }
 1298|  1.16M|    if (size > 4) {
  ------------------
  |  Branch (1298:9): [True: 199k, False: 961k]
  ------------------
 1299|       |      // setting pData to pData_ + baseOffset() + offset can result in pData pointing to invalid memory,
 1300|       |      // as offset can be arbitrarily large
 1301|   199k|      if (Safe::add<size_t>(baseOffset(), offset) > static_cast<size_t>(pLast_ - pData_)) {
  ------------------
  |  Branch (1301:11): [True: 0, False: 199k]
  ------------------
 1302|      0|        throw Error(ErrorCode::kerCorruptedMetadata);
 1303|      0|      }
 1304|   199k|      pData = const_cast<byte*>(pData_) + baseOffset() + offset;
 1305|       |
 1306|       |      // check for size being invalid
 1307|   199k|      if (size > static_cast<size_t>(pLast_ - pData)) {
  ------------------
  |  Branch (1307:11): [True: 99.1k, False: 100k]
  ------------------
 1308|  99.1k|#ifndef SUPPRESS_WARNINGS
 1309|  99.1k|        EXV_ERROR << "Upper boundary of data for " << "directory " << groupName(object->group()) << ", entry 0x"
  ------------------
  |  |  142|  99.1k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 99.1k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  99.1k|  LogMsg(LogMsg::error).os()
  ------------------
 1310|      0|                  << std::setw(4) << std::setfill('0') << std::hex << object->tag()
 1311|      0|                  << " is out of bounds: " << "Offset = 0x" << std::setw(8) << std::setfill('0') << std::hex << offset
 1312|      0|                  << ", size = " << std::dec << size
 1313|      0|                  << ", exceeds buffer size by "
 1314|       |                  // cast to make MSVC happy
 1315|      0|                  << size - static_cast<size_t>(pLast_ - pData) << " Bytes; truncating the entry\n";
 1316|  99.1k|#endif
 1317|  99.1k|        size = 0;
 1318|  99.1k|      }
 1319|   199k|    }
 1320|  1.16M|    auto v = Value::create(typeId);
 1321|  1.16M|    enforce(v != nullptr, ErrorCode::kerCorruptedMetadata);
 1322|  1.16M|    v->read(pData, size, byteOrder());
 1323|       |
 1324|  1.16M|    object->setValue(std::move(v));
 1325|  1.16M|    auto d = std::make_shared<DataBuf>();
 1326|  1.16M|    object->setData(pData, size, std::move(d));
 1327|  1.16M|    object->setOffset(offset);
 1328|  1.16M|    object->setIdx(nextIdx(object->group()));
 1329|  1.16M|  } catch (std::overflow_error&) {
 1330|      0|    throw Error(ErrorCode::kerCorruptedMetadata);  // #562 don't throw std::overflow_error
 1331|      0|  }
 1332|  2.37M|}  // TiffReader::readTiffEntry
_ZN5Exiv28Internal10TiffReader16visitBinaryArrayEPNS0_15TiffBinaryArrayE:
 1334|  20.4k|void TiffReader::visitBinaryArray(TiffBinaryArray* object) {
 1335|  20.4k|  if (!postProc_) {
  ------------------
  |  Branch (1335:7): [True: 10.2k, False: 10.2k]
  ------------------
 1336|       |    // Defer reading children until after all other components are read, but
 1337|       |    // since state (offset) is not set during post-processing, read entry here
 1338|  10.2k|    readTiffEntry(object);
 1339|  10.2k|    object->iniOrigDataBuf();
 1340|  10.2k|    postList_.push_back(object);
 1341|  10.2k|    return;
 1342|  10.2k|  }
 1343|       |  // Check duplicates
 1344|  10.2k|  TiffFinder finder(object->tag(), object->group());
 1345|  10.2k|  pRoot_->accept(finder);
 1346|  10.2k|  if (auto te = dynamic_cast<const TiffEntryBase*>(finder.result())) {
  ------------------
  |  Branch (1346:12): [True: 9.03k, False: 1.20k]
  ------------------
 1347|  9.03k|    if (te->idx() != object->idx()) {
  ------------------
  |  Branch (1347:9): [True: 4.12k, False: 4.90k]
  ------------------
 1348|  4.12k|#ifndef SUPPRESS_WARNINGS
 1349|  4.12k|      EXV_WARNING << "Not decoding duplicate binary array tag 0x" << std::setw(4) << std::setfill('0') << std::hex
  ------------------
  |  |  138|  4.12k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 4.12k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  4.12k|  LogMsg(LogMsg::warn).os()
  ------------------
 1350|      0|                  << object->tag() << std::dec << ", group " << groupName(object->group()) << ", idx " << object->idx()
 1351|      0|                  << "\n";
 1352|  4.12k|#endif
 1353|  4.12k|      object->setDecoded(false);
 1354|  4.12k|      return;
 1355|  4.12k|    }
 1356|  9.03k|  }
 1357|       |
 1358|  6.11k|  if (object->TiffEntryBase::doSize() == 0)
  ------------------
  |  Branch (1358:7): [True: 2.94k, False: 3.17k]
  ------------------
 1359|  2.94k|    return;
 1360|  3.17k|  if (!object->initialize(pRoot_))
  ------------------
  |  Branch (1360:7): [True: 552, False: 2.62k]
  ------------------
 1361|    552|    return;
 1362|  2.62k|  const ArrayCfg* cfg = object->cfg();
 1363|  2.62k|  if (!cfg)
  ------------------
  |  Branch (1363:7): [True: 0, False: 2.62k]
  ------------------
 1364|      0|    return;
 1365|       |
 1366|  2.62k|  if (auto cryptFct = cfg->cryptFct_) {
  ------------------
  |  Branch (1366:12): [True: 775, False: 1.84k]
  ------------------
 1367|    775|    const byte* pData = object->pData();
 1368|    775|    size_t size = object->TiffEntryBase::doSize();
 1369|    775|    auto buf = std::make_shared<DataBuf>(cryptFct(object->tag(), pData, size, pRoot_));
 1370|    775|    if (!buf->empty())
  ------------------
  |  Branch (1370:9): [True: 576, False: 199]
  ------------------
 1371|    576|      object->setData(std::move(buf));
 1372|    775|  }
 1373|       |
 1374|  2.62k|  const ArrayDef* defs = object->def();
 1375|  2.62k|  const ArrayDef* defsEnd = defs + object->defSize();
 1376|  2.62k|  const ArrayDef* def = &cfg->elDefaultDef_;
 1377|  2.62k|  ArrayDef gap = *def;
 1378|       |
 1379|  1.35M|  for (size_t idx = 0; idx < object->TiffEntryBase::doSize();) {
  ------------------
  |  Branch (1379:24): [True: 1.35M, False: 2.62k]
  ------------------
 1380|  1.35M|    if (defs) {
  ------------------
  |  Branch (1380:9): [True: 1.34M, False: 11.7k]
  ------------------
 1381|  1.34M|      def = std::find(defs, defsEnd, idx);
 1382|  1.34M|      if (def == defsEnd) {
  ------------------
  |  Branch (1382:11): [True: 1.33M, False: 8.24k]
  ------------------
 1383|  1.33M|        if (cfg->concat_) {
  ------------------
  |  Branch (1383:13): [True: 577, False: 1.33M]
  ------------------
 1384|       |          // Determine gap-size
 1385|    577|          const ArrayDef* xdef = defs;
 1386|  2.82k|          for (; xdef != defsEnd && xdef->idx_ <= idx; ++xdef) {
  ------------------
  |  Branch (1386:18): [True: 2.65k, False: 169]
  |  Branch (1386:37): [True: 2.25k, False: 408]
  ------------------
 1387|  2.25k|          }
 1388|    577|          size_t gapSize = 0;
 1389|    577|          if (xdef != defsEnd && xdef->idx_ > idx) {
  ------------------
  |  Branch (1389:15): [True: 408, False: 169]
  |  Branch (1389:34): [True: 408, False: 0]
  ------------------
 1390|    408|            gapSize = xdef->idx_ - idx;
 1391|    408|          } else {
 1392|    169|            gapSize = object->TiffEntryBase::doSize() - idx;
 1393|    169|          }
 1394|    577|          gap.idx_ = idx;
 1395|    577|          gap.tiffType_ = cfg->elDefaultDef_.tiffType_;
 1396|    577|          gap.count_ = gapSize / cfg->tagStep();
 1397|    577|          if (gap.count_ * cfg->tagStep() != gapSize) {
  ------------------
  |  Branch (1397:15): [True: 10, False: 567]
  ------------------
 1398|     10|            gap.tiffType_ = ttUndefined;
 1399|     10|            gap.count_ = gapSize;
 1400|     10|          }
 1401|    577|          def = &gap;
 1402|  1.33M|        } else {
 1403|  1.33M|          def = &cfg->elDefaultDef_;
 1404|  1.33M|        }
 1405|  1.33M|      }
 1406|  1.34M|    }
 1407|  1.35M|    idx += object->addElement(idx, *def);  // idx may be different from def->idx_
 1408|  1.35M|  }
 1409|       |
 1410|  2.62k|}  // TiffReader::visitBinaryArray
_ZN5Exiv28Internal10TiffReader18visitBinaryElementEPNS0_17TiffBinaryElementE:
 1412|  1.38M|void TiffReader::visitBinaryElement(TiffBinaryElement* object) {
 1413|  1.38M|  auto pData = object->start();
 1414|  1.38M|  size_t size = object->TiffEntryBase::doSize();
 1415|  1.38M|  ByteOrder bo = object->elByteOrder();
 1416|  1.38M|  if (bo == invalidByteOrder)
  ------------------
  |  Branch (1416:7): [True: 60.4k, False: 1.32M]
  ------------------
 1417|  60.4k|    bo = byteOrder();
 1418|  1.38M|  TypeId typeId = toTypeId(object->elDef()->tiffType_, object->tag(), object->group());
 1419|  1.38M|  auto v = Value::create(typeId);
 1420|  1.38M|  enforce(v != nullptr, ErrorCode::kerCorruptedMetadata);
 1421|  1.38M|  v->read(pData, size, bo);
 1422|       |
 1423|  1.38M|  object->setValue(std::move(v));
 1424|  1.38M|  object->setOffset(0);
 1425|  1.38M|  object->setIdx(nextIdx(object->group()));
 1426|  1.38M|}
tiffvisitor_int.cpp:_ZN5Exiv28InternalL7findTagEPKNS_7TagInfoEt:
  347|  4.32k|static const TagInfo* findTag(const TagInfo* pList, uint16_t tag) {
  348|   302k|  while (pList->tag_ != 0xffff && pList->tag_ != tag)
  ------------------
  |  Branch (348:10): [True: 302k, False: 0]
  |  Branch (348:35): [True: 298k, False: 4.32k]
  ------------------
  349|   298k|    pList++;
  350|  4.32k|  return pList->tag_ != 0xffff ? pList : nullptr;
  ------------------
  |  Branch (350:10): [True: 4.32k, False: 0]
  ------------------
  351|  4.32k|}
tiffvisitor_int.cpp:_ZN12_GLOBAL__N_117stringToByteOrderENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   48|  5.16k|Exiv2::ByteOrder stringToByteOrder(std::string_view val) {
   49|  5.16k|  if (val == "II")
  ------------------
  |  Branch (49:7): [True: 110, False: 5.05k]
  ------------------
   50|    110|    return Exiv2::littleEndian;
   51|  5.05k|  if (val == "MM")
  ------------------
  |  Branch (51:7): [True: 5.05k, False: 0]
  ------------------
   52|  5.05k|    return Exiv2::bigEndian;
   53|       |
   54|      0|  return Exiv2::invalidByteOrder;
   55|  5.05k|}
tiffvisitor_int.cpp:_ZNK12_GLOBAL__N_114FindExifdatum2clERKN5Exiv29ExifdatumE:
   38|   279k|  bool operator()(const Exiv2::Exifdatum& md) const {
   39|   279k|    return idx_ == md.idx() && md.groupName() == groupName_;
  ------------------
  |  Branch (39:12): [True: 2.32k, False: 277k]
  |  Branch (39:32): [True: 115, False: 2.21k]
  ------------------
   40|   279k|  }
tiffvisitor_int.cpp:_ZN12_GLOBAL__N_114FindExifdatum2C2EN5Exiv25IfdIdEi:
   35|  3.76k|  FindExifdatum2(Exiv2::IfdId group, int idx) : groupName_(Exiv2::Internal::groupName(group)), idx_(idx) {
   36|  3.76k|  }

_ZN5Exiv28Internal11TiffVisitorD2Ev:
   64|  51.0k|  virtual ~TiffVisitor() = default;
_ZN5Exiv28Internal11TiffEncoderD2Ev:
  355|  14.9k|  ~TiffEncoder() override = default;
_ZN5Exiv28Internal11TiffRwStateC2ENS_9ByteOrderEm:
  538|  23.2k|  constexpr TiffRwState(ByteOrder byteOrder, size_t baseOffset) : byteOrder_(byteOrder), baseOffset_(baseOffset) {
  539|  23.2k|  }
_ZN5Exiv28Internal10TiffFinderC2EtNS_5IfdIdE:
  141|   211k|  constexpr TiffFinder(uint16_t tag, IfdId group) : tag_(tag), group_(group) {
  142|   211k|  }
_ZN5Exiv28Internal11TiffVisitorC2Ev:
   62|   262k|  TiffVisitor() = default;
_ZNK5Exiv28Internal10TiffFinder6resultEv:
  180|   211k|  [[nodiscard]] TiffComponent* result() const {
  181|   211k|    return tiffComponent_;
  182|   211k|  }
_ZNK5Exiv28Internal11TiffEncoder9byteOrderEv:
  458|  2.36M|  [[nodiscard]] ByteOrder byteOrder() const {
  459|  2.36M|    return byteOrder_;
  460|  2.36M|  }
_ZNK5Exiv28Internal11TiffEncoder11writeMethodEv:
  467|  12.6k|  [[nodiscard]] WriteMethod writeMethod() const {
  468|  12.6k|    return writeMethod_;
  469|  12.6k|  }
_ZNK5Exiv28Internal11TiffRwState9byteOrderEv:
  548|  9.88M|  [[nodiscard]] ByteOrder byteOrder() const {
  549|  9.88M|    return byteOrder_;
  550|  9.88M|  }
_ZNK5Exiv28Internal11TiffRwState10baseOffsetEv:
  562|  1.45M|  [[nodiscard]] size_t baseOffset() const {
  563|  1.45M|    return baseOffset_;
  564|  1.45M|  }

_ZN5Exiv28TypeInfo8typeSizeENS_6TypeIdE:
   96|  7.62M|size_t TypeInfo::typeSize(TypeId typeId) {
   97|  7.62M|  if (auto tit = Exiv2::find(typeInfoTable, typeId))
  ------------------
  |  Branch (97:12): [True: 5.48M, False: 2.13M]
  ------------------
   98|  5.48M|    return tit->size_;
   99|  2.13M|  return 0;
  100|  7.62M|}
_ZN5Exiv27DataBufC2Em:
  102|  5.83M|DataBuf::DataBuf(size_t size) : pData_(size) {
  103|  5.83M|}
_ZN5Exiv27DataBufC2EPKhm:
  105|  48.4k|DataBuf::DataBuf(const byte* pData, size_t size) : pData_(pData, pData + size) {
  106|  48.4k|}
_ZN5Exiv27DataBuf5allocEm:
  108|  20.2k|void DataBuf::alloc(size_t size) {
  109|  20.2k|  pData_.resize(size);
  110|  20.2k|}
_ZN5Exiv27DataBuf6resizeEm:
  112|   145k|void DataBuf::resize(size_t size) {
  113|   145k|  pData_.resize(size);
  114|   145k|}
_ZN5Exiv27DataBuf5resetEv:
  116|  28.1k|void DataBuf::reset() {
  117|  28.1k|  pData_.clear();
  118|  28.1k|}
_ZNK5Exiv27DataBuf10read_uint8Em:
  120|   945k|uint8_t Exiv2::DataBuf::read_uint8(size_t offset) const {
  121|   945k|  if (offset >= pData_.size()) {
  ------------------
  |  Branch (121:7): [True: 0, False: 945k]
  ------------------
  122|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::read_uint8");
  123|      0|  }
  124|   945k|  return pData_[offset];
  125|   945k|}
_ZN5Exiv27DataBuf11write_uint8Emh:
  127|   724k|void Exiv2::DataBuf::write_uint8(size_t offset, uint8_t x) {
  128|   724k|  if (offset >= pData_.size()) {
  ------------------
  |  Branch (128:7): [True: 0, False: 724k]
  ------------------
  129|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::write_uint8");
  130|      0|  }
  131|   724k|  pData_[offset] = x;
  132|   724k|}
_ZNK5Exiv27DataBuf11read_uint16EmNS_9ByteOrderE:
  134|   487k|uint16_t Exiv2::DataBuf::read_uint16(size_t offset, ByteOrder byteOrder) const {
  135|   487k|  if (pData_.size() < 2 || offset > (pData_.size() - 2)) {
  ------------------
  |  Branch (135:7): [True: 0, False: 487k]
  |  Branch (135:28): [True: 2, False: 487k]
  ------------------
  136|      2|    throw std::out_of_range("Overflow in Exiv2::DataBuf::read_uint16");
  137|      2|  }
  138|   487k|  return getUShort(&pData_[offset], byteOrder);
  139|   487k|}
_ZN5Exiv27DataBuf12write_uint16EmtNS_9ByteOrderE:
  141|  11.1k|void Exiv2::DataBuf::write_uint16(size_t offset, uint16_t x, ByteOrder byteOrder) {
  142|  11.1k|  if (pData_.size() < 2 || offset > (pData_.size() - 2)) {
  ------------------
  |  Branch (142:7): [True: 0, False: 11.1k]
  |  Branch (142:28): [True: 0, False: 11.1k]
  ------------------
  143|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::write_uint16");
  144|      0|  }
  145|  11.1k|  us2Data(&pData_[offset], x, byteOrder);
  146|  11.1k|}
_ZNK5Exiv27DataBuf11read_uint32EmNS_9ByteOrderE:
  148|   245k|uint32_t Exiv2::DataBuf::read_uint32(size_t offset, ByteOrder byteOrder) const {
  149|   245k|  if (pData_.size() < 4 || offset > (pData_.size() - 4)) {
  ------------------
  |  Branch (149:7): [True: 0, False: 245k]
  |  Branch (149:28): [True: 1, False: 245k]
  ------------------
  150|      1|    throw std::out_of_range("Overflow in Exiv2::DataBuf::read_uint32");
  151|      1|  }
  152|   245k|  return getULong(&pData_[offset], byteOrder);
  153|   245k|}
_ZN5Exiv27DataBuf12write_uint32EmjNS_9ByteOrderE:
  155|  11.1k|void Exiv2::DataBuf::write_uint32(size_t offset, uint32_t x, ByteOrder byteOrder) {
  156|  11.1k|  if (pData_.size() < 4 || offset > (pData_.size() - 4)) {
  ------------------
  |  Branch (156:7): [True: 0, False: 11.1k]
  |  Branch (156:28): [True: 0, False: 11.1k]
  ------------------
  157|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::write_uint32");
  158|      0|  }
  159|  11.1k|  ul2Data(&pData_[offset], x, byteOrder);
  160|  11.1k|}
_ZNK5Exiv27DataBuf11read_uint64EmNS_9ByteOrderE:
  162|  9.08k|uint64_t Exiv2::DataBuf::read_uint64(size_t offset, ByteOrder byteOrder) const {
  163|  9.08k|  if (pData_.size() < 8 || offset > (pData_.size() - 8)) {
  ------------------
  |  Branch (163:7): [True: 0, False: 9.08k]
  |  Branch (163:28): [True: 0, False: 9.08k]
  ------------------
  164|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::read_uint64");
  165|      0|  }
  166|  9.08k|  return getULongLong(&pData_[offset], byteOrder);
  167|  9.08k|}
_ZNK5Exiv27DataBuf8cmpBytesEmPKvm:
  176|   331k|int Exiv2::DataBuf::cmpBytes(size_t offset, const void* buf, size_t bufsize) const {
  177|   331k|  if (pData_.size() < bufsize || offset > pData_.size() - bufsize) {
  ------------------
  |  Branch (177:7): [True: 0, False: 331k]
  |  Branch (177:34): [True: 0, False: 331k]
  ------------------
  178|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::cmpBytes");
  179|      0|  }
  180|   331k|  return memcmp(&pData_[offset], buf, bufsize);
  181|   331k|}
_ZN5Exiv27DataBuf4dataEm:
  183|  6.31M|byte* Exiv2::DataBuf::data(size_t offset) {
  184|  6.31M|  return const_cast<byte*>(c_data(offset));
  185|  6.31M|}
_ZNK5Exiv27DataBuf6c_dataEm:
  187|  8.60M|const byte* Exiv2::DataBuf::c_data(size_t offset) const {
  188|  8.60M|  if (pData_.empty() || offset == pData_.size()) {
  ------------------
  |  Branch (188:7): [True: 1.14M, False: 7.45M]
  |  Branch (188:25): [True: 6.35k, False: 7.45M]
  ------------------
  189|  1.15M|    return nullptr;
  190|  1.15M|  }
  191|  7.45M|  if (offset > pData_.size()) {
  ------------------
  |  Branch (191:7): [True: 0, False: 7.45M]
  ------------------
  192|      0|    throw std::out_of_range("Overflow in Exiv2::DataBuf::c_data");
  193|      0|  }
  194|  7.45M|  return &pData_[offset];
  195|  7.45M|}
_ZNK5Exiv27DataBuf5c_strEm:
  197|  31.7k|const char* Exiv2::DataBuf::c_str(size_t offset) const {
  198|  31.7k|  return reinterpret_cast<const char*>(c_data(offset));
  199|  31.7k|}
_ZN5Exiv2lsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS0_4pairIiiEE:
  220|  12.4k|std::ostream& operator<<(std::ostream& os, const Rational& r) {
  221|  12.4k|  return os << r.first << "/" << r.second;
  222|  12.4k|}
_ZN5Exiv2lsERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEERKNS0_4pairIjjEE:
  249|   180k|std::ostream& operator<<(std::ostream& os, const URational& r) {
  250|   180k|  return os << r.first << "/" << r.second;
  251|   180k|}
_ZN5Exiv29getUShortEPKhNS_9ByteOrderE:
  257|  67.1M|uint16_t getUShort(const byte* buf, ByteOrder byteOrder) {
  258|  67.1M|  return getUShort(makeSliceUntil(buf, 2), byteOrder);
  259|  67.1M|}
_ZN5Exiv28getULongEPKhNS_9ByteOrderE:
  261|  67.3M|uint32_t getULong(const byte* buf, ByteOrder byteOrder) {
  262|  67.3M|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (262:7): [True: 420k, False: 66.9M]
  ------------------
  263|   420k|    return buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
  264|   420k|  }
  265|  66.9M|  return buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
  266|  67.3M|}
_ZN5Exiv212getULongLongEPKhNS_9ByteOrderE:
  268|  31.9k|uint64_t getULongLong(const byte* buf, ByteOrder byteOrder) {
  269|  31.9k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (269:7): [True: 8.84k, False: 23.1k]
  ------------------
  270|  8.84k|    return static_cast<uint64_t>(buf[7]) << 56 | static_cast<uint64_t>(buf[6]) << 48 |
  271|  8.84k|           static_cast<uint64_t>(buf[5]) << 40 | static_cast<uint64_t>(buf[4]) << 32 |
  272|  8.84k|           static_cast<uint64_t>(buf[3]) << 24 | static_cast<uint64_t>(buf[2]) << 16 |
  273|  8.84k|           static_cast<uint64_t>(buf[1]) << 8 | static_cast<uint64_t>(buf[0]);
  274|  8.84k|  }
  275|  23.1k|  return static_cast<uint64_t>(buf[0]) << 56 | static_cast<uint64_t>(buf[1]) << 48 |
  276|  23.1k|         static_cast<uint64_t>(buf[2]) << 40 | static_cast<uint64_t>(buf[3]) << 32 |
  277|  23.1k|         static_cast<uint64_t>(buf[4]) << 24 | static_cast<uint64_t>(buf[5]) << 16 |
  278|  23.1k|         static_cast<uint64_t>(buf[6]) << 8 | static_cast<uint64_t>(buf[7]);
  279|  31.9k|}
_ZN5Exiv212getURationalEPKhNS_9ByteOrderE:
  281|   646k|URational getURational(const byte* buf, ByteOrder byteOrder) {
  282|   646k|  uint32_t nominator = getULong(buf, byteOrder);
  283|   646k|  uint32_t denominator = getULong(buf + 4, byteOrder);
  284|   646k|  return {nominator, denominator};
  285|   646k|}
_ZN5Exiv28getShortEPKhNS_9ByteOrderE:
  287|   235k|int16_t getShort(const byte* buf, ByteOrder byteOrder) {
  288|   235k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (288:7): [True: 134k, False: 101k]
  ------------------
  289|   134k|    return buf[1] << 8 | buf[0];
  290|   134k|  }
  291|   101k|  return buf[0] << 8 | buf[1];
  292|   235k|}
_ZN5Exiv27getLongEPKhNS_9ByteOrderE:
  294|   637k|int32_t getLong(const byte* buf, ByteOrder byteOrder) {
  295|   637k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (295:7): [True: 2.45k, False: 634k]
  ------------------
  296|  2.45k|    return buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
  297|  2.45k|  }
  298|   634k|  return buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
  299|   637k|}
_ZN5Exiv211getRationalEPKhNS_9ByteOrderE:
  301|  66.9k|Rational getRational(const byte* buf, ByteOrder byteOrder) {
  302|  66.9k|  int32_t nominator = getLong(buf, byteOrder);
  303|  66.9k|  int32_t denominator = getLong(buf + 4, byteOrder);
  304|  66.9k|  return {nominator, denominator};
  305|  66.9k|}
_ZN5Exiv28getFloatEPKhNS_9ByteOrderE:
  307|  45.7k|float getFloat(const byte* buf, ByteOrder byteOrder) {
  308|       |  // This algorithm assumes that the internal representation of the float
  309|       |  // type is the 4-byte IEEE 754 binary32 format, which is common but not
  310|       |  // required by the C++ standard.
  311|  45.7k|#ifdef __cpp_lib_bit_cast
  312|  45.7k|  return std::bit_cast<float>(getULong(buf, byteOrder));
  313|       |#else
  314|       |  union {
  315|       |    uint32_t ul_;
  316|       |    float f_;
  317|       |  } u;
  318|       |  u.ul_ = getULong(buf, byteOrder);
  319|       |  return u.f_;
  320|       |#endif
  321|  45.7k|}
_ZN5Exiv29getDoubleEPKhNS_9ByteOrderE:
  323|   288k|double getDouble(const byte* buf, ByteOrder byteOrder) {
  324|       |  // This algorithm assumes that the internal representation of the double
  325|       |  // type is the 8-byte IEEE 754 binary64 format, which is common but not
  326|       |  // required by the C++ standard.
  327|   288k|#ifdef __cpp_lib_bit_cast
  328|   288k|  if (byteOrder == littleEndian)
  ------------------
  |  Branch (328:7): [True: 97.5k, False: 190k]
  ------------------
  329|  97.5k|    return std::bit_cast<double>(static_cast<uint64_t>(buf[7]) << 56 | static_cast<uint64_t>(buf[6]) << 48 |
  330|  97.5k|                                 static_cast<uint64_t>(buf[5]) << 40 | static_cast<uint64_t>(buf[4]) << 32 |
  331|  97.5k|                                 static_cast<uint64_t>(buf[3]) << 24 | static_cast<uint64_t>(buf[2]) << 16 |
  332|  97.5k|                                 static_cast<uint64_t>(buf[1]) << 8 | static_cast<uint64_t>(buf[0]));
  333|   190k|  return std::bit_cast<double>(static_cast<uint64_t>(buf[0]) << 56 | static_cast<uint64_t>(buf[1]) << 48 |
  334|   190k|                               static_cast<uint64_t>(buf[2]) << 40 | static_cast<uint64_t>(buf[3]) << 32 |
  335|   190k|                               static_cast<uint64_t>(buf[4]) << 24 | static_cast<uint64_t>(buf[5]) << 16 |
  336|   190k|                               static_cast<uint64_t>(buf[6]) << 8 | static_cast<uint64_t>(buf[7]));
  337|       |#else
  338|       |  union {
  339|       |    uint64_t ull_;
  340|       |    double d_;
  341|       |  } u;
  342|       |  u.ull_ = 0;
  343|       |  if (byteOrder == littleEndian) {
  344|       |    u.ull_ = static_cast<uint64_t>(buf[7]) << 56 | static_cast<uint64_t>(buf[6]) << 48 |
  345|       |             static_cast<uint64_t>(buf[5]) << 40 | static_cast<uint64_t>(buf[4]) << 32 |
  346|       |             static_cast<uint64_t>(buf[3]) << 24 | static_cast<uint64_t>(buf[2]) << 16 |
  347|       |             static_cast<uint64_t>(buf[1]) << 8 | static_cast<uint64_t>(buf[0]);
  348|       |  } else {
  349|       |    u.ull_ = static_cast<uint64_t>(buf[0]) << 56 | static_cast<uint64_t>(buf[1]) << 48 |
  350|       |             static_cast<uint64_t>(buf[2]) << 40 | static_cast<uint64_t>(buf[3]) << 32 |
  351|       |             static_cast<uint64_t>(buf[4]) << 24 | static_cast<uint64_t>(buf[5]) << 16 |
  352|       |             static_cast<uint64_t>(buf[6]) << 8 | static_cast<uint64_t>(buf[7]);
  353|       |  }
  354|       |  return u.d_;
  355|       |#endif
  356|   288k|}
_ZN5Exiv27us2DataEPhtNS_9ByteOrderE:
  358|  3.27M|size_t us2Data(byte* buf, uint16_t s, ByteOrder byteOrder) {
  359|  3.27M|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (359:7): [True: 2.03M, False: 1.23M]
  ------------------
  360|  2.03M|    buf[0] = static_cast<byte>(s & 0x00ffU);
  361|  2.03M|    buf[1] = static_cast<byte>((s & 0xff00U) >> 8);
  362|  2.03M|  } else {
  363|  1.23M|    buf[0] = static_cast<byte>((s & 0xff00U) >> 8);
  364|  1.23M|    buf[1] = static_cast<byte>(s & 0x00ffU);
  365|  1.23M|  }
  366|  3.27M|  return 2;
  367|  3.27M|}
_ZN5Exiv27ul2DataEPhjNS_9ByteOrderE:
  369|  2.85M|size_t ul2Data(byte* buf, uint32_t l, ByteOrder byteOrder) {
  370|  2.85M|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (370:7): [True: 1.20M, False: 1.65M]
  ------------------
  371|  1.20M|    buf[0] = static_cast<byte>(l & 0x000000ffU);
  372|  1.20M|    buf[1] = static_cast<byte>((l & 0x0000ff00U) >> 8);
  373|  1.20M|    buf[2] = static_cast<byte>((l & 0x00ff0000U) >> 16);
  374|  1.20M|    buf[3] = static_cast<byte>((l & 0xff000000U) >> 24);
  375|  1.65M|  } else {
  376|  1.65M|    buf[0] = static_cast<byte>((l & 0xff000000U) >> 24);
  377|  1.65M|    buf[1] = static_cast<byte>((l & 0x00ff0000U) >> 16);
  378|  1.65M|    buf[2] = static_cast<byte>((l & 0x0000ff00U) >> 8);
  379|  1.65M|    buf[3] = static_cast<byte>(l & 0x000000ffU);
  380|  1.65M|  }
  381|  2.85M|  return 4;
  382|  2.85M|}
_ZN5Exiv27ur2DataEPhNSt3__14pairIjjEENS_9ByteOrderE:
  399|   614k|size_t ur2Data(byte* buf, URational l, ByteOrder byteOrder) {
  400|   614k|  size_t o = ul2Data(buf, l.first, byteOrder);
  401|   614k|  o += ul2Data(buf + o, l.second, byteOrder);
  402|   614k|  return o;
  403|   614k|}
_ZN5Exiv26s2DataEPhsNS_9ByteOrderE:
  405|   229k|size_t s2Data(byte* buf, int16_t s, ByteOrder byteOrder) {
  406|   229k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (406:7): [True: 178k, False: 51.0k]
  ------------------
  407|   178k|    buf[0] = static_cast<byte>(s & 0x00ffU);
  408|   178k|    buf[1] = static_cast<byte>((s & 0xff00U) >> 8);
  409|   178k|  } else {
  410|  51.0k|    buf[0] = static_cast<byte>((s & 0xff00U) >> 8);
  411|  51.0k|    buf[1] = static_cast<byte>(s & 0x00ffU);
  412|  51.0k|  }
  413|   229k|  return 2;
  414|   229k|}
_ZN5Exiv26l2DataEPhiNS_9ByteOrderE:
  416|   556k|size_t l2Data(byte* buf, int32_t l, ByteOrder byteOrder) {
  417|   556k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (417:7): [True: 146k, False: 410k]
  ------------------
  418|   146k|    buf[0] = static_cast<byte>(l & 0x000000ffU);
  419|   146k|    buf[1] = static_cast<byte>((l & 0x0000ff00U) >> 8);
  420|   146k|    buf[2] = static_cast<byte>((l & 0x00ff0000U) >> 16);
  421|   146k|    buf[3] = static_cast<byte>((l & 0xff000000U) >> 24);
  422|   410k|  } else {
  423|   410k|    buf[0] = static_cast<byte>((l & 0xff000000U) >> 24);
  424|   410k|    buf[1] = static_cast<byte>((l & 0x00ff0000U) >> 16);
  425|   410k|    buf[2] = static_cast<byte>((l & 0x0000ff00U) >> 8);
  426|   410k|    buf[3] = static_cast<byte>(l & 0x000000ffU);
  427|   410k|  }
  428|   556k|  return 4;
  429|   556k|}
_ZN5Exiv26r2DataEPhNSt3__14pairIiiEENS_9ByteOrderE:
  431|  88.1k|size_t r2Data(byte* buf, Rational l, ByteOrder byteOrder) {
  432|  88.1k|  size_t o = l2Data(buf, l.first, byteOrder);
  433|  88.1k|  o += l2Data(buf + o, l.second, byteOrder);
  434|  88.1k|  return o;
  435|  88.1k|}
_ZN5Exiv26f2DataEPhfNS_9ByteOrderE:
  437|  50.7k|size_t f2Data(byte* buf, float f, ByteOrder byteOrder) {
  438|       |  // This algorithm assumes that the internal representation of the float
  439|       |  // type is the 4-byte IEEE 754 binary32 format, which is common but not
  440|       |  // required by the C++ standard.
  441|  50.7k|#ifdef __cpp_lib_bit_cast
  442|  50.7k|  return ul2Data(buf, std::bit_cast<uint32_t>(f), byteOrder);
  443|       |#else
  444|       |  union {
  445|       |    uint32_t ul_;
  446|       |    float f_;
  447|       |  } u;
  448|       |  u.f_ = f;
  449|       |  return ul2Data(buf, u.ul_, byteOrder);
  450|       |#endif
  451|  50.7k|}
_ZN5Exiv26d2DataEPhdNS_9ByteOrderE:
  453|   179k|size_t d2Data(byte* buf, double d, ByteOrder byteOrder) {
  454|       |  // This algorithm assumes that the internal representation of the double
  455|       |  // type is the 8-byte IEEE 754 binary64 format, which is common but not
  456|       |  // required by the C++ standard.
  457|   179k|  union {
  458|   179k|    uint64_t ull_;
  459|   179k|    double d_;
  460|   179k|  } u;
  461|   179k|  u.d_ = d;
  462|   179k|  uint64_t m = 0xff;
  463|   179k|  if (byteOrder == littleEndian) {
  ------------------
  |  Branch (463:7): [True: 138k, False: 40.5k]
  ------------------
  464|   138k|    buf[0] = static_cast<byte>(u.ull_ & m);
  465|   138k|    buf[1] = static_cast<byte>((u.ull_ & (m << 8)) >> 8);
  466|   138k|    buf[2] = static_cast<byte>((u.ull_ & (m << 16)) >> 16);
  467|   138k|    buf[3] = static_cast<byte>((u.ull_ & (m << 24)) >> 24);
  468|   138k|    buf[4] = static_cast<byte>((u.ull_ & (m << 32)) >> 32);
  469|   138k|    buf[5] = static_cast<byte>((u.ull_ & (m << 40)) >> 40);
  470|   138k|    buf[6] = static_cast<byte>((u.ull_ & (m << 48)) >> 48);
  471|   138k|    buf[7] = static_cast<byte>((u.ull_ & (m << 56)) >> 56);
  472|   138k|  } else {
  473|  40.5k|    buf[0] = static_cast<byte>((u.ull_ & (m << 56)) >> 56);
  474|  40.5k|    buf[1] = static_cast<byte>((u.ull_ & (m << 48)) >> 48);
  475|  40.5k|    buf[2] = static_cast<byte>((u.ull_ & (m << 40)) >> 40);
  476|  40.5k|    buf[3] = static_cast<byte>((u.ull_ & (m << 32)) >> 32);
  477|  40.5k|    buf[4] = static_cast<byte>((u.ull_ & (m << 24)) >> 24);
  478|  40.5k|    buf[5] = static_cast<byte>((u.ull_ & (m << 16)) >> 16);
  479|  40.5k|    buf[6] = static_cast<byte>((u.ull_ & (m << 8)) >> 8);
  480|  40.5k|    buf[7] = static_cast<byte>(u.ull_ & m);
  481|  40.5k|  }
  482|   179k|  return 8;
  483|   179k|}
_ZN5Exiv25isHexERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmS8_:
  512|  73.4k|bool isHex(const std::string& str, size_t size, const std::string& prefix) {
  513|  73.4k|  if (!str.starts_with(prefix))
  ------------------
  |  Branch (513:7): [True: 0, False: 73.4k]
  ------------------
  514|      0|    return false;
  515|  73.4k|  if (size > 0 && str.size() != size + prefix.size())
  ------------------
  |  Branch (515:7): [True: 73.4k, False: 0]
  |  Branch (515:19): [True: 0, False: 73.4k]
  ------------------
  516|      0|    return false;
  517|       |
  518|  73.4k|  return std::all_of(str.begin() + prefix.size(), str.end(), ::isxdigit);
  519|  73.4k|}  // isHex
_ZN5Exiv28exifTimeEPKcP2tm:
  521|      6|int exifTime(const char* buf, tm* tm) {
  522|      6|  int rc = 1;
  523|      6|  int year = 0;
  524|      6|  int mon = 0;
  525|      6|  int mday = 0;
  526|      6|  int hour = 0;
  527|      6|  int min = 0;
  528|      6|  int sec = 0;
  529|      6|  if (std::sscanf(buf, "%4d:%2d:%2d %2d:%2d:%2d", &year, &mon, &mday, &hour, &min, &sec) == 6) {
  ------------------
  |  Branch (529:7): [True: 3, False: 3]
  ------------------
  530|      3|    tm->tm_year = year - 1900;
  531|      3|    tm->tm_mon = mon - 1;
  532|      3|    tm->tm_mday = mday;
  533|      3|    tm->tm_hour = hour;
  534|      3|    tm->tm_min = min;
  535|      3|    tm->tm_sec = sec;
  536|      3|    rc = 0;
  537|      3|  }
  538|      6|  return rc;
  539|      6|}  // exifTime
_ZN5Exiv219floatToRationalCastEf:
  667|    196|Rational floatToRationalCast(float f) {
  668|       |  // Convert f to double because it simplifies the range checks
  669|       |  // below. (All int values can be losslessly converted to double, but
  670|       |  // sometimes get rounded when converted to float.)
  671|    196|  const double d = f;
  672|       |  // Beware: primitive conversion algorithm
  673|    196|  int32_t den;
  674|    196|  if (std::fabs(d) <= std::numeric_limits<int32_t>::max() / 1000000) {
  ------------------
  |  Branch (674:7): [True: 121, False: 75]
  ------------------
  675|    121|    den = 1000000;
  676|    121|  } else if (std::fabs(d) <= std::numeric_limits<int32_t>::max() / 10000) {
  ------------------
  |  Branch (676:14): [True: 19, False: 56]
  ------------------
  677|     19|    den = 10000;
  678|     56|  } else if (std::fabs(d) <= std::numeric_limits<int32_t>::max() / 100) {
  ------------------
  |  Branch (678:14): [True: 15, False: 41]
  ------------------
  679|     15|    den = 100;
  680|     41|  } else if (std::fabs(d) <= std::numeric_limits<int32_t>::max()) {
  ------------------
  |  Branch (680:14): [True: 21, False: 20]
  ------------------
  681|     21|    den = 1;
  682|     21|  } else {
  683|     20|    return {d > 0 ? 1 : -1, 0};
  ------------------
  |  Branch (683:13): [True: 20, False: 0]
  ------------------
  684|     20|  }
  685|    176|  const auto nom = static_cast<int32_t>(std::lround(d * den));
  686|    176|  const int32_t g = std::gcd(nom, den);
  687|       |
  688|    176|  return {nom / g, den / g};
  689|    196|}
types.cpp:_ZNK12_GLOBAL__N_113TypeInfoTableeqEN5Exiv26TypeIdE:
   44|  70.9M|  bool operator==(Exiv2::TypeId typeId) const {
   45|  70.9M|    return typeId_ == typeId;
   46|  70.9M|  }

_ZN5Exiv28Internal5upperENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
    8|  21.4k|std::string upper(std::string_view str) {
    9|  21.4k|  std::string result;
   10|  21.4k|  result.reserve(str.size());
   11|  21.4k|  for (auto c : str)
  ------------------
  |  Branch (11:15): [True: 85.8k, False: 21.4k]
  ------------------
   12|  85.8k|    result.push_back(std::toupper(static_cast<unsigned char>(c)));
   13|  21.4k|  return result;
   14|  21.4k|}
_ZN5Exiv28Internal5lowerENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   16|  19.6k|std::string lower(std::string_view a) {
   17|  19.6k|  std::string b;
   18|  19.6k|  b.reserve(a.size());
   19|  19.6k|  for (auto c : a)
  ------------------
  |  Branch (19:15): [True: 19.1M, False: 19.6k]
  ------------------
   20|  19.1M|    b.push_back(std::tolower(static_cast<unsigned char>(c)));
   21|  19.6k|  return b;
   22|  19.6k|}

_ZN5Exiv28Internal8containsIPKcEEbNSt3__117basic_string_viewIcNS4_11char_traitsIcEEEET_:
    9|  31.2k|constexpr bool contains(std::string_view s, auto c) {
   10|       |#ifdef __cpp_lib_string_contains
   11|       |  return s.contains(c);
   12|       |#else
   13|  31.2k|  return s.find(c) != std::string_view::npos;
   14|  31.2k|#endif
   15|  31.2k|}
_ZN5Exiv28Internal8containsINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEbNS2_17basic_string_viewIcS5_EET_:
    9|    618|constexpr bool contains(std::string_view s, auto c) {
   10|       |#ifdef __cpp_lib_string_contains
   11|       |  return s.contains(c);
   12|       |#else
   13|    618|  return s.find(c) != std::string_view::npos;
   14|    618|#endif
   15|    618|}

_ZN5Exiv25ValueC2ENS_6TypeIdE:
   20|  3.26M|Value::Value(TypeId typeId) : type_(typeId) {
   21|  3.26M|}
_ZN5Exiv25Value6createENS_6TypeIdE:
   23|  2.65M|Value::UniquePtr Value::create(TypeId typeId) {
   24|  2.65M|  switch (typeId) {
   25|      0|    case invalidTypeId:
  ------------------
  |  Branch (25:5): [True: 0, False: 2.65M]
  ------------------
   26|  2.78k|    case signedByte:
  ------------------
  |  Branch (26:5): [True: 2.78k, False: 2.65M]
  ------------------
   27|  1.34M|    case unsignedByte:
  ------------------
  |  Branch (27:5): [True: 1.34M, False: 1.31M]
  ------------------
   28|  1.34M|      return std::make_unique<DataValue>(typeId);
   29|  34.0k|    case asciiString:
  ------------------
  |  Branch (29:5): [True: 34.0k, False: 2.61M]
  ------------------
   30|  34.0k|      return std::make_unique<AsciiValue>();
   31|  43.2k|    case unsignedShort:
  ------------------
  |  Branch (31:5): [True: 43.2k, False: 2.61M]
  ------------------
   32|  43.2k|      return std::make_unique<ValueType<uint16_t>>();
   33|  33.7k|    case unsignedLong:
  ------------------
  |  Branch (33:5): [True: 33.7k, False: 2.62M]
  ------------------
   34|  45.6k|    case tiffIfd:
  ------------------
  |  Branch (34:5): [True: 11.8k, False: 2.64M]
  ------------------
   35|  45.6k|      return std::make_unique<ValueType<uint32_t>>(typeId);
   36|  9.40k|    case unsignedRational:
  ------------------
  |  Branch (36:5): [True: 9.40k, False: 2.64M]
  ------------------
   37|  9.40k|      return std::make_unique<ValueType<URational>>();
   38|  40.6k|    case undefined:
  ------------------
  |  Branch (38:5): [True: 40.6k, False: 2.61M]
  ------------------
   39|  40.6k|      return std::make_unique<DataValue>();
   40|  22.5k|    case signedShort:
  ------------------
  |  Branch (40:5): [True: 22.5k, False: 2.63M]
  ------------------
   41|  22.5k|      return std::make_unique<ValueType<int16_t>>();
   42|  24.4k|    case signedLong:
  ------------------
  |  Branch (42:5): [True: 24.4k, False: 2.62M]
  ------------------
   43|  24.4k|      return std::make_unique<ValueType<int32_t>>();
   44|  8.92k|    case signedRational:
  ------------------
  |  Branch (44:5): [True: 8.92k, False: 2.64M]
  ------------------
   45|  8.92k|      return std::make_unique<ValueType<Rational>>();
   46|  4.95k|    case tiffFloat:
  ------------------
  |  Branch (46:5): [True: 4.95k, False: 2.64M]
  ------------------
   47|  4.95k|      return std::make_unique<ValueType<float>>();
   48|  9.93k|    case tiffDouble:
  ------------------
  |  Branch (48:5): [True: 9.93k, False: 2.64M]
  ------------------
   49|  9.93k|      return std::make_unique<ValueType<double>>();
   50|  47.8k|    case string:
  ------------------
  |  Branch (50:5): [True: 47.8k, False: 2.60M]
  ------------------
   51|  47.8k|      return std::make_unique<StringValue>();
   52|  4.40k|    case date:
  ------------------
  |  Branch (52:5): [True: 4.40k, False: 2.64M]
  ------------------
   53|  4.40k|      return std::make_unique<DateValue>();
   54|  8.41k|    case time:
  ------------------
  |  Branch (54:5): [True: 8.41k, False: 2.64M]
  ------------------
   55|  8.41k|      return std::make_unique<TimeValue>();
   56|  4.98k|    case comment:
  ------------------
  |  Branch (56:5): [True: 4.98k, False: 2.64M]
  ------------------
   57|  4.98k|      return std::make_unique<CommentValue>();
   58|  33.2k|    case xmpText:
  ------------------
  |  Branch (58:5): [True: 33.2k, False: 2.62M]
  ------------------
   59|  33.2k|      return std::make_unique<XmpTextValue>();
   60|      6|    case xmpBag:
  ------------------
  |  Branch (60:5): [True: 6, False: 2.65M]
  ------------------
   61|  3.13k|    case xmpSeq:
  ------------------
  |  Branch (61:5): [True: 3.12k, False: 2.65M]
  ------------------
   62|  3.13k|    case xmpAlt:
  ------------------
  |  Branch (62:5): [True: 0, False: 2.65M]
  ------------------
   63|  3.13k|      return std::make_unique<XmpArrayValue>(typeId);
   64|    392|    case langAlt:
  ------------------
  |  Branch (64:5): [True: 392, False: 2.65M]
  ------------------
   65|    392|      return std::make_unique<LangAltValue>();
   66|   961k|    default:
  ------------------
  |  Branch (66:5): [True: 961k, False: 1.69M]
  ------------------
   67|   961k|      return std::make_unique<DataValue>(typeId);
   68|  2.65M|  }
   69|  2.65M|}  // Value::create
_ZN5Exiv25Value11setDataAreaEPKhm:
   71|    495|int Value::setDataArea(const byte* /*buf*/, size_t /*len*/) {
   72|    495|  return -1;
   73|    495|}
_ZNK5Exiv25Value8toStringEv:
   75|   169k|std::string Value::toString() const {
   76|   169k|  std::ostringstream os;
   77|   169k|  write(os);
   78|   169k|  ok_ = !os.fail();
   79|   169k|  return os.str();
   80|   169k|}
_ZNK5Exiv25Value8toStringEm:
   82|   111k|std::string Value::toString(size_t /*n*/) const {
   83|   111k|  return toString();
   84|   111k|}
_ZNK5Exiv25Value12sizeDataAreaEv:
   86|  28.0k|size_t Value::sizeDataArea() const {
   87|  28.0k|  return 0;
   88|  28.0k|}
_ZNK5Exiv25Value8dataAreaEv:
   90|  1.15k|DataBuf Value::dataArea() const {
   91|  1.15k|  return {nullptr, 0};
   92|  1.15k|}
_ZN5Exiv29DataValueC2ENS_6TypeIdE:
   94|  2.34M|DataValue::DataValue(TypeId typeId) : Value(typeId) {
   95|  2.34M|}
_ZN5Exiv29DataValueC2EPKhmNS_9ByteOrderENS_6TypeIdE:
   97|     13|DataValue::DataValue(const byte* buf, size_t len, ByteOrder byteOrder, TypeId typeId) : Value(typeId) {
   98|     13|  read(buf, len, byteOrder);
   99|     13|}
_ZNK5Exiv29DataValue5countEv:
  101|  8.49M|size_t DataValue::count() const {
  102|  8.49M|  return size();
  103|  8.49M|}
_ZN5Exiv29DataValue4readEPKhmNS_9ByteOrderE:
  105|  2.34M|int DataValue::read(const byte* buf, size_t len, ByteOrder /*byteOrder*/) {
  106|       |  // byteOrder not needed
  107|  2.34M|  value_.assign(buf, buf + len);
  108|  2.34M|  return 0;
  109|  2.34M|}
_ZNK5Exiv29DataValue4copyEPhNS_9ByteOrderE:
  123|  2.92M|size_t DataValue::copy(byte* buf, ByteOrder /*byteOrder*/) const {
  124|       |  // byteOrder not needed
  125|  2.92M|  return std::copy(value_.begin(), value_.end(), buf) - buf;
  126|  2.92M|}
_ZNK5Exiv29DataValue4sizeEv:
  128|  19.4M|size_t DataValue::size() const {
  129|  19.4M|  return value_.size();
  130|  19.4M|}
_ZNK5Exiv29DataValue6clone_Ev:
  132|  8.64M|DataValue* DataValue::clone_() const {
  133|  8.64M|  return new DataValue(*this);
  134|  8.64M|}
_ZNK5Exiv29DataValue5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  136|  1.92k|std::ostream& DataValue::write(std::ostream& os) const {
  137|  1.92k|  if (!value_.empty()) {
  ------------------
  |  Branch (137:7): [True: 1.20k, False: 717]
  ------------------
  138|  1.20k|    std::copy(value_.begin(), value_.end() - 1, std::ostream_iterator<int>(os, " "));
  139|  1.20k|    os << static_cast<int>(value_.back());
  140|  1.20k|  }
  141|  1.92k|  return os;
  142|  1.92k|}
_ZNK5Exiv29DataValue7toInt64Em:
  149|  65.7k|int64_t DataValue::toInt64(size_t n) const {
  150|  65.7k|  ok_ = true;
  151|  65.7k|  return value_.at(n);
  152|  65.7k|}
_ZNK5Exiv29DataValue8toUint32Em:
  154|  5.13M|uint32_t DataValue::toUint32(size_t n) const {
  155|  5.13M|  ok_ = true;
  156|  5.13M|  return value_.at(n);
  157|  5.13M|}
_ZN5Exiv215StringValueBase4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  173|  24.0k|int StringValueBase::read(const std::string& buf) {
  174|  24.0k|  value_ = buf;
  175|  24.0k|  return 0;
  176|  24.0k|}
_ZN5Exiv215StringValueBase4readEPKhmNS_9ByteOrderE:
  178|  61.1k|int StringValueBase::read(const byte* buf, size_t len, ByteOrder /*byteOrder*/) {
  179|       |  // byteOrder not needed
  180|  61.1k|  if (buf)
  ------------------
  |  Branch (180:7): [True: 61.1k, False: 0]
  ------------------
  181|  61.1k|    value_ = std::string(reinterpret_cast<const char*>(buf), len);
  182|  61.1k|  return 0;
  183|  61.1k|}
_ZNK5Exiv215StringValueBase4copyEPhNS_9ByteOrderE:
  185|  66.5k|size_t StringValueBase::copy(byte* buf, ByteOrder /*byteOrder*/) const {
  186|  66.5k|  if (value_.empty())
  ------------------
  |  Branch (186:7): [True: 38.8k, False: 27.6k]
  ------------------
  187|  38.8k|    return 0;
  188|       |  // byteOrder not needed
  189|  27.6k|  return value_.copy(reinterpret_cast<char*>(buf), value_.size());
  190|  66.5k|}
_ZNK5Exiv215StringValueBase5countEv:
  192|  75.5k|size_t StringValueBase::count() const {
  193|  75.5k|  return size();
  194|  75.5k|}
_ZNK5Exiv215StringValueBase4sizeEv:
  196|   261k|size_t StringValueBase::size() const {
  197|   261k|  return value_.size();
  198|   261k|}
_ZNK5Exiv215StringValueBase5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  200|  21.9k|std::ostream& StringValueBase::write(std::ostream& os) const {
  201|  21.9k|  return os << value_;
  202|  21.9k|}
_ZNK5Exiv215StringValueBase7toInt64Em:
  204|    590|int64_t StringValueBase::toInt64(size_t n) const {
  205|    590|  ok_ = true;
  206|    590|  return static_cast<signed char>(value_.at(n));
  207|    590|}
_ZNK5Exiv215StringValueBase8toUint32Em:
  209|  1.48k|uint32_t StringValueBase::toUint32(size_t n) const {
  210|  1.48k|  ok_ = true;
  211|  1.48k|  return static_cast<unsigned char>(value_.at(n));
  212|  1.48k|}
_ZN5Exiv211StringValueC2Ev:
  224|  47.8k|StringValue::StringValue() : StringValueBase(string) {
  225|  47.8k|}
_ZNK5Exiv211StringValue6clone_Ev:
  230|   283k|StringValue* StringValue::clone_() const {
  231|   283k|  return new StringValue(*this);
  232|   283k|}
_ZN5Exiv210AsciiValueC2Ev:
  234|  34.0k|AsciiValue::AsciiValue() : StringValueBase(asciiString) {
  235|  34.0k|}
_ZN5Exiv210AsciiValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  3.36k|int AsciiValue::read(const std::string& buf) {
  241|  3.36k|  value_ = buf;
  242|       |  // ensure count>0 and nul terminated # https://github.com/Exiv2/exiv2/issues/1484
  243|  3.36k|  if (value_.empty() || value_.back() != '\0') {
  ------------------
  |  Branch (243:7): [True: 5, False: 3.35k]
  |  Branch (243:25): [True: 3.35k, False: 0]
  ------------------
  244|  3.36k|    value_ += '\0';
  245|  3.36k|  }
  246|  3.36k|  return 0;
  247|  3.36k|}
_ZNK5Exiv210AsciiValue6clone_Ev:
  249|   129k|AsciiValue* AsciiValue::clone_() const {
  250|   129k|  return new AsciiValue(*this);
  251|   129k|}
_ZNK5Exiv210AsciiValue5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  253|  24.2k|std::ostream& AsciiValue::write(std::ostream& os) const {
  254|       |  // Write only up to the first '\0' (if any)
  255|  24.2k|  std::string::size_type pos = value_.find_first_of('\0');
  256|  24.2k|  if (pos == std::string::npos)
  ------------------
  |  Branch (256:7): [True: 5.44k, False: 18.8k]
  ------------------
  257|  5.44k|    pos = value_.size();
  258|  24.2k|  return os << value_.substr(0, pos);
  259|  24.2k|}
_ZN5Exiv212CommentValue11CharsetInfo15charsetIdByCodeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  286|  3.47k|CommentValue::CharsetId CommentValue::CharsetInfo::charsetIdByCode(const std::string& code) {
  287|  3.47k|  int i = 0;
  288|  14.1k|  for (; charsetTable_[i].charsetId_ != lastCharsetId && std::string(charsetTable_[i].code_, 8) != code; ++i) {
  ------------------
  |  Branch (288:10): [True: 13.0k, False: 1.14k]
  |  Branch (288:10): [True: 10.7k, False: 3.47k]
  |  Branch (288:58): [True: 10.7k, False: 2.33k]
  ------------------
  289|  10.7k|  }
  290|  3.47k|  return charsetTable_[i].charsetId_ == lastCharsetId ? invalidCharsetId : charsetTable_[i].charsetId_;
  ------------------
  |  Branch (290:10): [True: 1.14k, False: 2.33k]
  ------------------
  291|  3.47k|}
_ZN5Exiv212CommentValueC2Ev:
  293|  4.98k|CommentValue::CommentValue() : StringValueBase(Exiv2::undefined) {
  294|  4.98k|}
_ZN5Exiv212CommentValue4readEPKhmNS_9ByteOrderE:
  330|  4.98k|int CommentValue::read(const byte* buf, size_t len, ByteOrder byteOrder) {
  331|  4.98k|  byteOrder_ = byteOrder;
  332|  4.98k|  return StringValueBase::read(buf, len, byteOrder);
  333|  4.98k|}
_ZNK5Exiv212CommentValue4copyEPhNS_9ByteOrderE:
  335|  4.91k|size_t CommentValue::copy(byte* buf, ByteOrder byteOrder) const {
  336|  4.91k|  std::string c = value_;
  337|  4.91k|  if (charsetId() == unicode) {
  ------------------
  |  Branch (337:7): [True: 1.18k, False: 3.72k]
  ------------------
  338|  1.18k|    c = value_.substr(8);
  339|  1.18k|    [[maybe_unused]] const size_t sz = c.size();
  340|  1.18k|    if (byteOrder_ == littleEndian && byteOrder == bigEndian) {
  ------------------
  |  Branch (340:9): [True: 13, False: 1.17k]
  |  Branch (340:39): [True: 0, False: 13]
  ------------------
  341|      0|      convertStringCharset(c, "UCS-2LE", "UCS-2BE");
  342|  1.18k|    } else if (byteOrder_ == bigEndian && byteOrder == littleEndian) {
  ------------------
  |  Branch (342:16): [True: 1.17k, False: 13]
  |  Branch (342:43): [True: 38, False: 1.13k]
  ------------------
  343|     38|      convertStringCharset(c, "UCS-2BE", "UCS-2LE");
  344|     38|    }
  345|  1.18k|    c = value_.substr(0, 8) + c;
  346|  1.18k|  }
  347|  4.91k|  if (c.empty())
  ------------------
  |  Branch (347:7): [True: 1.33k, False: 3.58k]
  ------------------
  348|  1.33k|    return 0;
  349|  3.58k|  return c.copy(reinterpret_cast<char*>(buf), c.size());
  350|  4.91k|}
_ZNK5Exiv212CommentValue9charsetIdEv:
  382|  4.91k|CommentValue::CharsetId CommentValue::charsetId() const {
  383|  4.91k|  CharsetId charsetId = undefined;
  384|  4.91k|  if (value_.length() >= 8) {
  ------------------
  |  Branch (384:7): [True: 3.47k, False: 1.44k]
  ------------------
  385|  3.47k|    const std::string code = value_.substr(0, 8);
  386|  3.47k|    charsetId = CharsetInfo::charsetIdByCode(code);
  387|  3.47k|  }
  388|  4.91k|  return charsetId;
  389|  4.91k|}
_ZNK5Exiv212CommentValue6clone_Ev:
  411|  13.4k|CommentValue* CommentValue::clone_() const {
  412|  13.4k|  return new CommentValue(*this);
  413|  13.4k|}
_ZN5Exiv28XmpValue15setXmpArrayTypeENS0_12XmpArrayTypeE:
  415|  10.2k|void XmpValue::setXmpArrayType(XmpArrayType xmpArrayType) {
  416|  10.2k|  xmpArrayType_ = xmpArrayType;
  417|  10.2k|}
_ZN5Exiv28XmpValue12setXmpStructENS0_9XmpStructE:
  419|  5.82k|void XmpValue::setXmpStruct(XmpStruct xmpStruct) {
  420|  5.82k|  xmpStruct_ = xmpStruct;
  421|  5.82k|}
_ZNK5Exiv28XmpValue12xmpArrayTypeEv:
  423|   295k|XmpValue::XmpArrayType XmpValue::xmpArrayType() const {
  424|   295k|  return xmpArrayType_;
  425|   295k|}
_ZN5Exiv28XmpValue12xmpArrayTypeENS_6TypeIdE:
  427|  10.1k|XmpValue::XmpArrayType XmpValue::xmpArrayType(TypeId typeId) {
  428|  10.1k|  XmpArrayType xa = xaNone;
  429|  10.1k|  switch (typeId) {
  430|    314|    case xmpAlt:
  ------------------
  |  Branch (430:5): [True: 314, False: 9.79k]
  ------------------
  431|    314|      xa = xaAlt;
  432|    314|      break;
  433|    239|    case xmpBag:
  ------------------
  |  Branch (433:5): [True: 239, False: 9.87k]
  ------------------
  434|    239|      xa = xaBag;
  435|    239|      break;
  436|  4.08k|    case xmpSeq:
  ------------------
  |  Branch (436:5): [True: 4.08k, False: 6.02k]
  ------------------
  437|  4.08k|      xa = xaSeq;
  438|  4.08k|      break;
  439|  5.47k|    default:
  ------------------
  |  Branch (439:5): [True: 5.47k, False: 4.63k]
  ------------------
  440|  5.47k|      break;
  441|  10.1k|  }
  442|  10.1k|  return xa;
  443|  10.1k|}
_ZNK5Exiv28XmpValue9xmpStructEv:
  445|   304k|XmpValue::XmpStruct XmpValue::xmpStruct() const {
  446|   304k|  return xmpStruct_;
  447|   304k|}
_ZN5Exiv212XmpTextValueC2Ev:
  469|  99.9k|XmpTextValue::XmpTextValue() : XmpValue(xmpText) {
  470|  99.9k|}
_ZN5Exiv212XmpTextValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  476|   807k|int XmpTextValue::read(const std::string& buf) {
  477|       |  // support a type=Alt,Bag,Seq,Struct indicator
  478|   807k|  std::string b = buf;
  479|   807k|  std::string type;
  480|   807k|  if (buf.starts_with("type=")) {
  ------------------
  |  Branch (480:7): [True: 916, False: 806k]
  ------------------
  481|    916|    std::string::size_type pos = buf.find_first_of(' ');
  482|    916|    type = buf.substr(5, pos - 5);
  483|       |    // Strip quotes (so you can also specify the type without quotes)
  484|    916|    if (!type.empty() && type.front() == '"')
  ------------------
  |  Branch (484:9): [True: 614, False: 302]
  |  Branch (484:26): [True: 293, False: 321]
  ------------------
  485|    293|      type = type.substr(1);
  486|    916|    if (!type.empty() && type.back() == '"')
  ------------------
  |  Branch (486:9): [True: 585, False: 331]
  |  Branch (486:26): [True: 212, False: 373]
  ------------------
  487|    212|      type.pop_back();
  488|    916|    b.clear();
  489|    916|    if (pos != std::string::npos)
  ------------------
  |  Branch (489:9): [True: 474, False: 442]
  ------------------
  490|    474|      b = buf.substr(pos + 1);
  491|    916|  }
  492|   807k|  if (!type.empty()) {
  ------------------
  |  Branch (492:7): [True: 585, False: 806k]
  ------------------
  493|    585|    if (type == "Alt") {
  ------------------
  |  Branch (493:9): [True: 24, False: 561]
  ------------------
  494|     24|      setXmpArrayType(XmpValue::xaAlt);
  495|    561|    } else if (type == "Bag") {
  ------------------
  |  Branch (495:16): [True: 25, False: 536]
  ------------------
  496|     25|      setXmpArrayType(XmpValue::xaBag);
  497|    536|    } else if (type == "Seq") {
  ------------------
  |  Branch (497:16): [True: 42, False: 494]
  ------------------
  498|     42|      setXmpArrayType(XmpValue::xaSeq);
  499|    494|    } else if (type == "Struct") {
  ------------------
  |  Branch (499:16): [True: 153, False: 341]
  ------------------
  500|    153|      setXmpStruct();
  501|    341|    } else {
  502|    341|      throw Error(ErrorCode::kerInvalidXmpText, type);
  503|    341|    }
  504|    585|  }
  505|   806k|  value_ = std::move(b);
  506|   806k|  return 0;
  507|   807k|}
_ZNK5Exiv212XmpTextValue4sizeEv:
  513|  61.6k|size_t XmpTextValue::size() const {
  514|  61.6k|  std::ostringstream os;
  515|  61.6k|  write(os);
  516|  61.6k|  return os.str().size();
  517|  61.6k|}
_ZNK5Exiv212XmpTextValue5countEv:
  519|  61.6k|size_t XmpTextValue::count() const {
  520|  61.6k|  return size();
  521|  61.6k|}
_ZNK5Exiv212XmpTextValue5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  523|   176k|std::ostream& XmpTextValue::write(std::ostream& os) const {
  524|   176k|  bool del = false;
  525|   176k|  if (xmpArrayType() != XmpValue::xaNone) {
  ------------------
  |  Branch (525:7): [True: 200, False: 176k]
  ------------------
  526|    200|    switch (xmpArrayType()) {
  ------------------
  |  Branch (526:13): [True: 200, False: 0]
  ------------------
  527|     67|      case XmpValue::xaAlt:
  ------------------
  |  Branch (527:7): [True: 67, False: 133]
  ------------------
  528|     67|        os << "type=\"Alt\"";
  529|     67|        break;
  530|      2|      case XmpValue::xaBag:
  ------------------
  |  Branch (530:7): [True: 2, False: 198]
  ------------------
  531|      2|        os << "type=\"Bag\"";
  532|      2|        break;
  533|    131|      case XmpValue::xaSeq:
  ------------------
  |  Branch (533:7): [True: 131, False: 69]
  ------------------
  534|    131|        os << "type=\"Seq\"";
  535|    131|        break;
  536|      0|      case XmpValue::xaNone:
  ------------------
  |  Branch (536:7): [True: 0, False: 200]
  ------------------
  537|      0|        break;  // just to suppress the warning
  538|    200|    }
  539|    200|    del = true;
  540|   176k|  } else if (xmpStruct() != XmpValue::xsNone) {
  ------------------
  |  Branch (540:14): [True: 4.78k, False: 171k]
  ------------------
  541|  4.78k|    switch (xmpStruct()) {
  ------------------
  |  Branch (541:13): [True: 4.78k, False: 0]
  ------------------
  542|  4.78k|      case XmpValue::xsStruct:
  ------------------
  |  Branch (542:7): [True: 4.78k, False: 0]
  ------------------
  543|  4.78k|        os << "type=\"Struct\"";
  544|  4.78k|        break;
  545|      0|      case XmpValue::xsNone:
  ------------------
  |  Branch (545:7): [True: 0, False: 4.78k]
  ------------------
  546|      0|        break;  // just to suppress the warning
  547|  4.78k|    }
  548|  4.78k|    del = true;
  549|  4.78k|  }
  550|   176k|  if (del && !value_.empty())
  ------------------
  |  Branch (550:7): [True: 4.98k, False: 171k]
  |  Branch (550:14): [True: 22, False: 4.95k]
  ------------------
  551|     22|    os << " ";
  552|   176k|  return os << value_;
  553|   176k|}
_ZNK5Exiv212XmpTextValue6clone_Ev:
  571|   223k|XmpTextValue* XmpTextValue::clone_() const {
  572|   223k|  return new XmpTextValue(*this);
  573|   223k|}
_ZN5Exiv213XmpArrayValueC2ENS_6TypeIdE:
  575|  4.43k|XmpArrayValue::XmpArrayValue(TypeId typeId) : XmpValue(typeId) {
  576|  4.43k|  setXmpArrayType(xmpArrayType(typeId));
  577|  4.43k|}
_ZN5Exiv213XmpArrayValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  579|  60.9k|int XmpArrayValue::read(const std::string& buf) {
  580|  60.9k|  if (!buf.empty())
  ------------------
  |  Branch (580:7): [True: 58.3k, False: 2.68k]
  ------------------
  581|  58.3k|    value_.push_back(buf);
  582|  60.9k|  return 0;
  583|  60.9k|}
_ZNK5Exiv213XmpArrayValue5countEv:
  589|  30.7k|size_t XmpArrayValue::count() const {
  590|  30.7k|  return value_.size();
  591|  30.7k|}
_ZNK5Exiv213XmpArrayValue5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  593|    190|std::ostream& XmpArrayValue::write(std::ostream& os) const {
  594|    190|  if (!value_.empty()) {
  ------------------
  |  Branch (594:7): [True: 185, False: 5]
  ------------------
  595|    185|    std::copy(value_.begin(), value_.end() - 1, std::ostream_iterator<std::string>(os, ", "));
  596|    185|    os << value_.back();
  597|    185|  }
  598|    190|  return os;
  599|    190|}
_ZNK5Exiv213XmpArrayValue8toStringEm:
  601|  82.1k|std::string XmpArrayValue::toString(size_t n) const {
  602|  82.1k|  ok_ = true;
  603|  82.1k|  return value_.at(n);
  604|  82.1k|}
_ZNK5Exiv213XmpArrayValue6clone_Ev:
  622|  8.79k|XmpArrayValue* XmpArrayValue::clone_() const {
  623|  8.79k|  return new XmpArrayValue(*this);
  624|  8.79k|}
_ZN5Exiv212LangAltValueC2Ev:
  626|  1.14k|LangAltValue::LangAltValue() : XmpValue(langAlt) {
  627|  1.14k|}
_ZN5Exiv212LangAltValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  633|    392|int LangAltValue::read(const std::string& buf) {
  634|    392|  std::string b = buf;
  635|    392|  std::string lang = "x-default";
  636|    392|  if (buf.starts_with("lang=")) {
  ------------------
  |  Branch (636:7): [True: 112, False: 280]
  ------------------
  637|    112|    static constexpr auto ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  638|       |
  639|    112|    const std::string::size_type pos = buf.find_first_of(' ');
  640|    112|    if (pos == std::string::npos) {
  ------------------
  |  Branch (640:9): [True: 23, False: 89]
  ------------------
  641|     23|      lang = buf.substr(5);
  642|     89|    } else {
  643|     89|      lang = buf.substr(5, pos - 5);
  644|     89|    }
  645|    112|    if (lang.empty())
  ------------------
  |  Branch (645:9): [True: 2, False: 110]
  ------------------
  646|      2|      throw Error(ErrorCode::kerInvalidLangAltValue, buf);
  647|       |    // Strip quotes (so you can also specify the language without quotes)
  648|    110|    if (lang.front() == '"') {
  ------------------
  |  Branch (648:9): [True: 33, False: 77]
  ------------------
  649|     33|      lang = lang.substr(1);
  650|       |
  651|     33|      if (lang.empty() || lang.back() != '"')
  ------------------
  |  Branch (651:11): [True: 2, False: 31]
  |  Branch (651:27): [True: 20, False: 11]
  ------------------
  652|     22|        throw Error(ErrorCode::kerInvalidLangAltValue, buf);
  653|       |
  654|     11|      lang.pop_back();
  655|     11|    }
  656|       |
  657|     88|    if (lang.empty())
  ------------------
  |  Branch (657:9): [True: 0, False: 88]
  ------------------
  658|      0|      throw Error(ErrorCode::kerInvalidLangAltValue, buf);
  659|       |
  660|       |    // Check language is in the correct format (see https://www.ietf.org/rfc/rfc3066.txt)
  661|     88|    if (auto charPos = lang.find_first_not_of(ALPHA); charPos != std::string::npos) {
  ------------------
  |  Branch (661:55): [True: 39, False: 49]
  ------------------
  662|     39|      static constexpr auto ALPHA_NUM = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  663|     39|      if (lang.at(charPos) != '-' || lang.find_first_not_of(ALPHA_NUM, charPos + 1) != std::string::npos)
  ------------------
  |  Branch (663:11): [True: 16, False: 23]
  |  Branch (663:38): [True: 7, False: 16]
  ------------------
  664|     23|        throw Error(ErrorCode::kerInvalidLangAltValue, buf);
  665|     39|    }
  666|       |
  667|     65|    b.clear();
  668|     65|    if (pos != std::string::npos)
  ------------------
  |  Branch (668:9): [True: 56, False: 9]
  ------------------
  669|     56|      b = buf.substr(pos + 1);
  670|     65|  }
  671|       |
  672|    345|  value_[lang] = std::move(b);
  673|    345|  return 0;
  674|    392|}
_ZNK5Exiv212LangAltValue5countEv:
  680|    373|size_t LangAltValue::count() const {
  681|    373|  return value_.size();
  682|    373|}
_ZNK5Exiv212LangAltValue5writeERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
  684|    153|std::ostream& LangAltValue::write(std::ostream& os) const {
  685|    153|  bool first = true;
  686|       |
  687|       |  // Write the default entry first
  688|    153|  if (auto i = value_.find("x-default"); i != value_.end()) {
  ------------------
  |  Branch (688:42): [True: 0, False: 153]
  ------------------
  689|      0|    os << "lang=\"" << i->first << "\" " << i->second;
  690|      0|    first = false;
  691|      0|  }
  692|       |
  693|       |  // Write the others
  694|    153|  for (const auto& [lang, s] : value_) {
  ------------------
  |  Branch (694:30): [True: 153, False: 153]
  ------------------
  695|    153|    if (lang != "x-default") {
  ------------------
  |  Branch (695:9): [True: 153, False: 0]
  ------------------
  696|    153|      if (!first)
  ------------------
  |  Branch (696:11): [True: 0, False: 153]
  ------------------
  697|      0|        os << ", ";
  698|    153|      os << "lang=\"" << lang << "\" " << s;
  699|    153|      first = false;
  700|    153|    }
  701|    153|  }
  702|    153|  return os;
  703|    153|}
_ZNK5Exiv212LangAltValue8toStringEm:
  705|    384|std::string LangAltValue::toString(size_t /*n*/) const {
  706|    384|  return toString("x-default");
  707|    384|}
_ZNK5Exiv212LangAltValue8toStringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  709|    384|std::string LangAltValue::toString(const std::string& qualifier) const {
  710|    384|  if (auto i = value_.find(qualifier); i != value_.end()) {
  ------------------
  |  Branch (710:40): [True: 11, False: 373]
  ------------------
  711|     11|    ok_ = true;
  712|     11|    return i->second;
  713|     11|  }
  714|    373|  ok_ = false;
  715|    373|  return "";
  716|    384|}
_ZNK5Exiv212LangAltValue6clone_Ev:
  738|  1.75k|LangAltValue* LangAltValue::clone_() const {
  739|  1.75k|  return new LangAltValue(*this);
  740|  1.75k|}
_ZN5Exiv29DateValueC2Ev:
  742|  4.40k|DateValue::DateValue() : Value(date) {
  743|  4.40k|  date_ = {};
  744|  4.40k|}
_ZN5Exiv29DateValue4readEPKhmNS_9ByteOrderE:
  750|  4.13k|int DateValue::read(const byte* buf, size_t len, ByteOrder /*byteOrder*/) {
  751|  4.13k|  const std::string str(reinterpret_cast<const char*>(buf), len);
  752|  4.13k|  return read(str);
  753|  4.13k|}
_ZN5Exiv29DateValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  755|  4.40k|int DateValue::read(const std::string& buf) {
  756|       |  // ISO 8601 date formats:
  757|       |  // https://web.archive.org/web/20171020084445/https://www.loc.gov/standards/datetime/ISO_DIS%208601-1.pdf
  758|  4.40k|  size_t monthPos = 0;
  759|  4.40k|  size_t dayPos = 0;
  760|       |
  761|  4.40k|  auto printWarning = [] {
  762|  4.40k|#ifndef SUPPRESS_WARNINGS
  763|  4.40k|    EXV_WARNING << Error(ErrorCode::kerUnsupportedDateFormat) << "\n";
  764|  4.40k|#endif
  765|  4.40k|  };
  766|       |
  767|  4.40k|  if (buf.size() < 8) {
  ------------------
  |  Branch (767:7): [True: 683, False: 3.72k]
  ------------------
  768|    683|    printWarning();
  769|    683|    return 1;
  770|    683|  }
  771|       |
  772|  3.72k|  if ((buf.size() >= 10 && buf[4] == '-' && buf[7] == '-') || (buf.size() == 8)) {
  ------------------
  |  Branch (772:8): [True: 2.36k, False: 1.35k]
  |  Branch (772:28): [True: 1.17k, False: 1.19k]
  |  Branch (772:45): [True: 148, False: 1.02k]
  |  Branch (772:63): [True: 1.35k, False: 2.22k]
  ------------------
  773|  1.49k|    if (buf.size() >= 10) {
  ------------------
  |  Branch (773:9): [True: 148, False: 1.35k]
  ------------------
  774|    148|      monthPos = 5;
  775|    148|      dayPos = 8;
  776|  1.35k|    } else {
  777|  1.35k|      monthPos = 4;
  778|  1.35k|      dayPos = 6;
  779|  1.35k|    }
  780|       |
  781|  1.49k|    auto checkDigits = [&buf, &printWarning](size_t start, size_t count, int32_t& dest) {
  782|  1.49k|      for (size_t i = start; i < start + count; ++i) {
  783|  1.49k|        if (!std::isdigit(buf[i])) {
  784|  1.49k|          printWarning();
  785|  1.49k|          return 1;
  786|  1.49k|        }
  787|  1.49k|      }
  788|  1.49k|      dest = std::stoul(buf.substr(start, count));
  789|  1.49k|      return 0;
  790|  1.49k|    };
  791|       |
  792|  1.49k|    if (checkDigits(0, 4, date_.year) || checkDigits(monthPos, 2, date_.month) || checkDigits(dayPos, 2, date_.day)) {
  ------------------
  |  Branch (792:9): [True: 547, False: 951]
  |  Branch (792:42): [True: 349, False: 602]
  |  Branch (792:83): [True: 84, False: 518]
  ------------------
  793|    980|      printWarning();
  794|    980|      return 1;
  795|    980|    }
  796|       |
  797|    518|    if (date_.month > 12 || date_.day > 31) {
  ------------------
  |  Branch (797:9): [True: 262, False: 256]
  |  Branch (797:29): [True: 116, False: 140]
  ------------------
  798|    378|      date_.month = 0;
  799|    378|      date_.day = 0;
  800|    378|      printWarning();
  801|    378|      return 1;
  802|    378|    }
  803|    140|    return 0;
  804|    518|  }
  805|  2.22k|  printWarning();
  806|  2.22k|  return 1;
  807|  3.72k|}
_ZNK5Exiv29DateValue4copyEPhNS_9ByteOrderE:
  813|     86|size_t DateValue::copy(byte* buf, ByteOrder /*byteOrder*/) const {
  814|       |  // \note Here the date is copied in the Basic format YYYYMMDD, as the IPTC key	Iptc.Application2.DateCreated
  815|       |  // wants it. Check https://exiv2.org/iptc.html
  816|       |
  817|     86|  auto out = reinterpret_cast<char*>(buf);
  818|     86|  auto it = stringFormatTo(out, "{:04}{:02}{:02}", date_.year, date_.month, date_.day);
  ------------------
  |  |   19|     86|#define stringFormatTo std::format_to
  ------------------
  819|       |
  820|     86|  return it - out;
  821|     86|}
_ZNK5Exiv29DateValue4sizeEv:
  831|    172|size_t DateValue::size() const {
  832|    172|  return 8;
  833|    172|}
_ZNK5Exiv29DateValue6clone_Ev:
  835|    922|DateValue* DateValue::clone_() const {
  836|    922|  return new DateValue(*this);
  837|    922|}
_ZN5Exiv29TimeValueC2Ev:
  878|  8.41k|TimeValue::TimeValue() : Value(time) {
  879|  8.41k|  time_ = {};
  880|  8.41k|}
_ZN5Exiv29TimeValue4readEPKhmNS_9ByteOrderE:
  886|  8.41k|int TimeValue::read(const byte* buf, size_t len, ByteOrder /*byteOrder*/) {
  887|  8.41k|  const std::string str(reinterpret_cast<const char*>(buf), len);
  888|  8.41k|  return read(str);
  889|  8.41k|}
_ZN5Exiv29TimeValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  891|  8.41k|int TimeValue::read(const std::string& buf) {
  892|       |  // ISO 8601 time formats:
  893|       |  // https://web.archive.org/web/20171020084445/https://www.loc.gov/standards/datetime/ISO_DIS%208601-1.pdf
  894|       |  // Not supported formats:
  895|       |  // 4.2.2.4 Representations with decimal fraction: 232050,5
  896|  8.41k|  auto printWarning = [] {
  897|  8.41k|#ifndef SUPPRESS_WARNINGS
  898|  8.41k|    EXV_WARNING << Error(ErrorCode::kerUnsupportedTimeFormat) << "\n";
  899|  8.41k|#endif
  900|  8.41k|    return 1;
  901|  8.41k|  };
  902|       |
  903|  8.41k|  if (buf.size() < 2)
  ------------------
  |  Branch (903:7): [True: 981, False: 7.42k]
  ------------------
  904|    981|    return printWarning();
  905|       |
  906|  7.42k|  for (auto c : buf)
  ------------------
  |  Branch (906:15): [True: 77.9k, False: 4.99k]
  ------------------
  907|  77.9k|    if (c != ':' && c != '+' && c != '-' && c != 'Z' && !std::isdigit(c))
  ------------------
  |  Branch (907:9): [True: 74.7k, False: 3.17k]
  |  Branch (907:21): [True: 71.0k, False: 3.77k]
  |  Branch (907:33): [True: 66.5k, False: 4.48k]
  |  Branch (907:45): [True: 62.8k, False: 3.70k]
  |  Branch (907:57): [True: 2.43k, False: 60.3k]
  ------------------
  908|  2.43k|      return printWarning();
  909|       |
  910|  4.99k|  size_t mpos;
  911|  4.99k|  size_t spos;
  912|  4.99k|  if (buf.find(':') != std::string::npos) {
  ------------------
  |  Branch (912:7): [True: 1.93k, False: 3.05k]
  ------------------
  913|  1.93k|    mpos = 3;
  914|  1.93k|    spos = 6;
  915|  3.05k|  } else {
  916|  3.05k|    mpos = 2;
  917|  3.05k|    spos = 4;
  918|  3.05k|  }
  919|       |
  920|  4.99k|  try {
  921|  4.99k|    auto hi = std::stoi(buf.substr(0, 2));
  922|  4.99k|    if (hi < 0 || hi > 23)
  ------------------
  |  Branch (922:9): [True: 58, False: 4.93k]
  |  Branch (922:19): [True: 89, False: 4.84k]
  ------------------
  923|    117|      return printWarning();
  924|  4.87k|    time_.hour = hi;
  925|  4.87k|    if (buf.size() > 3) {
  ------------------
  |  Branch (925:9): [True: 3.91k, False: 958]
  ------------------
  926|  3.91k|      auto mi = std::stoi(buf.substr(mpos, 2));
  927|  3.91k|      if (mi < 0 || mi > 59)
  ------------------
  |  Branch (927:11): [True: 141, False: 3.77k]
  |  Branch (927:21): [True: 182, False: 3.59k]
  ------------------
  928|    291|        return printWarning();
  929|  3.62k|      time_.minute = std::stoi(buf.substr(mpos, 2));
  930|  3.62k|    } else {
  931|    958|      time_.minute = 0;
  932|    958|    }
  933|  4.58k|    if (buf.size() > 5) {
  ------------------
  |  Branch (933:9): [True: 2.45k, False: 2.13k]
  ------------------
  934|  2.45k|      auto si = std::stoi(buf.substr(spos, 2));
  935|  2.45k|      if (si < 0 || si > 60)
  ------------------
  |  Branch (935:11): [True: 231, False: 2.22k]
  |  Branch (935:21): [True: 178, False: 2.04k]
  ------------------
  936|    260|        return printWarning();
  937|  2.19k|      time_.second = std::stoi(buf.substr(spos, 2));
  938|  2.19k|    } else {
  939|  2.13k|      time_.second = 0;
  940|  2.13k|    }
  941|       |
  942|  4.32k|    auto fpos = buf.find('+');
  943|  4.32k|    if (fpos == std::string::npos)
  ------------------
  |  Branch (943:9): [True: 1.75k, False: 2.57k]
  ------------------
  944|  1.75k|      fpos = buf.find('-');
  945|       |
  946|  4.32k|    if (fpos != std::string::npos) {
  ------------------
  |  Branch (946:9): [True: 3.95k, False: 372]
  ------------------
  947|  3.95k|      auto format = buf.substr(fpos, buf.size());
  948|       |      // Use the sign of the raw offset string rather than of the parsed
  949|       |      // tzHour: when the hour magnitude is 0 (e.g. "-00:30"), std::stoi
  950|       |      // returns 0, which loses the '-' sign that std::stoi("-00") cannot
  951|       |      // preserve. format always starts with '+' or '-' (see fpos above).
  952|  3.95k|      const bool negative = format.at(0) == '-';
  953|  3.95k|      auto posColon = format.find(':');
  954|  3.95k|      if (posColon == std::string::npos) {
  ------------------
  |  Branch (954:11): [True: 2.36k, False: 1.59k]
  ------------------
  955|       |        // Extended format
  956|  2.36k|        auto tzhi = std::stoi(format.substr(0, 3));
  957|  2.36k|        if (tzhi < -23 || tzhi > 23)
  ------------------
  |  Branch (957:13): [True: 306, False: 2.05k]
  |  Branch (957:27): [True: 574, False: 1.48k]
  ------------------
  958|    796|          return printWarning();
  959|  1.56k|        time_.tzHour = tzhi;
  960|  1.56k|        if (format.size() > 3) {
  ------------------
  |  Branch (960:13): [True: 925, False: 639]
  ------------------
  961|    925|          int minute = std::stoi(format.substr(3));
  962|    925|          if (minute < 0 || minute > 59)
  ------------------
  |  Branch (962:15): [True: 189, False: 736]
  |  Branch (962:29): [True: 264, False: 472]
  ------------------
  963|    300|            return printWarning();
  964|    625|          time_.tzMinute = negative ? -minute : minute;
  ------------------
  |  Branch (964:28): [True: 370, False: 255]
  ------------------
  965|    625|        }
  966|  1.59k|      } else {
  967|       |        // Basic format
  968|  1.59k|        auto tzhi = std::stoi(format.substr(0, posColon));
  969|  1.59k|        if (tzhi < -23 || tzhi > 23)
  ------------------
  |  Branch (969:13): [True: 204, False: 1.39k]
  |  Branch (969:27): [True: 80, False: 1.31k]
  ------------------
  970|    265|          return printWarning();
  971|  1.32k|        time_.tzHour = tzhi;
  972|  1.32k|        int minute = std::stoi(format.substr(posColon + 1));
  973|  1.32k|        if (minute < 0 || minute > 59)
  ------------------
  |  Branch (973:13): [True: 347, False: 982]
  |  Branch (973:27): [True: 407, False: 575]
  ------------------
  974|    665|          return printWarning();
  975|    664|        time_.tzMinute = negative ? -minute : minute;
  ------------------
  |  Branch (975:26): [True: 156, False: 508]
  ------------------
  976|    664|      }
  977|  3.95k|    }
  978|  4.32k|  } catch (std::exception&) {
  979|       |    // std::stoi might throw an exception if the syntax is invalid.
  980|    537|    return printWarning();
  981|    537|  }
  982|  1.76k|  return 0;
  983|  4.99k|}
_ZNK5Exiv29TimeValue4copyEPhNS_9ByteOrderE:
  990|    349|size_t TimeValue::copy(byte* buf, ByteOrder /*byteOrder*/) const {
  991|       |  // NOTE: Here the time is copied in the Basic format HHMMSS:HHMM, as the IPTC key
  992|       |  // Iptc.Application2.TimeCreated wants it. Check https://exiv2.org/iptc.html
  993|    349|  char plusMinus = '+';
  994|    349|  if (time_.tzHour < 0 || time_.tzMinute < 0)
  ------------------
  |  Branch (994:7): [True: 135, False: 214]
  |  Branch (994:27): [True: 7, False: 207]
  ------------------
  995|    142|    plusMinus = '-';
  996|       |
  997|    349|  auto out = reinterpret_cast<char*>(buf);
  998|    349|  auto it = stringFormatTo(out, "{:02}{:02}{:02}{}{:02}{:02}", time_.hour, time_.minute, time_.second, plusMinus,
  ------------------
  |  |   19|    349|#define stringFormatTo std::format_to
  ------------------
  999|    349|                           std::abs(time_.tzHour), std::abs(time_.tzMinute));
 1000|       |
 1001|    349|  auto wrote = static_cast<size_t>(it - out);
 1002|    349|  Internal::enforce(wrote == 11, Exiv2::ErrorCode::kerUnsupportedTimeFormat);
 1003|    349|  return wrote;
 1004|    349|}
_ZNK5Exiv29TimeValue4sizeEv:
 1014|    698|size_t TimeValue::size() const {
 1015|    698|  return 11;
 1016|    698|}
_ZNK5Exiv29TimeValue6clone_Ev:
 1018|  3.44k|TimeValue* TimeValue::clone_() const {
 1019|  3.44k|  return new TimeValue(*this);
 1020|  3.44k|}
value.cpp:_ZZN5Exiv29DateValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  761|  5.24k|  auto printWarning = [] {
  762|  5.24k|#ifndef SUPPRESS_WARNINGS
  763|  5.24k|    EXV_WARNING << Error(ErrorCode::kerUnsupportedDateFormat) << "\n";
  ------------------
  |  |  138|  5.24k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 5.24k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  5.24k|  LogMsg(LogMsg::warn).os()
  ------------------
  764|  5.24k|#endif
  765|  5.24k|  };
value.cpp:_ZZN5Exiv29DateValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_1clEmmRi:
  781|  3.05k|    auto checkDigits = [&buf, &printWarning](size_t start, size_t count, int32_t& dest) {
  782|  10.4k|      for (size_t i = start; i < start + count; ++i) {
  ------------------
  |  Branch (782:30): [True: 8.35k, False: 2.07k]
  ------------------
  783|  8.35k|        if (!std::isdigit(buf[i])) {
  ------------------
  |  Branch (783:13): [True: 980, False: 7.37k]
  ------------------
  784|    980|          printWarning();
  785|    980|          return 1;
  786|    980|        }
  787|  8.35k|      }
  788|  2.07k|      dest = std::stoul(buf.substr(start, count));
  789|  2.07k|      return 0;
  790|  3.05k|    };
value.cpp:_ZZN5Exiv29TimeValue4readERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  896|  6.64k|  auto printWarning = [] {
  897|  6.64k|#ifndef SUPPRESS_WARNINGS
  898|  6.64k|    EXV_WARNING << Error(ErrorCode::kerUnsupportedTimeFormat) << "\n";
  ------------------
  |  |  138|  6.64k|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 6.64k]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|  6.64k|  LogMsg(LogMsg::warn).os()
  ------------------
  899|  6.64k|#endif
  900|  6.64k|    return 1;
  901|  6.64k|  };

_ZN5Exiv213versionNumberEv:
   67|    814|uint32_t versionNumber() {
   68|    814|  return EXIV2_MAKE_VERSION(EXIV2_MAJOR_VERSION, EXIV2_MINOR_VERSION, EXIV2_PATCH_VERSION);
  ------------------
  |  |   19|    814|#define EXIV2_MAKE_VERSION(major, minor, patch) (((major) << 16) | ((minor) << 8) | (patch))
  ------------------
   69|    814|}
_ZN5Exiv222versionNumberHexStringEv:
   75|    814|std::string versionNumberHexString() {
   76|    814|  return stringFormat("{:06x}", Exiv2::versionNumber());
  ------------------
  |  |   18|    814|#define stringFormat std::format
  ------------------
   77|    814|}

_ZN5Exiv29WebPImageC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   78|    388|    Image(ImageType::webp, mdNone, std::move(io), params) {
   79|    388|}  // WebPImage::WebPImage
_ZN5Exiv29WebPImage13writeMetadataEv:
   98|     81|void WebPImage::writeMetadata() {
   99|     81|  if (io_->open() != 0) {
  ------------------
  |  Branch (99:7): [True: 0, False: 81]
  ------------------
  100|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  101|      0|  }
  102|     81|  IoCloser closer(*io_);
  103|     81|  MemIo tempIo;
  104|       |
  105|     81|  doWriteMetadata(tempIo);  // may throw
  106|     81|  io_->close();
  107|     81|  io_->transfer(tempIo);  // may throw
  108|     81|}  // WebPImage::writeMetadata
_ZN5Exiv29WebPImage15doWriteMetadataERNS_7BasicIoE:
  110|     81|void WebPImage::doWriteMetadata(BasicIo& outIo) {
  111|     81|  if (!io_->isopen())
  ------------------
  |  Branch (111:7): [True: 0, False: 81]
  ------------------
  112|      0|    throw Error(ErrorCode::kerInputDataReadFailed);
  113|     81|  if (!outIo.isopen())
  ------------------
  |  Branch (113:7): [True: 0, False: 81]
  ------------------
  114|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  115|       |
  116|       |#ifdef EXIV2_DEBUG_MESSAGES
  117|       |  std::cout << "Writing metadata" << '\n';
  118|       |#endif
  119|       |
  120|     81|  byte data[WEBP_TAG_SIZE * 3];
  121|     81|  DataBuf chunkId(WEBP_TAG_SIZE + 1);
  122|     81|  chunkId.write_uint8(WEBP_TAG_SIZE, '\0');
  123|       |
  124|     81|  io_->readOrThrow(data, WEBP_TAG_SIZE * 3, Exiv2::ErrorCode::kerCorruptedMetadata);
  125|     81|  uint64_t filesize = Exiv2::getULong(data + WEBP_TAG_SIZE, littleEndian);
  126|       |
  127|       |  /* Set up header */
  128|     81|  if (outIo.write(data, WEBP_TAG_SIZE * 3) != WEBP_TAG_SIZE * 3)
  ------------------
  |  Branch (128:7): [True: 0, False: 81]
  ------------------
  129|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  130|       |
  131|       |  /* Parse Chunks */
  132|     81|  bool has_size = false;
  133|     81|  bool has_xmp = false;
  134|     81|  bool has_exif = false;
  135|     81|  bool has_vp8x = false;
  136|     81|  bool has_alpha = false;
  137|     81|  bool has_icc = iccProfileDefined();
  138|       |
  139|     81|  uint32_t width = 0;
  140|     81|  uint32_t height = 0;
  141|       |
  142|     81|  std::array<byte, WEBP_TAG_SIZE> size_buff;
  143|     81|  Blob blob;
  144|       |
  145|     81|  if (!exifData_.empty()) {
  ------------------
  |  Branch (145:7): [True: 15, False: 66]
  ------------------
  146|     15|    ExifParser::encode(blob, littleEndian, exifData_);
  147|     15|    if (!blob.empty()) {
  ------------------
  |  Branch (147:9): [True: 13, False: 2]
  ------------------
  148|     13|      has_exif = true;
  149|     13|    }
  150|     15|  }
  151|       |
  152|     81|  if (!xmpData_.empty() && !writeXmpFromPacket()) {
  ------------------
  |  Branch (152:7): [True: 0, False: 81]
  |  Branch (152:28): [True: 0, False: 0]
  ------------------
  153|      0|    XmpParser::encode(xmpPacket_, xmpData_, XmpParser::useCompactFormat | XmpParser::omitAllFormatting);
  154|      0|  }
  155|     81|  has_xmp = !xmpPacket_.empty();
  156|     81|  std::string xmp(xmpPacket_);
  157|       |
  158|       |  /* Verify for a VP8X Chunk First before writing in
  159|       |   case we have any exif or xmp data, also check
  160|       |   for any chunks with alpha frame/layer set */
  161|  4.89k|  while (!io_->eof() && io_->tell() < filesize) {
  ------------------
  |  Branch (161:10): [True: 4.88k, False: 9]
  |  Branch (161:25): [True: 4.81k, False: 72]
  ------------------
  162|  4.81k|    io_->readOrThrow(chunkId.data(), WEBP_TAG_SIZE, Exiv2::ErrorCode::kerCorruptedMetadata);
  163|  4.81k|    io_->readOrThrow(size_buff.data(), WEBP_TAG_SIZE, Exiv2::ErrorCode::kerCorruptedMetadata);
  164|  4.81k|    const uint32_t size_u32 = Exiv2::getULong(size_buff.data(), littleEndian);
  165|       |
  166|       |    // Check that `size_u32` is within bounds.
  167|  4.81k|    Internal::enforce(size_u32 <= io_->size() - io_->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  168|       |
  169|  4.81k|    DataBuf payload(size_u32);
  170|  4.81k|    if (!payload.empty()) {
  ------------------
  |  Branch (170:9): [True: 733, False: 4.07k]
  ------------------
  171|    733|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  172|    733|      if (payload.size() % 2) {
  ------------------
  |  Branch (172:11): [True: 349, False: 384]
  ------------------
  173|    349|        byte c = 0;
  174|    349|        io_->readOrThrow(&c, 1, Exiv2::ErrorCode::kerCorruptedMetadata);
  175|    349|      }
  176|    733|    }
  177|       |
  178|       |    /* Chunk with information about features
  179|       |     used in the file. */
  180|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8X) && !has_vp8x) {
  ------------------
  |  Branch (180:9): [True: 40, False: 4.77k]
  |  Branch (180:59): [True: 23, False: 17]
  ------------------
  181|     23|      has_vp8x = true;
  182|     23|    }
  183|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8X) && !has_size) {
  ------------------
  |  Branch (183:9): [True: 40, False: 4.77k]
  |  Branch (183:59): [True: 20, False: 20]
  ------------------
  184|     20|      Internal::enforce(size_u32 >= 10, Exiv2::ErrorCode::kerCorruptedMetadata);
  185|     20|      has_size = true;
  186|     20|      std::array<byte, WEBP_TAG_SIZE> size_buf;
  187|       |
  188|       |      // Fetch width - stored in 24bits
  189|     20|      std::copy_n(payload.begin() + 4, 3, size_buf.begin());
  190|     20|      size_buf.back() = 0;
  191|     20|      width = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  192|       |
  193|       |      // Fetch height - stored in 24bits
  194|     20|      std::copy_n(payload.begin() + 7, 3, size_buf.begin());
  195|     20|      size_buf.back() = 0;
  196|     20|      height = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  197|     20|    }
  198|       |
  199|       |    /* Chunk with animation control data. */
  200|       |#ifdef __CHECK_FOR_ALPHA__  // Maybe in the future
  201|       |    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ANIM) && !has_alpha) {
  202|       |      has_alpha = true;
  203|       |    }
  204|       |#endif
  205|       |
  206|       |    /* Chunk with lossy image data. */
  207|       |#ifdef __CHECK_FOR_ALPHA__  // Maybe in the future
  208|       |    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8) && !has_alpha) {
  209|       |      has_alpha = true;
  210|       |    }
  211|       |#endif
  212|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8) && !has_size) {
  ------------------
  |  Branch (212:9): [True: 18, False: 4.79k]
  |  Branch (212:58): [True: 4, False: 14]
  ------------------
  213|      4|      Internal::enforce(size_u32 >= 10, Exiv2::ErrorCode::kerCorruptedMetadata);
  214|      4|      has_size = true;
  215|      4|      std::array<byte, 2> size_buf;
  216|       |
  217|       |      /* Refer to this https://tools.ietf.org/html/rfc6386
  218|       |         for height and width reference for VP8 chunks */
  219|       |
  220|       |      // Fetch width - stored in 16bits
  221|      4|      std::copy_n(payload.begin() + 6, 2, size_buf.begin());
  222|      4|      width = Exiv2::getUShort(size_buf.data(), littleEndian) & 0x3fff;
  223|       |
  224|       |      // Fetch height - stored in 16bits
  225|      4|      std::copy_n(payload.begin() + 8, 2, size_buf.begin());
  226|      4|      height = Exiv2::getUShort(size_buf.data(), littleEndian) & 0x3fff;
  227|      4|    }
  228|       |
  229|       |    /* Chunk with lossless image data. */
  230|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8L) && !has_alpha) {
  ------------------
  |  Branch (230:9): [True: 43, False: 4.76k]
  |  Branch (230:59): [True: 35, False: 8]
  ------------------
  231|     35|      Internal::enforce(size_u32 >= 5, Exiv2::ErrorCode::kerCorruptedMetadata);
  232|     35|      if ((payload.read_uint8(4) & WEBP_VP8X_ALPHA_BIT) == WEBP_VP8X_ALPHA_BIT) {
  ------------------
  |  Branch (232:11): [True: 3, False: 32]
  ------------------
  233|      3|        has_alpha = true;
  234|      3|      }
  235|     35|    }
  236|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8L) && !has_size) {
  ------------------
  |  Branch (236:9): [True: 42, False: 4.76k]
  |  Branch (236:59): [True: 21, False: 21]
  ------------------
  237|     21|      Internal::enforce(size_u32 >= 5, Exiv2::ErrorCode::kerCorruptedMetadata);
  238|     21|      has_size = true;
  239|     21|      std::array<byte, 2> size_buf_w;
  240|     21|      std::array<byte, 3> size_buf_h;
  241|       |
  242|       |      /* For VP8L chunks width & height are stored in 28 bits
  243|       |         of a 32 bit field requires bitshifting to get actual
  244|       |         sizes. Width and height are split even into 14 bits
  245|       |         each. Refer to this https://goo.gl/bpgMJf */
  246|       |
  247|       |      // Fetch width - 14 bits wide
  248|     21|      std::copy_n(payload.begin() + 1, 2, size_buf_w.begin());
  249|     21|      size_buf_w.back() &= 0x3F;
  250|     21|      width = Exiv2::getUShort(size_buf_w.data(), littleEndian) + 1;
  251|       |
  252|       |      // Fetch height - 14 bits wide
  253|     21|      std::copy_n(payload.begin() + 2, 3, size_buf_h.begin());
  254|     21|      size_buf_h[0] = ((size_buf_h[0] >> 6) & 0x3) | ((size_buf_h[1] & 0x3FU) << 0x2);
  255|     21|      size_buf_h[1] = ((size_buf_h[1] >> 6) & 0x3) | ((size_buf_h[2] & 0xFU) << 0x2);
  256|     21|      height = Exiv2::getUShort(size_buf_h.data(), littleEndian) + 1;
  257|     21|    }
  258|       |
  259|       |    /* Chunk with animation frame. */
  260|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ANMF) && !has_alpha) {
  ------------------
  |  Branch (260:9): [True: 80, False: 4.73k]
  |  Branch (260:59): [True: 24, False: 56]
  ------------------
  261|     24|      Internal::enforce(size_u32 >= 6, Exiv2::ErrorCode::kerCorruptedMetadata);
  262|     24|      if ((payload.read_uint8(5) & 0x2) == 0x2) {
  ------------------
  |  Branch (262:11): [True: 7, False: 17]
  ------------------
  263|      7|        has_alpha = true;
  264|      7|      }
  265|     24|    }
  266|  4.81k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ANMF) && !has_size) {
  ------------------
  |  Branch (266:9): [True: 80, False: 4.73k]
  |  Branch (266:59): [True: 5, False: 75]
  ------------------
  267|      5|      Internal::enforce(size_u32 >= 12, Exiv2::ErrorCode::kerCorruptedMetadata);
  268|      5|      has_size = true;
  269|      5|      std::array<byte, WEBP_TAG_SIZE> size_buf;
  270|       |
  271|       |      // Fetch width - stored in 24bits
  272|      5|      std::copy_n(payload.begin() + 6, 3, size_buf.begin());
  273|      5|      size_buf.back() = 0;
  274|      5|      width = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  275|       |
  276|       |      // Fetch height - stored in 24bits
  277|      5|      std::copy_n(payload.begin() + 9, 3, size_buf.begin());
  278|      5|      size_buf.back() = 0;
  279|      5|      height = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  280|      5|    }
  281|       |
  282|       |    /* Chunk with alpha data. */
  283|  4.81k|    if (equalsWebPTag(chunkId, "ALPH") && !has_alpha) {
  ------------------
  |  Branch (283:9): [True: 14, False: 4.79k]
  |  Branch (283:43): [True: 2, False: 12]
  ------------------
  284|      2|      has_alpha = true;
  285|      2|    }
  286|  4.81k|  }
  287|       |
  288|       |  /* Inject a VP8X chunk if one isn't available. */
  289|     81|  if (!has_vp8x) {
  ------------------
  |  Branch (289:7): [True: 50, False: 31]
  ------------------
  290|     50|    inject_VP8X(outIo, has_xmp, has_exif, has_alpha, has_icc, width, height);
  291|     50|  }
  292|       |
  293|     81|  io_->seek(12, BasicIo::beg);
  294|  4.54k|  while (!io_->eof() && io_->tell() < filesize) {
  ------------------
  |  Branch (294:10): [True: 4.51k, False: 35]
  |  Branch (294:25): [True: 4.46k, False: 46]
  ------------------
  295|  4.46k|    io_->readOrThrow(chunkId.data(), 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  296|  4.46k|    io_->readOrThrow(size_buff.data(), 4, Exiv2::ErrorCode::kerCorruptedMetadata);
  297|       |
  298|  4.46k|    const uint32_t size_u32 = Exiv2::getULong(size_buff.data(), littleEndian);
  299|       |
  300|       |    // Check that `size_u32` is within bounds.
  301|  4.46k|    Internal::enforce(size_u32 <= io_->size() - io_->tell(), Exiv2::ErrorCode::kerCorruptedMetadata);
  302|       |
  303|  4.46k|    DataBuf payload(size_u32);
  304|  4.46k|    io_->readOrThrow(payload.data(), size_u32, Exiv2::ErrorCode::kerCorruptedMetadata);
  305|  4.46k|    if (io_->tell() % 2)
  ------------------
  |  Branch (305:9): [True: 223, False: 4.24k]
  ------------------
  306|    223|      io_->seek(+1, BasicIo::cur);  // skip pad
  307|       |
  308|  4.46k|    if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8X)) {
  ------------------
  |  Branch (308:9): [True: 39, False: 4.42k]
  ------------------
  309|     39|      Internal::enforce(size_u32 >= 1, Exiv2::ErrorCode::kerCorruptedMetadata);
  310|     39|      if (has_icc) {
  ------------------
  |  Branch (310:11): [True: 2, False: 37]
  ------------------
  311|      2|        const uint8_t x = payload.read_uint8(0);
  312|      2|        payload.write_uint8(0, x | WEBP_VP8X_ICC_BIT);
  313|     37|      } else {
  314|     37|        const uint8_t x = payload.read_uint8(0);
  315|     37|        payload.write_uint8(0, x & ~WEBP_VP8X_ICC_BIT);
  316|     37|      }
  317|       |
  318|     39|      if (has_xmp) {
  ------------------
  |  Branch (318:11): [True: 6, False: 33]
  ------------------
  319|      6|        const uint8_t x = payload.read_uint8(0);
  320|      6|        payload.write_uint8(0, x | WEBP_VP8X_XMP_BIT);
  321|     33|      } else {
  322|     33|        const uint8_t x = payload.read_uint8(0);
  323|     33|        payload.write_uint8(0, x & ~WEBP_VP8X_XMP_BIT);
  324|     33|      }
  325|       |
  326|     39|      if (has_exif) {
  ------------------
  |  Branch (326:11): [True: 3, False: 36]
  ------------------
  327|      3|        const uint8_t x = payload.read_uint8(0);
  328|      3|        payload.write_uint8(0, x | WEBP_VP8X_EXIF_BIT);
  329|     36|      } else {
  330|     36|        const uint8_t x = payload.read_uint8(0);
  331|     36|        payload.write_uint8(0, x & ~WEBP_VP8X_EXIF_BIT);
  332|     36|      }
  333|       |
  334|     39|      if (outIo.write(chunkId.c_data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (334:11): [True: 0, False: 39]
  ------------------
  335|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  336|     39|      if (outIo.write(size_buff.data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (336:11): [True: 0, False: 39]
  ------------------
  337|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  338|     39|      if (outIo.write(payload.c_data(), payload.size()) != payload.size())
  ------------------
  |  Branch (338:11): [True: 0, False: 39]
  ------------------
  339|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  340|     39|      if (outIo.tell() % 2 && outIo.write(&WEBP_PAD_ODD, 1) != 1)
  ------------------
  |  Branch (340:11): [True: 10, False: 29]
  |  Branch (340:31): [True: 0, False: 10]
  ------------------
  341|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  342|       |
  343|     39|      if (has_icc) {
  ------------------
  |  Branch (343:11): [True: 2, False: 37]
  ------------------
  344|      2|        if (outIo.write(reinterpret_cast<const byte*>(WEBP_CHUNK_HEADER_ICCP), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (344:13): [True: 0, False: 2]
  ------------------
  345|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  346|      2|        ul2Data(data, static_cast<uint32_t>(iccProfile_.size()), littleEndian);
  347|      2|        if (outIo.write(data, WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (347:13): [True: 0, False: 2]
  ------------------
  348|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  349|      2|        if (outIo.write(iccProfile_.c_data(), iccProfile_.size()) != iccProfile_.size()) {
  ------------------
  |  Branch (349:13): [True: 0, False: 2]
  ------------------
  350|      0|          throw Error(ErrorCode::kerImageWriteFailed);
  351|      0|        }
  352|      2|        has_icc = false;
  353|      2|      }
  354|  4.42k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ICCP)) {
  ------------------
  |  Branch (354:16): [True: 55, False: 4.37k]
  ------------------
  355|       |      // Skip it altogether handle it prior to here :)
  356|  4.37k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF)) {
  ------------------
  |  Branch (356:16): [True: 64, False: 4.30k]
  ------------------
  357|       |      // Skip and add new data afterwards
  358|  4.30k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_XMP)) {
  ------------------
  |  Branch (358:16): [True: 11, False: 4.29k]
  ------------------
  359|       |      // Skip and add new data afterwards
  360|  4.29k|    } else {
  361|  4.29k|      if (outIo.write(chunkId.c_data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (361:11): [True: 0, False: 4.29k]
  ------------------
  362|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  363|  4.29k|      if (outIo.write(size_buff.data(), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (363:11): [True: 0, False: 4.29k]
  ------------------
  364|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  365|  4.29k|      if (outIo.write(payload.c_data(), payload.size()) != payload.size())
  ------------------
  |  Branch (365:11): [True: 0, False: 4.29k]
  ------------------
  366|      0|        throw Error(ErrorCode::kerImageWriteFailed);
  367|  4.29k|    }
  368|       |
  369|       |    // Encoder required to pad odd sized data with a null byte
  370|  4.46k|    if (outIo.tell() % 2 && outIo.write(&WEBP_PAD_ODD, 1) != 1)
  ------------------
  |  Branch (370:9): [True: 200, False: 4.26k]
  |  Branch (370:29): [True: 0, False: 200]
  ------------------
  371|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  372|  4.46k|  }
  373|       |
  374|     81|  if (has_exif) {
  ------------------
  |  Branch (374:7): [True: 9, False: 72]
  ------------------
  375|      9|    if (outIo.write(reinterpret_cast<const byte*>(WEBP_CHUNK_HEADER_EXIF), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (375:9): [True: 0, False: 9]
  ------------------
  376|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  377|      9|    us2Data(data, static_cast<uint16_t>(blob.size()) + 8, bigEndian);
  378|      9|    ul2Data(data, static_cast<uint32_t>(blob.size()), littleEndian);
  379|      9|    if (outIo.write(data, WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (379:9): [True: 0, False: 9]
  ------------------
  380|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  381|      9|    if (outIo.write(blob.data(), blob.size()) != blob.size()) {
  ------------------
  |  Branch (381:9): [True: 0, False: 9]
  ------------------
  382|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  383|      0|    }
  384|      9|    if (outIo.tell() % 2 && outIo.write(&WEBP_PAD_ODD, 1) != 1)
  ------------------
  |  Branch (384:9): [True: 0, False: 9]
  |  Branch (384:29): [True: 0, False: 0]
  ------------------
  385|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  386|      9|  }
  387|       |
  388|     81|  if (has_xmp) {
  ------------------
  |  Branch (388:7): [True: 5, False: 76]
  ------------------
  389|      5|    if (outIo.write(reinterpret_cast<const byte*>(WEBP_CHUNK_HEADER_XMP), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (389:9): [True: 0, False: 5]
  ------------------
  390|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  391|      5|    ul2Data(data, static_cast<uint32_t>(xmpPacket().size()), littleEndian);
  392|      5|    if (outIo.write(data, WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (392:9): [True: 0, False: 5]
  ------------------
  393|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  394|      5|    if (outIo.write(reinterpret_cast<const byte*>(xmp.data()), xmp.size()) != xmp.size()) {
  ------------------
  |  Branch (394:9): [True: 0, False: 5]
  ------------------
  395|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  396|      0|    }
  397|      5|    if (outIo.tell() % 2 && outIo.write(&WEBP_PAD_ODD, 1) != 1)
  ------------------
  |  Branch (397:9): [True: 4, False: 1]
  |  Branch (397:29): [True: 0, False: 4]
  ------------------
  398|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  399|      5|  }
  400|       |
  401|       |  // Fix File Size Payload Data
  402|     81|  outIo.seek(0, BasicIo::beg);
  403|     81|  filesize = outIo.size() - 8;
  404|     81|  outIo.seek(4, BasicIo::beg);
  405|     81|  ul2Data(data, static_cast<uint32_t>(filesize), littleEndian);
  406|     81|  if (outIo.write(data, WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (406:7): [True: 0, False: 81]
  ------------------
  407|      0|    throw Error(ErrorCode::kerImageWriteFailed);
  408|       |
  409|     81|}  // WebPImage::writeMetadata
_ZN5Exiv29WebPImage12readMetadataEv:
  476|    388|void WebPImage::readMetadata() {
  477|    388|  if (io_->open() != 0)
  ------------------
  |  Branch (477:7): [True: 0, False: 388]
  ------------------
  478|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
  479|    388|  IoCloser closer(*io_);
  480|       |  // Ensure that this is the correct image type
  481|    388|  if (!isWebPType(*io_, true)) {
  ------------------
  |  Branch (481:7): [True: 0, False: 388]
  ------------------
  482|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (482:9): [True: 0, False: 0]
  |  Branch (482:25): [True: 0, False: 0]
  ------------------
  483|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
  484|      0|    throw Error(ErrorCode::kerNotAJpeg);
  485|      0|  }
  486|    388|  clearMetadata();
  487|       |
  488|    388|  byte data[12];
  489|    388|  DataBuf chunkId(5);
  490|    388|  chunkId.write_uint8(4, '\0');
  491|       |
  492|    388|  io_->readOrThrow(data, WEBP_TAG_SIZE * 3, Exiv2::ErrorCode::kerCorruptedMetadata);
  493|       |
  494|    388|  const uint32_t filesize = Safe::add(Exiv2::getULong(data + WEBP_TAG_SIZE, littleEndian), 8U);
  495|    388|  Internal::enforce(filesize <= io_->size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  496|       |
  497|    388|  WebPImage::decodeChunks(filesize);
  498|       |
  499|    388|}  // WebPImage::readMetadata
_ZN5Exiv29WebPImage12decodeChunksEj:
  501|    372|void WebPImage::decodeChunks(uint32_t filesize) {
  502|    372|  DataBuf chunkId(5);
  503|    372|  std::array<byte, WEBP_TAG_SIZE> size_buff;
  504|    372|  bool has_canvas_data = false;
  505|       |
  506|       |#ifdef EXIV2_DEBUG_MESSAGES
  507|       |  std::cout << "Reading metadata" << '\n';
  508|       |#endif
  509|       |
  510|    372|  chunkId.write_uint8(4, '\0');
  511|  6.46k|  while (!io_->eof() && io_->tell() < filesize) {
  ------------------
  |  Branch (511:10): [True: 6.21k, False: 253]
  |  Branch (511:25): [True: 6.09k, False: 119]
  ------------------
  512|  6.09k|    io_->readOrThrow(chunkId.data(), WEBP_TAG_SIZE, Exiv2::ErrorCode::kerCorruptedMetadata);
  513|  6.09k|    io_->readOrThrow(size_buff.data(), WEBP_TAG_SIZE, Exiv2::ErrorCode::kerCorruptedMetadata);
  514|       |
  515|  6.09k|    const uint32_t size = Exiv2::getULong(size_buff.data(), littleEndian);
  516|       |
  517|       |    // Check that `size` is within bounds.
  518|  6.09k|    Internal::enforce(io_->tell() <= filesize, Exiv2::ErrorCode::kerCorruptedMetadata);
  519|  6.09k|    Internal::enforce(size <= (filesize - io_->tell()), Exiv2::ErrorCode::kerCorruptedMetadata);
  520|       |
  521|  6.09k|    if (DataBuf payload(size); payload.empty()) {
  ------------------
  |  Branch (521:32): [True: 4.75k, False: 1.34k]
  ------------------
  522|  4.75k|      io_->seek(size, BasicIo::cur);
  523|  4.75k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8X) && !has_canvas_data) {
  ------------------
  |  Branch (523:16): [True: 66, False: 1.27k]
  |  Branch (523:66): [True: 46, False: 20]
  ------------------
  524|     46|      Internal::enforce(size >= 10, Exiv2::ErrorCode::kerCorruptedMetadata);
  525|       |
  526|     46|      has_canvas_data = true;
  527|     46|      std::array<byte, WEBP_TAG_SIZE> size_buf;
  528|       |
  529|     46|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  530|       |
  531|       |      // Fetch width
  532|     46|      std::copy_n(payload.begin() + 4, 3, size_buf.begin());
  533|     46|      size_buf.back() = 0;
  534|     46|      pixelWidth_ = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  535|       |
  536|       |      // Fetch height
  537|     46|      std::copy_n(payload.begin() + 7, 3, size_buf.begin());
  538|     46|      size_buf.back() = 0;
  539|     46|      pixelHeight_ = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  540|  1.29k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8) && !has_canvas_data) {
  ------------------
  |  Branch (540:16): [True: 28, False: 1.26k]
  |  Branch (540:65): [True: 11, False: 17]
  ------------------
  541|     11|      Internal::enforce(size >= 10, Exiv2::ErrorCode::kerCorruptedMetadata);
  542|       |
  543|     11|      has_canvas_data = true;
  544|     11|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  545|     11|      std::array<byte, WEBP_TAG_SIZE> size_buf;
  546|       |
  547|       |      // Fetch width""
  548|     11|      std::copy_n(payload.begin() + 6, 2, size_buf.begin());
  549|     11|      size_buf[2] = 0;
  550|     11|      size_buf[3] = 0;
  551|     11|      pixelWidth_ = Exiv2::getULong(size_buf.data(), littleEndian) & 0x3fff;
  552|       |
  553|       |      // Fetch height
  554|     11|      std::copy_n(payload.begin() + 8, 2, size_buf.begin());
  555|     11|      size_buf[2] = 0;
  556|     11|      size_buf[3] = 0;
  557|     11|      pixelHeight_ = Exiv2::getULong(size_buf.data(), littleEndian) & 0x3fff;
  558|  1.28k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_VP8L) && !has_canvas_data) {
  ------------------
  |  Branch (558:16): [True: 70, False: 1.21k]
  |  Branch (558:66): [True: 43, False: 27]
  ------------------
  559|     43|      Internal::enforce(size >= 5, Exiv2::ErrorCode::kerCorruptedMetadata);
  560|       |
  561|     43|      has_canvas_data = true;
  562|     43|      std::array<byte, 2> size_buf_w;
  563|     43|      std::array<byte, 3> size_buf_h;
  564|       |
  565|     43|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  566|       |
  567|       |      // Fetch width
  568|     43|      std::copy_n(payload.begin() + 1, 2, size_buf_w.begin());
  569|     43|      size_buf_w.back() &= 0x3F;
  570|     43|      pixelWidth_ = Exiv2::getUShort(size_buf_w.data(), littleEndian) + 1;
  571|       |
  572|       |      // Fetch height
  573|     43|      std::copy_n(payload.begin() + 2, 3, size_buf_h.begin());
  574|     43|      size_buf_h[0] = ((size_buf_h[0] >> 6) & 0x3) | ((size_buf_h[1] & 0x3FU) << 0x2);
  575|     43|      size_buf_h[1] = ((size_buf_h[1] >> 6) & 0x3) | ((size_buf_h[2] & 0xFU) << 0x2);
  576|     43|      pixelHeight_ = Exiv2::getUShort(size_buf_h.data(), littleEndian) + 1;
  577|  1.24k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ANMF) && !has_canvas_data) {
  ------------------
  |  Branch (577:16): [True: 85, False: 1.15k]
  |  Branch (577:66): [True: 9, False: 76]
  ------------------
  578|      9|      Internal::enforce(size >= 12, Exiv2::ErrorCode::kerCorruptedMetadata);
  579|       |
  580|      9|      has_canvas_data = true;
  581|      9|      std::array<byte, WEBP_TAG_SIZE> size_buf;
  582|       |
  583|      9|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  584|       |
  585|       |      // Fetch width
  586|      9|      std::copy_n(payload.begin() + 6, 3, size_buf.begin());
  587|      9|      size_buf.back() = 0;
  588|      9|      pixelWidth_ = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  589|       |
  590|       |      // Fetch height
  591|      9|      std::copy_n(payload.begin() + 9, 3, size_buf.begin());
  592|      9|      size_buf.back() = 0;
  593|      9|      pixelHeight_ = Exiv2::getULong(size_buf.data(), littleEndian) + 1;
  594|  1.23k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_ICCP)) {
  ------------------
  |  Branch (594:16): [True: 5, False: 1.22k]
  ------------------
  595|      5|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  596|      5|      this->setIccProfile(std::move(payload));
  597|  1.22k|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_EXIF)) {
  ------------------
  |  Branch (597:16): [True: 341, False: 887]
  ------------------
  598|    341|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  599|       |
  600|    341|      std::array<byte, 2> size_buff2;
  601|       |      // 4 meaningful bytes + 2 padding bytes
  602|    341|      auto exifLongHeader = std::array<byte, 6>{0xFF, 0x01, 0xFF, 0xE1, 0x00, 0x00};
  603|    341|      auto exifShortHeader = std::array<byte, 6>{0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
  604|    341|      const byte exifTiffLEHeader[] = {0x49, 0x49, 0x2A};        // "MM*"
  605|    341|      const byte exifTiffBEHeader[] = {0x4D, 0x4D, 0x00, 0x2A};  // "II\0*"
  606|    341|      size_t offset = 0;
  607|    341|      bool s_header = false;
  608|    341|      bool le_header = false;
  609|    341|      bool be_header = false;
  610|    341|      size_t pos = getHeaderOffset(payload.c_data(), payload.size(), exifLongHeader.data(), 4);
  611|       |
  612|    341|      if (pos == std::string::npos) {
  ------------------
  |  Branch (612:11): [True: 312, False: 29]
  ------------------
  613|    312|        pos = getHeaderOffset(payload.c_data(), payload.size(), exifLongHeader.data(), 6);
  614|    312|        if (pos != std::string::npos) {
  ------------------
  |  Branch (614:13): [True: 0, False: 312]
  ------------------
  615|      0|          s_header = true;
  616|      0|        }
  617|    312|      }
  618|    341|      if (pos == std::string::npos) {
  ------------------
  |  Branch (618:11): [True: 312, False: 29]
  ------------------
  619|    312|        pos = getHeaderOffset(payload.c_data(), payload.size(), exifTiffLEHeader, 3);
  620|    312|        if (pos != std::string::npos) {
  ------------------
  |  Branch (620:13): [True: 15, False: 297]
  ------------------
  621|     15|          le_header = true;
  622|     15|        }
  623|    312|      }
  624|    341|      if (pos == std::string::npos) {
  ------------------
  |  Branch (624:11): [True: 297, False: 44]
  ------------------
  625|    297|        pos = getHeaderOffset(payload.c_data(), payload.size(), exifTiffBEHeader, 4);
  626|    297|        if (pos != std::string::npos) {
  ------------------
  |  Branch (626:13): [True: 66, False: 231]
  ------------------
  627|     66|          be_header = true;
  628|     66|        }
  629|    297|      }
  630|       |
  631|    341|      if (s_header) {
  ------------------
  |  Branch (631:11): [True: 0, False: 341]
  ------------------
  632|      0|        offset += 6;
  633|      0|      }
  634|    341|      if (be_header || le_header) {
  ------------------
  |  Branch (634:11): [True: 66, False: 275]
  |  Branch (634:24): [True: 15, False: 260]
  ------------------
  635|     81|        offset += 12;
  636|     81|      }
  637|       |
  638|    341|      const size_t sizePayload = Safe::add(payload.size(), offset);
  639|    341|      DataBuf rawExifData(sizePayload);
  640|       |
  641|    341|      if (s_header) {
  ------------------
  |  Branch (641:11): [True: 0, False: 341]
  ------------------
  642|      0|        us2Data(size_buff2.data(), static_cast<uint16_t>(sizePayload - 6), bigEndian);
  643|      0|        std::copy_n(exifLongHeader.begin(), 4, rawExifData.begin());
  644|      0|        std::copy(size_buff2.begin(), size_buff2.end(), rawExifData.begin() + 4);
  645|      0|      }
  646|       |
  647|    341|      if (be_header || le_header) {
  ------------------
  |  Branch (647:11): [True: 66, False: 275]
  |  Branch (647:24): [True: 15, False: 260]
  ------------------
  648|     81|        us2Data(size_buff2.data(), static_cast<uint16_t>(sizePayload - 6), bigEndian);
  649|     81|        std::copy_n(exifLongHeader.begin(), 4, rawExifData.begin());
  650|     81|        std::copy(size_buff2.begin(), size_buff2.end(), rawExifData.begin() + 4);
  651|     81|        std::copy(exifShortHeader.begin(), exifShortHeader.end(), rawExifData.begin() + 6);
  652|     81|      }
  653|       |
  654|    341|      std::copy(payload.begin(), payload.end(), rawExifData.begin() + offset);
  655|       |
  656|       |#ifdef EXIV2_DEBUG_MESSAGES
  657|       |      std::cout << "Display Hex Dump [size:" << sizePayload << "]" << '\n';
  658|       |      std::cout << binaryToHex(rawExifData.c_data(), sizePayload);
  659|       |#endif
  660|       |
  661|    341|      if (pos != std::string::npos) {
  ------------------
  |  Branch (661:11): [True: 110, False: 231]
  ------------------
  662|    110|        XmpData xmpData;
  663|    110|        const DecodeParams dp(max_recursion_depth_);
  664|    110|        ByteOrder bo = ExifParser::decode(exifData_, payload.c_data(pos), payload.size() - pos, dp);
  665|    110|        setByteOrder(bo);
  666|    231|      } else {
  667|    231|#ifndef SUPPRESS_WARNINGS
  668|    231|        EXV_WARNING << "Failed to decode Exif metadata." << '\n';
  ------------------
  |  |  138|    231|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 231]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    231|  LogMsg(LogMsg::warn).os()
  ------------------
  669|    231|#endif
  670|    231|        exifData_.clear();
  671|    231|      }
  672|    887|    } else if (equalsWebPTag(chunkId, WEBP_CHUNK_HEADER_XMP)) {
  ------------------
  |  Branch (672:16): [True: 20, False: 867]
  ------------------
  673|     20|      io_->readOrThrow(payload.data(), payload.size(), Exiv2::ErrorCode::kerCorruptedMetadata);
  674|     20|      xmpPacket_.assign(payload.c_str(), payload.size());
  675|     20|      const DecodeParams dp(max_recursion_depth_);
  676|     20|      if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp)) {
  ------------------
  |  Branch (676:11): [True: 20, False: 0]
  |  Branch (676:34): [True: 20, False: 0]
  ------------------
  677|     20|#ifndef SUPPRESS_WARNINGS
  678|     20|        EXV_WARNING << "Failed to decode XMP metadata." << '\n';
  ------------------
  |  |  138|     20|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 20]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|     20|  LogMsg(LogMsg::warn).os()
  ------------------
  679|     20|#endif
  680|     20|      } else {
  681|       |#ifdef EXIV2_DEBUG_MESSAGES
  682|       |        std::cout << "Display Hex Dump [size:" << payload.size() << "]" << '\n';
  683|       |        std::cout << binaryToHex(payload.c_data(), payload.size());
  684|       |#endif
  685|      0|      }
  686|    867|    } else {
  687|    867|      io_->seek(size, BasicIo::cur);
  688|    867|    }
  689|       |
  690|  6.09k|    if (io_->tell() % 2)
  ------------------
  |  Branch (690:9): [True: 600, False: 5.49k]
  ------------------
  691|    600|      io_->seek(+1, BasicIo::cur);
  692|  6.09k|  }
  693|    372|}
_ZN5Exiv215newWebPInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  697|    388|Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  698|    388|  auto image = std::make_unique<WebPImage>(std::move(io), params);
  699|    388|  if (!image->good()) {
  ------------------
  |  Branch (699:7): [True: 0, False: 388]
  ------------------
  700|      0|    return nullptr;
  701|      0|  }
  702|    388|  return image;
  703|    388|}
_ZN5Exiv210isWebPTypeERNS_7BasicIoEb:
  705|  25.9k|bool isWebPType(BasicIo& iIo, bool /*advance*/) {
  706|  25.9k|  if (iIo.size() < 12) {
  ------------------
  |  Branch (706:7): [True: 156, False: 25.7k]
  ------------------
  707|    156|    return false;
  708|    156|  }
  709|  25.7k|  const int32_t len = 4;
  710|  25.7k|  constexpr std::array<byte, len> RiffImageId{'R', 'I', 'F', 'F'};
  711|  25.7k|  constexpr std::array<byte, len> WebPImageId{'W', 'E', 'B', 'P'};
  712|  25.7k|  std::array<byte, len> webp;
  713|  25.7k|  std::array<byte, len> data;
  714|  25.7k|  std::array<byte, len> riff;
  715|  25.7k|  iIo.readOrThrow(riff.data(), len, Exiv2::ErrorCode::kerCorruptedMetadata);
  716|  25.7k|  iIo.readOrThrow(data.data(), len, Exiv2::ErrorCode::kerCorruptedMetadata);
  717|  25.7k|  iIo.readOrThrow(webp.data(), len, Exiv2::ErrorCode::kerCorruptedMetadata);
  718|  25.7k|  bool matched_riff = riff == RiffImageId;
  719|  25.7k|  bool matched_webp = webp == WebPImageId;
  720|  25.7k|  iIo.seek(-12, BasicIo::cur);
  721|  25.7k|  return matched_riff && matched_webp;
  ------------------
  |  Branch (721:10): [True: 1.83k, False: 23.9k]
  |  Branch (721:26): [True: 1.16k, False: 673]
  ------------------
  722|  25.9k|}
_ZN5Exiv29WebPImage13equalsWebPTagERKNS_7DataBufEPKc:
  731|  63.5k|bool WebPImage::equalsWebPTag(const Exiv2::DataBuf& buf, const char* str) {
  732|  71.9k|  for (int i = 0; i < 4; i++)
  ------------------
  |  Branch (732:19): [True: 70.7k, False: 1.14k]
  ------------------
  733|  70.7k|    if (toupper(buf.read_uint8(i)) != str[i])
  ------------------
  |  Branch (733:9): [True: 62.3k, False: 8.38k]
  ------------------
  734|  62.3k|      return false;
  735|  1.14k|  return true;
  736|  63.5k|}
_ZNK5Exiv29WebPImage11inject_VP8XERNS_7BasicIoEbbbbjj:
  746|     50|                            uint32_t height) const {
  747|     50|  const byte size[4] = {0x0A, 0x00, 0x00, 0x00};
  748|     50|  byte data[10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  749|     50|  iIo.write(reinterpret_cast<const byte*>(WEBP_CHUNK_HEADER_VP8X), WEBP_TAG_SIZE);
  750|     50|  iIo.write(size, WEBP_TAG_SIZE);
  751|       |
  752|     50|  if (has_alpha) {
  ------------------
  |  Branch (752:7): [True: 5, False: 45]
  ------------------
  753|      5|    data[0] |= WEBP_VP8X_ALPHA_BIT;
  754|      5|  }
  755|       |
  756|     50|  if (has_icc) {
  ------------------
  |  Branch (756:7): [True: 1, False: 49]
  ------------------
  757|      1|    data[0] |= WEBP_VP8X_ICC_BIT;
  758|      1|  }
  759|       |
  760|     50|  if (has_xmp) {
  ------------------
  |  Branch (760:7): [True: 5, False: 45]
  ------------------
  761|      5|    data[0] |= WEBP_VP8X_XMP_BIT;
  762|      5|  }
  763|       |
  764|     50|  if (has_exif) {
  ------------------
  |  Branch (764:7): [True: 11, False: 39]
  ------------------
  765|     11|    data[0] |= WEBP_VP8X_EXIF_BIT;
  766|     11|  }
  767|       |
  768|       |  /* set width - stored in 24bits*/
  769|     50|  Internal::enforce(width > 0, Exiv2::ErrorCode::kerCorruptedMetadata);
  770|     50|  uint32_t w = width - 1;
  771|     50|  data[4] = w & 0xFF;
  772|     50|  data[5] = (w >> 8) & 0xFF;
  773|     50|  data[6] = (w >> 16) & 0xFF;
  774|       |
  775|       |  /* set height - stored in 24bits */
  776|     50|  Internal::enforce(height > 0, Exiv2::ErrorCode::kerCorruptedMetadata);
  777|     50|  uint32_t h = height - 1;
  778|     50|  data[7] = h & 0xFF;
  779|     50|  data[8] = (h >> 8) & 0xFF;
  780|     50|  data[9] = (h >> 16) & 0xFF;
  781|       |
  782|     50|  iIo.write(data, 10);
  783|       |
  784|       |  /* Handle inject an icc profile right after VP8X chunk */
  785|     50|  if (has_icc) {
  ------------------
  |  Branch (785:7): [True: 1, False: 49]
  ------------------
  786|      1|    byte size_buff[WEBP_TAG_SIZE];
  787|      1|    ul2Data(size_buff, static_cast<uint32_t>(iccProfile_.size()), littleEndian);
  788|      1|    if (iIo.write(reinterpret_cast<const byte*>(WEBP_CHUNK_HEADER_ICCP), WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (788:9): [True: 0, False: 1]
  ------------------
  789|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  790|      1|    if (iIo.write(size_buff, WEBP_TAG_SIZE) != WEBP_TAG_SIZE)
  ------------------
  |  Branch (790:9): [True: 0, False: 1]
  ------------------
  791|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  792|      1|    if (iIo.write(iccProfile_.c_data(), iccProfile_.size()) != iccProfile_.size())
  ------------------
  |  Branch (792:9): [True: 0, False: 1]
  ------------------
  793|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  794|      1|    if (iIo.tell() % 2 && iIo.write(&WEBP_PAD_ODD, 1) != 1)
  ------------------
  |  Branch (794:9): [True: 0, False: 1]
  |  Branch (794:27): [True: 0, False: 0]
  ------------------
  795|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  796|      1|  }
  797|     50|}
_ZN5Exiv29WebPImage15getHeaderOffsetEPKhmS2_m:
  799|  1.26k|size_t WebPImage::getHeaderOffset(const byte* data, size_t data_size, const byte* header, size_t header_size) {
  800|  1.26k|  size_t pos = std::string::npos;  // error value
  801|  1.26k|  if (data_size < header_size) {
  ------------------
  |  Branch (801:7): [True: 535, False: 727]
  ------------------
  802|    535|    return pos;
  803|    535|  }
  804|   297k|  for (size_t i = 0; i < data_size - header_size; i++) {
  ------------------
  |  Branch (804:22): [True: 296k, False: 617]
  ------------------
  805|   296k|    if (memcmp(header, &data[i], header_size) == 0) {
  ------------------
  |  Branch (805:9): [True: 110, False: 296k]
  ------------------
  806|    110|      pos = i;
  807|    110|      break;
  808|    110|    }
  809|   296k|  }
  810|    727|  return pos;
  811|  1.26k|}

_ZN5Exiv28Xmpdatum4ImplC2ERKNS_6XmpKeyEPKNS_5ValueE:
  253|   115k|Xmpdatum::Impl::Impl(const XmpKey& key, const Value* pValue) : key_(key.clone()) {
  254|   115k|  if (pValue)
  ------------------
  |  Branch (254:7): [True: 71.4k, False: 43.6k]
  ------------------
  255|  71.4k|    value_ = pValue->clone();
  256|   115k|}
_ZN5Exiv28Xmpdatum4ImplC2ERKS1_:
  258|   142k|Xmpdatum::Impl::Impl(const Impl& rhs) {
  259|   142k|  if (rhs.key_)
  ------------------
  |  Branch (259:7): [True: 142k, False: 0]
  ------------------
  260|   142k|    key_ = rhs.key_->clone();  // deep copy
  261|   142k|  if (rhs.value_)
  ------------------
  |  Branch (261:7): [True: 142k, False: 0]
  ------------------
  262|   142k|    value_ = rhs.value_->clone();  // deep copy
  263|   142k|}
_ZN5Exiv28Xmpdatum4ImplaSERKS1_:
  265|  1.63k|Xmpdatum::Impl& Xmpdatum::Impl::operator=(const Impl& rhs) {
  266|  1.63k|  if (this == &rhs)
  ------------------
  |  Branch (266:7): [True: 0, False: 1.63k]
  ------------------
  267|      0|    return *this;
  268|  1.63k|  key_.reset();
  269|  1.63k|  if (rhs.key_)
  ------------------
  |  Branch (269:7): [True: 1.63k, False: 0]
  ------------------
  270|  1.63k|    key_ = rhs.key_->clone();  // deep copy
  271|  1.63k|  value_.reset();
  272|  1.63k|  if (rhs.value_)
  ------------------
  |  Branch (272:7): [True: 1.63k, False: 0]
  ------------------
  273|  1.63k|    value_ = rhs.value_->clone();  // deep copy
  274|  1.63k|  return *this;
  275|  1.63k|}
_ZN5Exiv28XmpdatumC2ERKNS_6XmpKeyEPKNS_5ValueE:
  277|   115k|Xmpdatum::Xmpdatum(const XmpKey& key, const Value* pValue) : p_(std::make_unique<Impl>(key, pValue)) {
  278|   115k|}
_ZN5Exiv28XmpdatumC2ERKS0_:
  280|   142k|Xmpdatum::Xmpdatum(const Xmpdatum& rhs) : p_(std::make_unique<Impl>(*rhs.p_)) {
  281|   142k|}
_ZN5Exiv28XmpdatumaSERKS0_:
  283|  1.63k|Xmpdatum& Xmpdatum::operator=(const Xmpdatum& rhs) {
  284|  1.63k|  if (this == &rhs)
  ------------------
  |  Branch (284:7): [True: 0, False: 1.63k]
  ------------------
  285|      0|    return *this;
  286|  1.63k|  *p_ = *rhs.p_;
  287|  1.63k|  return *this;
  288|  1.63k|}
_ZN5Exiv28XmpdatumD2Ev:
  290|   257k|Xmpdatum::~Xmpdatum() = default;
_ZNK5Exiv28Xmpdatum3keyEv:
  292|  11.6M|std::string Xmpdatum::key() const {
  293|  11.6M|  return p_->key_ ? p_->key_->key() : "";
  ------------------
  |  Branch (293:10): [True: 11.6M, False: 0]
  ------------------
  294|  11.6M|}
_ZNK5Exiv28Xmpdatum9groupNameEv:
  300|  63.2k|std::string Xmpdatum::groupName() const {
  301|  63.2k|  return p_->key_ ? p_->key_->groupName() : "";
  ------------------
  |  Branch (301:10): [True: 63.2k, False: 0]
  ------------------
  302|  63.2k|}
_ZNK5Exiv28Xmpdatum7tagNameEv:
  304|   161k|std::string Xmpdatum::tagName() const {
  305|   161k|  return p_->key_ ? p_->key_->tagName() : "";
  ------------------
  |  Branch (305:10): [True: 161k, False: 0]
  ------------------
  306|   161k|}
_ZNK5Exiv28Xmpdatum6typeIdEv:
  320|   314k|TypeId Xmpdatum::typeId() const {
  321|   314k|  return p_->value_ ? p_->value_->typeId() : invalidTypeId;
  ------------------
  |  Branch (321:10): [True: 314k, False: 0]
  ------------------
  322|   314k|}
_ZNK5Exiv28Xmpdatum5countEv:
  332|  92.7k|size_t Xmpdatum::count() const {
  333|  92.7k|  return p_->value_ ? p_->value_->count() : 0;
  ------------------
  |  Branch (333:10): [True: 92.7k, False: 0]
  ------------------
  334|  92.7k|}
_ZNK5Exiv28Xmpdatum8toStringEv:
  340|  2.13k|std::string Xmpdatum::toString() const {
  341|  2.13k|  return p_->value_ ? p_->value_->toString() : "";
  ------------------
  |  Branch (341:10): [True: 2.13k, False: 0]
  ------------------
  342|  2.13k|}
_ZNK5Exiv28Xmpdatum8toStringEm:
  344|   194k|std::string Xmpdatum::toString(size_t n) const {
  345|   194k|  return p_->value_ ? p_->value_->toString(n) : "";
  ------------------
  |  Branch (345:10): [True: 194k, False: 0]
  ------------------
  346|   194k|}
_ZNK5Exiv28Xmpdatum5valueEv:
  364|   170k|const Value& Xmpdatum::value() const {
  365|   170k|  if (!p_->value_)
  ------------------
  |  Branch (365:7): [True: 0, False: 170k]
  ------------------
  366|      0|    throw Error(ErrorCode::kerValueNotSet, key());
  367|   170k|  return *p_->value_;
  368|   170k|}
_ZN5Exiv28Xmpdatum8setValueEPKNS_5ValueE:
  378|  18.9k|void Xmpdatum::setValue(const Value* pValue) {
  379|  18.9k|  p_->value_.reset();
  380|  18.9k|  if (pValue)
  ------------------
  |  Branch (380:7): [True: 18.9k, False: 0]
  ------------------
  381|  18.9k|    p_->value_ = pValue->clone();
  382|  18.9k|}
_ZN5Exiv28Xmpdatum8setValueERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  384|   768k|int Xmpdatum::setValue(const std::string& value) {
  385|   768k|  XmpProperties::XmpLock lock;
  386|   768k|  if (!p_->value_) {
  ------------------
  |  Branch (386:7): [True: 34.0k, False: 734k]
  ------------------
  387|  34.0k|    TypeId type = xmpText;
  388|  34.0k|    if (p_->key_) {
  ------------------
  |  Branch (388:9): [True: 34.0k, False: 0]
  ------------------
  389|  34.0k|      type = XmpProperties::propertyTypeUnlocked(*p_->key_.get(), lock);
  390|  34.0k|    }
  391|  34.0k|    p_->value_ = Value::create(type);
  392|  34.0k|  }
  393|   768k|  return p_->value_->read(value);
  394|   768k|}
_ZN5Exiv27XmpDataixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  396|   788k|Xmpdatum& XmpData::operator[](const std::string& key) {
  397|   788k|  XmpProperties::XmpLock lock;
  398|   788k|  XmpKey xmpKey(key, lock);
  399|   788k|  auto pos = std::find_if(xmpMetadata_.begin(), xmpMetadata_.end(), FindXmpdatum(xmpKey));
  400|   788k|  if (pos == xmpMetadata_.end()) {
  ------------------
  |  Branch (400:7): [True: 43.6k, False: 745k]
  ------------------
  401|  43.6k|    return xmpMetadata_.emplace_back(xmpKey);
  402|  43.6k|  }
  403|   745k|  return *pos;
  404|   788k|}
_ZN5Exiv27XmpData3addERKNS_6XmpKeyEPKNS_5ValueE:
  406|  2.79k|int XmpData::add(const XmpKey& key, const Value* value) {
  407|  2.79k|  XmpProperties::XmpLock lock;
  408|  2.79k|  return addUnlocked(key, value, lock);
  409|  2.79k|}
_ZN5Exiv27XmpData11addUnlockedERKNS_6XmpKeyEPKNS_5ValueERKNS_13XmpProperties7XmpLockE:
  411|  71.4k|int XmpData::addUnlocked(const XmpKey& key, const Value* value, const XmpProperties::XmpLock&) {
  412|  71.4k|  xmpMetadata_.emplace_back(key, value);
  413|  71.4k|  return 0;
  414|  71.4k|}
_ZNK5Exiv27XmpData7findKeyERKNS_6XmpKeyE:
  426|  12.3k|XmpData::const_iterator XmpData::findKey(const XmpKey& key) const {
  427|  12.3k|  XmpProperties::XmpLock lock;
  428|  12.3k|  return std::find_if(xmpMetadata_.begin(), xmpMetadata_.end(), FindXmpdatum(key));
  429|  12.3k|}
_ZN5Exiv27XmpData7findKeyERKNS_6XmpKeyE:
  431|   208k|XmpData::iterator XmpData::findKey(const XmpKey& key) {
  432|   208k|  XmpProperties::XmpLock lock;
  433|   208k|  return std::find_if(xmpMetadata_.begin(), xmpMetadata_.end(), FindXmpdatum(key));
  434|   208k|}
_ZN5Exiv27XmpData5clearEv:
  436|  30.5k|void XmpData::clear() {
  437|  30.5k|  XmpProperties::XmpLock lock;
  438|  30.5k|  clearUnlocked(lock);
  439|  30.5k|}
_ZN5Exiv27XmpData13clearUnlockedERKNS_13XmpProperties7XmpLockE:
  441|  35.4k|void XmpData::clearUnlocked(const XmpProperties::XmpLock&) {
  442|  35.4k|  xmpMetadata_.clear();
  443|  35.4k|  nsBindings_.clear();
  444|  35.4k|}
_ZNK5Exiv27XmpData5beginEv:
  455|  1.79k|XmpData::const_iterator XmpData::begin() const {
  456|  1.79k|  return xmpMetadata_.begin();
  457|  1.79k|}
_ZNK5Exiv27XmpData3endEv:
  459|  14.1k|XmpData::const_iterator XmpData::end() const {
  460|  14.1k|  return xmpMetadata_.end();
  461|  14.1k|}
_ZNK5Exiv27XmpData5emptyEv:
  463|  1.65k|bool XmpData::empty() const {
  464|  1.65k|  XmpProperties::XmpLock lock;
  465|  1.65k|  return emptyUnlocked(lock);
  466|  1.65k|}
_ZNK5Exiv27XmpData13emptyUnlockedERKNS_13XmpProperties7XmpLockE:
  468|  23.7k|bool XmpData::emptyUnlocked(const XmpProperties::XmpLock&) const {
  469|  23.7k|  return xmpMetadata_.empty();
  470|  23.7k|}
_ZN5Exiv27XmpData5beginEv:
  481|  4.65k|XmpData::iterator XmpData::begin() {
  482|  4.65k|  return xmpMetadata_.begin();
  483|  4.65k|}
_ZN5Exiv27XmpData3endEv:
  485|   213k|XmpData::iterator XmpData::end() {
  486|   213k|  return xmpMetadata_.end();
  487|   213k|}
_ZN5Exiv27XmpData5eraseENSt3__111__wrap_iterIPNS_8XmpdatumEEE:
  489|    779|XmpData::iterator XmpData::erase(XmpData::iterator pos) {
  490|    779|  XmpProperties::XmpLock lock;
  491|    779|  return xmpMetadata_.erase(pos);
  492|    779|}
_ZN5Exiv227xmpToolkitEnsureInitializedEv:
  538|  58.5k|void xmpToolkitEnsureInitialized() {
  539|  58.5k|  static XmpToolkitLifetimeManager instance;
  540|  58.5k|  (void)instance;
  541|  58.5k|}
_ZN5Exiv29XmpParser14registerNsImplERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
  543|  31.5k|void XmpParser::registerNsImpl(const std::string& ns, const std::string& prefix) {
  544|  31.5k|  xmpToolkitEnsureInitialized();
  545|  31.5k|  try {
  546|  31.5k|    std::string existingPrefix;
  547|  31.5k|    if (SXMPMeta::GetNamespacePrefix(ns.c_str(), &existingPrefix)) {
  ------------------
  |  Branch (547:9): [True: 31.5k, False: 7]
  ------------------
  548|  31.5k|      if (!existingPrefix.empty() && existingPrefix.back() == ':') {
  ------------------
  |  Branch (548:11): [True: 31.5k, False: 0]
  |  Branch (548:38): [True: 31.5k, False: 0]
  ------------------
  549|  31.5k|        existingPrefix.pop_back();
  550|  31.5k|      }
  551|  31.5k|      if (existingPrefix == prefix) {
  ------------------
  |  Branch (551:11): [True: 31.2k, False: 319]
  ------------------
  552|       |        // Already registered correctly, skip overhead
  553|  31.2k|        return;
  554|  31.2k|      }
  555|  31.5k|    }
  556|       |
  557|    326|    SXMPMeta::DeleteNamespace(ns.c_str());
  558|       |#ifdef EXV_ADOBE_XMPSDK
  559|       |    SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str(), nullptr);
  560|       |#else
  561|    326|    SXMPMeta::RegisterNamespace(ns.c_str(), prefix.c_str());
  562|    326|#endif
  563|    326|  } catch (const XMP_Error& /* e */) {
  564|       |    // throw Error(ErrorCode::kerXMPToolkitError, e.GetID(), e.GetErrMsg());
  565|      0|  }
  566|  31.5k|}
_ZN5Exiv29XmpParser6decodeERNS_7XmpDataERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKNS_12DecodeParamsE:
  663|  5.35k|int XmpParser::decode(XmpData& xmpData, const std::string& xmpPacket, const DecodeParams& dp) {
  664|  5.35k|  try {
  665|  5.35k|    xmpData.setPacket(xmpPacket);
  666|  5.35k|    if (xmpPacket.empty()) {
  ------------------
  |  Branch (666:9): [True: 487, False: 4.86k]
  ------------------
  667|    487|      xmpData.clear();
  668|    487|      return 0;
  669|    487|    }
  670|       |
  671|       |    // Acquire Giant Lock
  672|  4.86k|    XmpProperties::XmpLock lock;
  673|  4.86k|    try {
  674|  4.86k|      xmpToolkitEnsureInitialized();
  675|  4.86k|    } catch (const Error&) {
  676|      0|#ifndef SUPPRESS_WARNINGS
  677|      0|      EXV_ERROR << "XMP toolkit initialization failed.\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  678|      0|#endif
  679|      0|      return 2;
  680|      0|    }
  681|       |
  682|  4.86k|    xmpData.clearUnlocked(lock);
  683|       |
  684|       |    // Make sure the unterminated substring is used
  685|  4.86k|    size_t len = xmpPacket.size();
  686|  21.5k|    while (len > 0 && 0 == xmpPacket[len - 1])
  ------------------
  |  Branch (686:12): [True: 21.3k, False: 148]
  |  Branch (686:23): [True: 16.6k, False: 4.71k]
  ------------------
  687|  16.6k|      --len;
  688|       |
  689|  4.86k|    XMLValidator::check(xmpPacket.data(), len, dp);
  690|  4.86k|    SXMPMeta meta(xmpPacket.data(), static_cast<XMP_StringLen>(len));
  691|  4.86k|    SXMPIterator iter(meta);
  692|  4.86k|    std::string schemaNs;
  693|  4.86k|    std::string propPath;
  694|  4.86k|    std::string propValue;
  695|  4.86k|    XMP_OptionBits opt = 0;
  696|  79.6k|    while (iter.Next(&schemaNs, &propPath, &propValue, &opt)) {
  ------------------
  |  Branch (696:12): [True: 74.8k, False: 4.86k]
  ------------------
  697|  74.8k|      printNode(schemaNs, propPath, propValue, opt);
  698|  74.8k|      if (XMP_PropIsAlias(opt)) {
  ------------------
  |  Branch (698:11): [True: 0, False: 74.8k]
  ------------------
  699|      0|        throw Error(ErrorCode::kerAliasesNotSupported, schemaNs, propPath, propValue);
  700|      0|      }
  701|  74.8k|      if (XMP_NodeIsSchema(opt)) {
  ------------------
  |  Branch (701:11): [True: 6.13k, False: 68.6k]
  ------------------
  702|       |        // Register unknown namespaces with Exiv2
  703|       |        // (Namespaces are automatically registered with the XMP Toolkit)
  704|  6.13k|        std::string prefix = XmpProperties::prefixUnlocked(schemaNs, lock);
  705|  6.13k|        if (prefix.empty()) {
  ------------------
  |  Branch (705:13): [True: 5.04k, False: 1.08k]
  ------------------
  706|  5.04k|          if (!SXMPMeta::GetNamespacePrefix(schemaNs.c_str(), &prefix))
  ------------------
  |  Branch (706:15): [True: 0, False: 5.04k]
  ------------------
  707|      0|            throw Error(ErrorCode::kerSchemaNamespaceNotRegistered, schemaNs);
  708|  5.04k|          prefix.pop_back();
  709|       |          // Hardening: a parsed packet must not silently rebind a prefix that is
  710|       |          // already globally bound -- a built-in standard prefix, or one a prior
  711|       |          // explicit registerNs() established -- to a different URI.  Letting it
  712|       |          // would poison every later write and lookup in this process (the
  713|       |          // namespace-leak bug).  The packet's own binding is still captured
  714|       |          // per-instance below, so this object round-trips faithfully; we just
  715|       |          // don't pollute the global registry on a read.
  716|  5.04k|          if (!XmpProperties::prefixIsBoundUnlocked(prefix, lock))
  ------------------
  |  Branch (716:15): [True: 29, False: 5.01k]
  ------------------
  717|     29|            XmpProperties::registerNsUnlocked(schemaNs, prefix, lock);
  718|  5.04k|        }
  719|       |        // Record the prefix->URI binding exactly as declared by THIS packet so
  720|       |        // encode() can resolve each property's URI from the data it came from,
  721|       |        // rather than from the process-global registry which another image may
  722|       |        // have rebound (e.g. to a corrupted URI).  See XmpData::nsBindings().
  723|  6.13k|        xmpData.nsBindings_[prefix] = schemaNs;
  724|  6.13k|        continue;
  725|  6.13k|      }
  726|  68.6k|      auto key = makeXmpKey(schemaNs, propPath, lock);
  727|  68.6k|      if (XMP_ArrayIsAltText(opt)) {
  ------------------
  |  Branch (727:11): [True: 751, False: 67.9k]
  ------------------
  728|       |        // Read Lang Alt property
  729|    751|        auto val = std::make_unique<LangAltValue>();
  730|    751|        XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str());
  731|  6.13k|        while (count-- > 0) {
  ------------------
  |  Branch (731:16): [True: 5.38k, False: 750]
  ------------------
  732|       |          // Get the text
  733|  5.38k|          bool haveNext = iter.Next(&schemaNs, &propPath, &propValue, &opt);
  734|  5.38k|          printNode(schemaNs, propPath, propValue, opt);
  735|  5.38k|          if (!haveNext || !XMP_PropIsSimple(opt) || !XMP_PropHasLang(opt)) {
  ------------------
  |  Branch (735:15): [True: 0, False: 5.38k]
  |  Branch (735:28): [True: 0, False: 5.38k]
  |  Branch (735:54): [True: 1, False: 5.38k]
  ------------------
  736|      1|            throw Error(ErrorCode::kerDecodeLangAltPropertyFailed, propPath, opt);
  737|      1|          }
  738|  5.38k|          std::string text = propValue;
  739|       |          // Get the language qualifier
  740|  5.38k|          haveNext = iter.Next(&schemaNs, &propPath, &propValue, &opt);
  741|  5.38k|          printNode(schemaNs, propPath, propValue, opt);
  742|  5.38k|          if (!haveNext || !XMP_PropIsSimple(opt) || !XMP_PropIsQualifier(opt) ||
  ------------------
  |  Branch (742:15): [True: 0, False: 5.38k]
  |  Branch (742:15): [True: 0, False: 5.38k]
  |  Branch (742:28): [True: 0, False: 5.38k]
  |  Branch (742:54): [True: 0, False: 5.38k]
  ------------------
  743|  5.38k|              propPath.substr(propPath.size() - 8, 8) != "xml:lang") {
  ------------------
  |  Branch (743:15): [True: 0, False: 5.38k]
  ------------------
  744|      0|            throw Error(ErrorCode::kerDecodeLangAltQualifierFailed, propPath, opt);
  745|      0|          }
  746|  5.38k|          val->value_[propValue] = std::move(text);
  747|  5.38k|        }
  748|    750|        xmpData.addUnlocked(*key, val.get(), lock);
  749|    750|        continue;
  750|    751|      }
  751|  67.9k|      if (XMP_PropIsArray(opt) && !XMP_PropHasQualifiers(opt) && !XMP_ArrayIsAltText(opt)) {
  ------------------
  |  Branch (751:11): [True: 1.50k, False: 66.4k]
  |  Branch (751:35): [True: 1.50k, False: 0]
  |  Branch (751:66): [True: 1.50k, False: 0]
  ------------------
  752|       |        // Check if all elements are simple
  753|  1.50k|        bool simpleArray = true;
  754|  1.50k|        SXMPIterator aIter(meta, schemaNs.c_str(), propPath.c_str());
  755|  1.50k|        std::string aSchemaNs;
  756|  1.50k|        std::string aPropPath;
  757|  1.50k|        std::string aPropValue;
  758|  1.50k|        XMP_OptionBits aOpt = 0;
  759|  31.7k|        while (aIter.Next(&aSchemaNs, &aPropPath, &aPropValue, &aOpt)) {
  ------------------
  |  Branch (759:16): [True: 30.4k, False: 1.30k]
  ------------------
  760|  30.4k|          if (propPath == aPropPath)
  ------------------
  |  Branch (760:15): [True: 1.50k, False: 28.9k]
  ------------------
  761|  1.50k|            continue;
  762|  28.9k|          if (!XMP_PropIsSimple(aOpt) || XMP_PropHasQualifiers(aOpt) || XMP_PropIsQualifier(aOpt) ||
  ------------------
  |  Branch (762:15): [True: 107, False: 28.8k]
  |  Branch (762:42): [True: 96, False: 28.7k]
  |  Branch (762:73): [True: 0, False: 28.7k]
  ------------------
  763|  28.9k|              XMP_NodeIsSchema(aOpt) || XMP_PropIsAlias(aOpt)) {
  ------------------
  |  Branch (763:15): [True: 0, False: 28.7k]
  |  Branch (763:41): [True: 0, False: 28.7k]
  ------------------
  764|    203|            simpleArray = false;
  765|    203|            break;
  766|    203|          }
  767|  28.9k|        }
  768|  1.50k|        if (simpleArray) {
  ------------------
  |  Branch (768:13): [True: 1.30k, False: 203]
  ------------------
  769|       |          // Read the array into an XmpArrayValue
  770|  1.30k|          auto val = std::make_unique<XmpArrayValue>(arrayValueTypeId(opt));
  771|  1.30k|          XMP_Index count = meta.CountArrayItems(schemaNs.c_str(), propPath.c_str());
  772|  30.0k|          while (count-- > 0) {
  ------------------
  |  Branch (772:18): [True: 28.7k, False: 1.30k]
  ------------------
  773|  28.7k|            iter.Next(&schemaNs, &propPath, &propValue, &opt);
  774|  28.7k|            printNode(schemaNs, propPath, propValue, opt);
  775|  28.7k|            val->read(propValue);
  776|  28.7k|          }
  777|  1.30k|          xmpData.addUnlocked(*key, val.get(), lock);
  778|  1.30k|          continue;
  779|  1.30k|        }
  780|  1.50k|      }
  781|       |
  782|  66.6k|      auto val = std::make_unique<XmpTextValue>();
  783|  66.6k|      if (XMP_PropIsStruct(opt) || XMP_PropIsArray(opt)) {
  ------------------
  |  Branch (783:11): [True: 5.47k, False: 61.1k]
  |  Branch (783:36): [True: 203, False: 60.9k]
  ------------------
  784|       |        // Create a metadatum with only XMP options
  785|  5.67k|        val->setXmpArrayType(xmpArrayType(opt));
  786|  5.67k|        val->setXmpStruct(xmpStruct(opt));
  787|  5.67k|        xmpData.addUnlocked(*key, val.get(), lock);
  788|  5.67k|        continue;
  789|  5.67k|      }
  790|  60.9k|      if (XMP_PropIsSimple(opt) || XMP_PropIsQualifier(opt)) {
  ------------------
  |  Branch (790:11): [True: 60.9k, False: 0]
  |  Branch (790:36): [True: 0, False: 0]
  ------------------
  791|  60.9k|        val->read(propValue);
  792|  60.9k|        xmpData.addUnlocked(*key, val.get(), lock);
  793|  60.9k|        continue;
  794|  60.9k|      }
  795|       |      // Don't let any node go by unnoticed
  796|      0|      throw Error(ErrorCode::kerUnhandledXmpNode, key->key(), opt);
  797|  60.9k|    }  // iterate through all XMP nodes
  798|       |
  799|  4.86k|    return 0;
  800|  4.86k|  }
  801|  5.35k|#ifndef SUPPRESS_WARNINGS
  802|  5.35k|  catch (const Error& e) {
  803|     40|    if (e.code() == ErrorCode::kerXMPToolkitError) {
  ------------------
  |  Branch (803:9): [True: 0, False: 40]
  ------------------
  804|       |      // Initialization failures caught above, this handles other XMP errors if any wrapped in Error
  805|      0|    }
  806|     40|    throw;
  807|  2.14k|  } catch (const XMP_Error& e) {
  808|  2.14k|    EXV_ERROR << Error(ErrorCode::kerXMPToolkitError, e.GetID(), e.GetErrMsg()) << "\n";
  ------------------
  |  |  142|  2.14k|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 2.14k]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|  2.14k|  LogMsg(LogMsg::error).os()
  ------------------
  809|  2.14k|    xmpData.clear();
  810|  2.14k|    return 3;
  811|  2.14k|  }
  812|       |#else
  813|       |  catch (const XMP_Error&) {
  814|       |    xmpData.clear();
  815|       |    return 3;
  816|       |  }
  817|       |#endif  // SUPPRESS_WARNINGS
  818|  5.35k|}  // XmpParser::decode
_ZN5Exiv29XmpParser6encodeERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_7XmpDataEtj:
  832|  22.0k|int XmpParser::encode(std::string& xmpPacket, const XmpData& xmpData, uint16_t formatFlags, uint32_t padding) {
  833|  22.0k|  try {
  834|       |    // Acquire Giant Lock
  835|  22.0k|    XmpProperties::XmpLock lock;
  836|  22.0k|    try {
  837|  22.0k|      xmpToolkitEnsureInitialized();
  838|  22.0k|    } catch (const Error&) {
  839|      0|#ifndef SUPPRESS_WARNINGS
  840|      0|      EXV_ERROR << "XMP toolkit initialization failed.\n";
  ------------------
  |  |  142|      0|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 0]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|      0|  LogMsg(LogMsg::error).os()
  ------------------
  841|      0|#endif
  842|      0|      return 2;
  843|      0|    }
  844|       |
  845|  22.0k|    if (xmpData.emptyUnlocked(lock)) {
  ------------------
  |  Branch (845:9): [True: 20.3k, False: 1.79k]
  ------------------
  846|  20.3k|      xmpPacket.clear();
  847|  20.3k|      return 0;
  848|  20.3k|    }  // We are holding the Giant Lock, so we can iterate nsRegistry_ safely.
  849|       |    // XmpProperties interactions must go through Unlocked/impl methods to avoid deadlocks.
  850|  31.5k|    for (const auto& [xmp, uri] : XmpProperties::nsRegistry_) {
  ------------------
  |  Branch (850:33): [True: 31.5k, False: 1.79k]
  ------------------
  851|       |#ifdef EXIV2_DEBUG_MESSAGES
  852|       |      std::cerr << "Registering " << uri.prefix_ << " : " << xmp << "\n";
  853|       |#endif
  854|       |      // registerNsImpl is safe since we hold the lock
  855|  31.5k|      registerNsImpl(xmp, uri.prefix_);
  856|  31.5k|    }
  857|       |
  858|       |    // Note: we deliberately do NOT re-register the per-instance bindings with
  859|       |    // the toolkit here.  Every URI they contain was already registered while its
  860|       |    // packet was parsed in decode() (custom ones are also in nsRegistry_, handled
  861|       |    // above), so SetProperty resolves them.  Re-registering would overwrite the
  862|       |    // toolkit's URI->prefix mapping whenever our preferred prefix differs from the
  863|       |    // one the file used for that URI (e.g. iptc vs Iptc4xmpCore), which breaks
  864|       |    // serialization of struct fields that still carry the file's prefix.
  865|  1.79k|    SXMPMeta meta;
  866|  63.2k|    for (const auto& xmp : xmpData) {
  ------------------
  |  Branch (866:26): [True: 63.2k, False: 1.79k]
  ------------------
  867|  63.2k|      const std::string ns = resolveNamespace(xmpData, xmp.groupName(), lock);
  868|  63.2k|      XMP_OptionBits options = 0;
  869|       |
  870|  63.2k|      if (xmp.typeId() == langAlt) {
  ------------------
  |  Branch (870:11): [True: 559, False: 62.6k]
  ------------------
  871|       |        // Encode Lang Alt property
  872|    559|        const auto la = dynamic_cast<const LangAltValue*>(&xmp.value());
  873|    559|        if (!la)
  ------------------
  |  Branch (873:13): [True: 0, False: 559]
  ------------------
  874|      0|          throw Error(ErrorCode::kerEncodeLangAltPropertyFailed, xmp.key());
  875|       |
  876|    559|        int idx = 1;
  877|  2.37k|        for (const auto& [lang, specs] : la->value_) {
  ------------------
  |  Branch (877:40): [True: 2.37k, False: 559]
  ------------------
  878|  2.37k|          if (!specs.empty()) {  // remove lang specs with no value
  ------------------
  |  Branch (878:15): [True: 2.33k, False: 40]
  ------------------
  879|  2.33k|            printNode(ns, xmp.tagName(), specs, 0);
  880|  2.33k|            meta.AppendArrayItem(ns.c_str(), xmp.tagName().c_str(), kXMP_PropArrayIsAlternate, specs.c_str());
  881|  2.33k|            const std::string item = xmp.tagName() + "[" + toString(idx++) + "]";
  882|  2.33k|            meta.SetQualifier(ns.c_str(), item.c_str(), kXMP_NS_XML, "lang", lang.c_str());
  883|  2.33k|          }
  884|  2.37k|        }
  885|    559|        continue;
  886|    559|      }
  887|       |
  888|       |      // Todo: Xmpdatum should have an XmpValue, not a Value
  889|  62.6k|      const auto val = dynamic_cast<const XmpValue*>(&xmp.value());
  890|  62.6k|      if (!val)
  ------------------
  |  Branch (890:11): [True: 0, False: 62.6k]
  ------------------
  891|      0|        throw Error(ErrorCode::kerInvalidKeyXmpValue, xmp.key(), xmp.typeName());
  892|  62.6k|      options = xmpArrayOptionBits(val->xmpArrayType()) | xmpArrayOptionBits(val->xmpStruct());
  893|  62.6k|      if (xmp.typeId() == xmpBag || xmp.typeId() == xmpSeq || xmp.typeId() == xmpAlt) {
  ------------------
  |  Branch (893:11): [True: 129, False: 62.5k]
  |  Branch (893:37): [True: 736, False: 61.8k]
  |  Branch (893:63): [True: 146, False: 61.6k]
  ------------------
  894|  1.01k|        printNode(ns, xmp.tagName(), "", options);
  895|  1.01k|        meta.SetProperty(ns.c_str(), xmp.tagName().c_str(), nullptr, options);
  896|  30.5k|        for (size_t idx = 0; idx < xmp.count(); ++idx) {
  ------------------
  |  Branch (896:30): [True: 29.5k, False: 1.01k]
  ------------------
  897|  29.5k|          const std::string item = xmp.tagName() + "[" + toString(idx + 1) + "]";
  898|  29.5k|          printNode(ns, item, xmp.toString(static_cast<long>(idx)), 0);
  899|  29.5k|          meta.SetProperty(ns.c_str(), item.c_str(), xmp.toString(static_cast<long>(idx)).c_str());
  900|  29.5k|        }
  901|  1.01k|        continue;
  902|  1.01k|      }
  903|  61.6k|      if (xmp.typeId() == xmpText) {
  ------------------
  |  Branch (903:11): [True: 61.6k, False: 0]
  ------------------
  904|  61.6k|        const auto xt = dynamic_cast<const XmpTextValue*>(&xmp.value());
  905|  61.6k|        if (xmp.count() == 0 || xt->xmpStruct() != XmpValue::xsNone || xt->xmpArrayType() != XmpValue::xaNone) {
  ------------------
  |  Branch (905:13): [True: 1.14k, False: 60.5k]
  |  Branch (905:33): [True: 4.56k, False: 55.9k]
  |  Branch (905:72): [True: 163, False: 55.7k]
  ------------------
  906|  5.87k|          printNode(ns, xmp.tagName(), "", options);
  907|  5.87k|          meta.SetProperty(ns.c_str(), xmp.tagName().c_str(), nullptr, options);
  908|  55.7k|        } else {
  909|  55.7k|          printNode(ns, xmp.tagName(), xmp.toString(0), options);
  910|  55.7k|          meta.SetProperty(ns.c_str(), xmp.tagName().c_str(), xmp.toString(0).c_str(), options);
  911|  55.7k|        }
  912|  61.6k|        continue;
  913|  61.6k|      }
  914|       |      // Don't let any Xmpdatum go by unnoticed
  915|      0|      throw Error(ErrorCode::kerUnhandledXmpdatum, xmp.tagName(), xmp.typeName());
  916|  61.6k|    }
  917|  1.79k|    std::string tmpPacket;
  918|  1.79k|    meta.SerializeToBuffer(&tmpPacket, xmpFormatOptionBits(static_cast<XmpFormatFlags>(formatFlags)),
  919|  1.79k|                           padding);  // throws
  920|  1.79k|    xmpPacket = std::move(tmpPacket);
  921|       |
  922|  1.79k|    return 0;
  923|  1.79k|  }
  924|  22.0k|#ifndef SUPPRESS_WARNINGS
  925|  22.0k|  catch (const Error& /* e */) {
  926|      0|    throw;
  927|     97|  } catch (const XMP_Error& e) {
  928|     97|    EXV_ERROR << Error(ErrorCode::kerXMPToolkitError, e.GetID(), e.GetErrMsg()) << "\n";
  ------------------
  |  |  142|     97|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 97]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|     97|  LogMsg(LogMsg::error).os()
  ------------------
  929|     97|    return 3;
  930|     97|  }
  931|       |#else
  932|       |  catch (const XMP_Error&) {
  933|       |    return 3;
  934|       |  }
  935|       |#endif  // SUPPRESS_WARNINGS
  936|  22.0k|}  // XmpParser::encode
_ZN5Exiv29XmpParser10makeXmpKeyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS_13XmpProperties7XmpLockE:
 1098|  68.6k|                                                      const XmpProperties::XmpLock& lock) {
 1099|  68.6k|  std::string property;
 1100|  68.6k|  std::string::size_type idx = propPath.find(':');
 1101|  68.6k|  if (idx == std::string::npos) {
  ------------------
  |  Branch (1101:7): [True: 0, False: 68.6k]
  ------------------
 1102|      0|    throw Exiv2::Error(Exiv2::ErrorCode::kerPropertyNameIdentificationFailed, propPath, schemaNs);
 1103|      0|  }
 1104|       |  // Don't worry about out_of_range, XMP parser takes care of this
 1105|  68.6k|  property = propPath.substr(idx + 1);
 1106|  68.6k|  std::string prefix = Exiv2::XmpProperties::prefixUnlocked(schemaNs, lock);
 1107|  68.6k|  if (prefix.empty()) {
  ------------------
  |  Branch (1107:7): [True: 18.4k, False: 50.2k]
  ------------------
 1108|       |    // The namespace was intentionally not registered globally (e.g. a packet
 1109|       |    // that rebinds an already-bound prefix to a different URI -- see the
 1110|       |    // hardening in decode()).  Fall back to the prefix the toolkit parsed so
 1111|       |    // the property still gets a key; its URI is preserved per-instance.
 1112|  18.4k|    std::string toolkitPrefix;
 1113|  18.4k|    if (SXMPMeta::GetNamespacePrefix(schemaNs.c_str(), &toolkitPrefix)) {
  ------------------
  |  Branch (1113:9): [True: 18.4k, False: 0]
  ------------------
 1114|  18.4k|      toolkitPrefix.pop_back();
 1115|  18.4k|      prefix = std::move(toolkitPrefix);
 1116|  18.4k|    }
 1117|  18.4k|  }
 1118|  68.6k|  if (prefix.empty()) {
  ------------------
  |  Branch (1118:7): [True: 0, False: 68.6k]
  ------------------
 1119|      0|    throw Exiv2::Error(Exiv2::ErrorCode::kerNoPrefixForNamespace, propPath, schemaNs);
 1120|      0|  }
 1121|  68.6k|  return Exiv2::XmpKey::UniquePtr(new Exiv2::XmpKey(prefix, property, lock));
 1122|  68.6k|}  // makeXmpKey
_ZN5Exiv29XmpParser16resolveNamespaceERKNS_7XmpDataERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERKNS_13XmpProperties7XmpLockE:
 1125|  63.2k|                                               const XmpProperties::XmpLock& lock) {
 1126|  63.2k|  const auto& nsBindings = xmpData.nsBindings();
 1127|  63.2k|  const auto binding = nsBindings.find(prefix);
 1128|  63.2k|  return binding != nsBindings.end() ? binding->second : XmpProperties::nsUnlocked(prefix, lock);
  ------------------
  |  Branch (1128:10): [True: 62.7k, False: 455]
  ------------------
 1129|  63.2k|}  // resolveNamespace
xmp.cpp:_ZNK12_GLOBAL__N_112FindXmpdatumclERKN5Exiv28XmpdatumE:
  203|  11.6M|  bool operator()(const Exiv2::Xmpdatum& xmpdatum) const {
  204|  11.6M|    return key_ == xmpdatum.key();
  205|  11.6M|  }
xmp.cpp:_ZN12_GLOBAL__N_112FindXmpdatumC2ERKN5Exiv26XmpKeyE:
  197|  1.01M|  explicit FindXmpdatum(const Exiv2::XmpKey& key) : key_(key.key()) {
  198|  1.01M|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator5checkEPKcmRKN5Exiv212DecodeParamsE:
   67|  4.86k|  static void check(const char* buf, size_t buflen, const DecodeParams& dp) {
   68|  4.86k|    XMLValidator validator(dp.max_recursion_depth());
   69|  4.86k|    validator.check_internal(buf, buflen);
   70|  4.86k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidatorC2Em:
   79|  4.86k|      max_recursion_depth_(max_recursion_depth), parser_(XML_ParserCreateNS(nullptr, '@')) {
   80|  4.86k|    if (!parser_) {
  ------------------
  |  Branch (80:9): [True: 0, False: 4.86k]
  ------------------
   81|      0|      throw Error(ErrorCode::kerXMPToolkitError, "Could not create expat parser");
   82|      0|    }
   83|  4.86k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator14check_internalEPKcm:
  104|  4.86k|  void check_internal(const char* buf, size_t buflen) {
  105|  4.86k|    if (buflen > static_cast<size_t>(std::numeric_limits<int>::max())) {
  ------------------
  |  Branch (105:9): [True: 0, False: 4.86k]
  ------------------
  106|      0|      throw Error(ErrorCode::kerXMPToolkitError, "Buffer length is greater than INT_MAX");
  107|      0|    }
  108|       |
  109|  4.86k|    XML_SetUserData(parser_, this);
  110|  4.86k|    XML_SetElementHandler(parser_, startElement_cb, endElement_cb);
  111|  4.86k|    XML_SetNamespaceDeclHandler(parser_, startNamespace_cb, endNamespace_cb);
  112|  4.86k|    XML_SetStartDoctypeDeclHandler(parser_, startDTD_cb);
  113|       |
  114|  4.86k|    if (XML_Parse(parser_, buf, static_cast<int>(buflen), true) == XML_STATUS_ERROR) {
  ------------------
  |  Branch (114:9): [True: 1.12k, False: 3.74k]
  ------------------
  115|  1.12k|      setError(XML_ErrorString(XML_GetErrorCode(parser_)));
  116|  1.12k|    }
  117|       |
  118|  4.86k|    if (haserror_) {
  ------------------
  |  Branch (118:9): [True: 1.12k, False: 3.74k]
  ------------------
  119|  1.12k|      throw XMP_Error(kXMPErr_BadXML, "Error in XMLValidator");
  120|  1.12k|    }
  121|  4.86k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator15startElement_cbEPvPKcPS3_:
  160|  82.3k|  static void XMLCALL startElement_cb(void* userData, const XML_Char* name, const XML_Char** attrs) noexcept {
  161|  82.3k|    static_cast<XMLValidator*>(userData)->startElement(name, attrs);
  162|  82.3k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator12startElementEPKcPS2_:
  123|  82.3k|  void startElement(const XML_Char*, const XML_Char**) noexcept {
  124|  82.3k|    if (element_depth_ > max_recursion_depth_) {
  ------------------
  |  Branch (124:9): [True: 333, False: 82.0k]
  ------------------
  125|    333|      setError("Too deeply nested");
  126|    333|    }
  127|  82.3k|    ++element_depth_;
  128|  82.3k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator13endElement_cbEPvPKc:
  166|  75.8k|  static void XMLCALL endElement_cb(void* userData, const XML_Char* name) noexcept {
  167|  75.8k|    static_cast<XMLValidator*>(userData)->endElement(name);
  168|  75.8k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator10endElementEPKc:
  130|  75.8k|  void endElement(const XML_Char*) noexcept {
  131|  75.8k|    if (element_depth_ > 0) {
  ------------------
  |  Branch (131:9): [True: 75.8k, False: 0]
  ------------------
  132|  75.8k|      --element_depth_;
  133|  75.8k|    } else {
  134|      0|      setError("Negative depth");
  135|      0|    }
  136|  75.8k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator17startNamespace_cbEPvPKcS3_:
  172|  29.1k|  static void XMLCALL startNamespace_cb(void* userData, const XML_Char* prefix, const XML_Char* uri) noexcept {
  173|  29.1k|    static_cast<XMLValidator*>(userData)->startNamespace(prefix, uri);
  174|  29.1k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator14startNamespaceEPKcS2_:
  138|  29.1k|  void startNamespace(const XML_Char*, const XML_Char*) noexcept {
  139|  29.1k|    if (namespace_depth_ > max_recursion_depth_) {
  ------------------
  |  Branch (139:9): [True: 133, False: 29.0k]
  ------------------
  140|    133|      setError("Too deeply nested");
  141|    133|    }
  142|  29.1k|    ++namespace_depth_;
  143|  29.1k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator15endNamespace_cbEPvPKc:
  178|  25.8k|  static void XMLCALL endNamespace_cb(void* userData, const XML_Char* prefix) noexcept {
  179|  25.8k|    static_cast<XMLValidator*>(userData)->endNamespace(prefix);
  180|  25.8k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator12endNamespaceEPKc:
  145|  25.8k|  void endNamespace(const XML_Char*) noexcept {
  146|  25.8k|    if (namespace_depth_ > 0) {
  ------------------
  |  Branch (146:9): [True: 25.8k, False: 0]
  ------------------
  147|  25.8k|      --namespace_depth_;
  148|  25.8k|    } else {
  149|      0|      setError("Negative depth");
  150|      0|    }
  151|  25.8k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator11startDTD_cbEPvPKcS3_S3_i:
  183|     14|                                  const XML_Char* pubid, int has_internal_subset) noexcept {
  184|     14|    static_cast<XMLValidator*>(userData)->startDTD(doctypeName, sysid, pubid, has_internal_subset);
  185|     14|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator8startDTDEPKcS2_S2_i:
  153|     14|  void startDTD(const XML_Char*, const XML_Char*, const XML_Char*, int) noexcept {
  154|       |    // DOCTYPE is used for XXE attacks.
  155|     14|    setError("DOCTYPE not supported");
  156|     14|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidator8setErrorEPKc:
   89|  1.60k|  void setError(const char* msg) {
   90|  1.60k|    const XML_Size errlinenum = XML_GetCurrentLineNumber(parser_);
   91|  1.60k|    const XML_Size errcolnum = XML_GetCurrentColumnNumber(parser_);
   92|  1.60k|#ifndef SUPPRESS_WARNINGS
   93|  1.60k|    EXV_INFO << "Invalid XML at line " << errlinenum << ", column " << errcolnum << ": " << msg << "\n";
  ------------------
  |  |  134|  1.60k|  if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (134:7): [True: 0, False: 1.60k]
  |  |  |  Branch (134:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|  1.60k|  LogMsg(LogMsg::info).os()
  ------------------
   94|  1.60k|#endif
   95|       |    // If this is the first error, then save it.
   96|  1.60k|    if (!haserror_) {
  ------------------
  |  Branch (96:9): [True: 1.12k, False: 480]
  ------------------
   97|  1.12k|      haserror_ = true;
   98|  1.12k|      errmsg_ = msg;
   99|  1.12k|      errlinenum_ = errlinenum;
  100|  1.12k|      errcolnum_ = errcolnum;
  101|  1.12k|    }
  102|  1.60k|  }
xmp.cpp:_ZN12_GLOBAL__N_112XMLValidatorD2Ev:
   85|  4.86k|  ~XMLValidator() {
   86|  4.86k|    XML_ParserFree(parser_);
   87|  4.86k|  }
xmp.cpp:_ZN12_GLOBAL__N_19xmpStructEj:
  955|  5.67k|Exiv2::XmpValue::XmpStruct xmpStruct(XMP_OptionBits opt) {
  956|  5.67k|  Exiv2::XmpValue::XmpStruct var(Exiv2::XmpValue::xsNone);
  957|  5.67k|  if (XMP_PropIsStruct(opt)) {
  ------------------
  |  Branch (957:7): [True: 5.47k, False: 203]
  ------------------
  958|  5.47k|    var = Exiv2::XmpValue::xsStruct;
  959|  5.47k|  }
  960|  5.67k|  return var;
  961|  5.67k|}
xmp.cpp:_ZN12_GLOBAL__N_118xmpArrayOptionBitsEN5Exiv28XmpValue9XmpStructE:
  963|  62.6k|XMP_OptionBits xmpArrayOptionBits(Exiv2::XmpValue::XmpStruct xs) {
  964|  62.6k|  XMP_OptionBits var(0);
  965|  62.6k|  switch (xs) {
  ------------------
  |  Branch (965:11): [True: 62.6k, False: 0]
  ------------------
  966|  58.1k|    case Exiv2::XmpValue::xsNone:
  ------------------
  |  Branch (966:5): [True: 58.1k, False: 4.56k]
  ------------------
  967|  58.1k|      break;
  968|  4.56k|    case Exiv2::XmpValue::xsStruct:
  ------------------
  |  Branch (968:5): [True: 4.56k, False: 58.1k]
  ------------------
  969|  4.56k|      XMP_SetOption(var, kXMP_PropValueIsStruct);
  970|  4.56k|      break;
  971|  62.6k|  }
  972|  62.6k|  return var;
  973|  62.6k|}
xmp.cpp:_ZN12_GLOBAL__N_116arrayValueTypeIdEj:
  975|  6.97k|Exiv2::TypeId arrayValueTypeId(XMP_OptionBits opt) {
  976|  6.97k|  Exiv2::TypeId typeId(Exiv2::invalidTypeId);
  977|  6.97k|  if (XMP_PropIsArray(opt)) {
  ------------------
  |  Branch (977:7): [True: 1.50k, False: 5.47k]
  ------------------
  978|  1.50k|    if (XMP_ArrayIsAlternate(opt))
  ------------------
  |  Branch (978:9): [True: 314, False: 1.18k]
  ------------------
  979|    314|      typeId = Exiv2::xmpAlt;
  980|  1.18k|    else if (XMP_ArrayIsOrdered(opt))
  ------------------
  |  Branch (980:14): [True: 956, False: 233]
  ------------------
  981|    956|      typeId = Exiv2::xmpSeq;
  982|    233|    else if (XMP_ArrayIsUnordered(opt))
  ------------------
  |  Branch (982:14): [True: 233, False: 0]
  ------------------
  983|    233|      typeId = Exiv2::xmpBag;
  984|  1.50k|  }
  985|  6.97k|  return typeId;
  986|  6.97k|}
xmp.cpp:_ZN12_GLOBAL__N_112xmpArrayTypeEj:
  988|  5.67k|Exiv2::XmpValue::XmpArrayType xmpArrayType(XMP_OptionBits opt) {
  989|  5.67k|  return Exiv2::XmpValue::xmpArrayType(arrayValueTypeId(opt));
  990|  5.67k|}
xmp.cpp:_ZN12_GLOBAL__N_118xmpArrayOptionBitsEN5Exiv28XmpValue12XmpArrayTypeE:
  992|  62.6k|XMP_OptionBits xmpArrayOptionBits(Exiv2::XmpValue::XmpArrayType xat) {
  993|  62.6k|  XMP_OptionBits var(0);
  994|  62.6k|  switch (xat) {
  ------------------
  |  Branch (994:11): [True: 62.6k, False: 0]
  ------------------
  995|  61.5k|    case Exiv2::XmpValue::xaNone:
  ------------------
  |  Branch (995:5): [True: 61.5k, False: 1.17k]
  ------------------
  996|  61.5k|      break;
  997|    176|    case Exiv2::XmpValue::xaAlt:
  ------------------
  |  Branch (997:5): [True: 176, False: 62.5k]
  ------------------
  998|    176|      XMP_SetOption(var, kXMP_PropValueIsArray);
  999|    176|      XMP_SetOption(var, kXMP_PropArrayIsAlternate);
 1000|    176|      break;
 1001|    867|    case Exiv2::XmpValue::xaSeq:
  ------------------
  |  Branch (1001:5): [True: 867, False: 61.8k]
  ------------------
 1002|    867|      XMP_SetOption(var, kXMP_PropValueIsArray);
 1003|    867|      XMP_SetOption(var, kXMP_PropArrayIsOrdered);
 1004|    867|      break;
 1005|    131|    case Exiv2::XmpValue::xaBag:
  ------------------
  |  Branch (1005:5): [True: 131, False: 62.5k]
  ------------------
 1006|    131|      XMP_SetOption(var, kXMP_PropValueIsArray);
 1007|    131|      break;
 1008|  62.6k|  }
 1009|  62.6k|  return var;
 1010|  62.6k|}
xmp.cpp:_ZN12_GLOBAL__N_119xmpFormatOptionBitsEN5Exiv29XmpParser14XmpFormatFlagsE:
 1016|  1.69k|XMP_OptionBits xmpFormatOptionBits(Exiv2::XmpParser::XmpFormatFlags flags) {
 1017|  1.69k|  XMP_OptionBits var(0);
 1018|  1.69k|  if (flags & Exiv2::XmpParser::omitPacketWrapper)
  ------------------
  |  Branch (1018:7): [True: 909, False: 787]
  ------------------
 1019|    909|    var |= kXMP_OmitPacketWrapper;
 1020|  1.69k|  if (flags & Exiv2::XmpParser::readOnlyPacket)
  ------------------
  |  Branch (1020:7): [True: 0, False: 1.69k]
  ------------------
 1021|      0|    var |= kXMP_ReadOnlyPacket;
 1022|  1.69k|  if (flags & Exiv2::XmpParser::useCompactFormat)
  ------------------
  |  Branch (1022:7): [True: 1.69k, False: 0]
  ------------------
 1023|  1.69k|    var |= kXMP_UseCompactFormat;
 1024|  1.69k|  if (flags & Exiv2::XmpParser::includeThumbnailPad)
  ------------------
  |  Branch (1024:7): [True: 0, False: 1.69k]
  ------------------
 1025|      0|    var |= kXMP_IncludeThumbnailPad;
 1026|  1.69k|  if (flags & Exiv2::XmpParser::exactPacketLength)
  ------------------
  |  Branch (1026:7): [True: 0, False: 1.69k]
  ------------------
 1027|      0|    var |= kXMP_ExactPacketLength;
 1028|  1.69k|  if (flags & Exiv2::XmpParser::writeAliasComments)
  ------------------
  |  Branch (1028:7): [True: 0, False: 1.69k]
  ------------------
 1029|      0|    var |= kXMP_WriteAliasComments;
 1030|  1.69k|  if (flags & Exiv2::XmpParser::omitAllFormatting)
  ------------------
  |  Branch (1030:7): [True: 7, False: 1.68k]
  ------------------
 1031|      7|    var |= kXMP_OmitAllFormatting;
 1032|  1.69k|  return var;
 1033|  1.69k|}
xmp.cpp:_ZN12_GLOBAL__N_19printNodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_j:
 1091|   208k|void printNode(const std::string&, const std::string&, const std::string&, XMP_OptionBits) {
 1092|   208k|}
_ZN5Exiv28Xmpdatum4ImplD2Ev:
  246|   257k|  ~Impl() = default;

_ZN5Exiv225XmpToolkitLifetimeManagerC2Ev:
   33|      1|  XmpToolkitLifetimeManager() {
   34|      1|    if (SXMPMeta::Initialize()) {
  ------------------
  |  Branch (34:9): [True: 1, False: 0]
  ------------------
   35|       |#ifdef EXV_ADOBE_XMPSDK
   36|       |      SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr", nullptr);
   37|       |      SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc", nullptr);
   38|       |      SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms", nullptr);
   39|       |      SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam", nullptr);
   40|       |      SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi", nullptr);
   41|       |      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto", nullptr);
   42|       |      SXMPMeta::RegisterNamespace("http://ns.acdsee.com/iptc/1.0/", "acdsee", nullptr);
   43|       |      SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt", nullptr);
   44|       |      SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus", nullptr);
   45|       |      SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro", nullptr);
   46|       |      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia", nullptr);
   47|       |      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/", "MP", nullptr);
   48|       |      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/RegionInfo#", "MPRI", nullptr);
   49|       |      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/Region#", "MPReg", nullptr);
   50|       |      SXMPMeta::RegisterNamespace("http://ns.google.com/photos/1.0/panorama/", "GPano", nullptr);
   51|       |      SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/regions/", "mwg-rs", nullptr);
   52|       |      SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw", nullptr);
   53|       |      SXMPMeta::RegisterNamespace("http://ns.adobe.com/xmp/sType/Area#", "stArea", nullptr);
   54|       |      SXMPMeta::RegisterNamespace("http://cipa.jp/exif/1.0/", "exifEX", nullptr);
   55|       |      SXMPMeta::RegisterNamespace("http://ns.adobe.com/camera-raw-saved-settings/1.0/", "crss", nullptr);
   56|       |      SXMPMeta::RegisterNamespace("http://www.audio/", "audio", nullptr);
   57|       |      SXMPMeta::RegisterNamespace("http://www.video/", "video", nullptr);
   58|       |#else
   59|      1|      SXMPMeta::RegisterNamespace("http://ns.adobe.com/lightroom/1.0/", "lr");
   60|      1|      SXMPMeta::RegisterNamespace("http://rs.tdwg.org/dwc/index.htm", "dwc");
   61|      1|      SXMPMeta::RegisterNamespace("http://purl.org/dc/terms/", "dcterms");
   62|      1|      SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/1.0/", "digiKam");
   63|      1|      SXMPMeta::RegisterNamespace("http://www.digikam.org/ns/kipi/1.0/", "kipi");
   64|      1|      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.0/", "MicrosoftPhoto");
   65|      1|      SXMPMeta::RegisterNamespace("http://ns.acdsee.com/iptc/1.0/", "acdsee");
   66|      1|      SXMPMeta::RegisterNamespace("http://iptc.org/std/Iptc4xmpExt/2008-02-29/", "iptcExt");
   67|      1|      SXMPMeta::RegisterNamespace("http://ns.useplus.org/ldf/xmp/1.0/", "plus");
   68|      1|      SXMPMeta::RegisterNamespace("http://ns.iview-multimedia.com/mediapro/1.0/", "mediapro");
   69|      1|      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/expressionmedia/1.0/", "expressionmedia");
   70|      1|      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/", "MP");
   71|      1|      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/RegionInfo#", "MPRI");
   72|      1|      SXMPMeta::RegisterNamespace("http://ns.microsoft.com/photo/1.2/t/Region#", "MPReg");
   73|      1|      SXMPMeta::RegisterNamespace("http://ns.google.com/photos/1.0/panorama/", "GPano");
   74|      1|      SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/regions/", "mwg-rs");
   75|      1|      SXMPMeta::RegisterNamespace("http://www.metadataworkinggroup.com/schemas/keywords/", "mwg-kw");
   76|      1|      SXMPMeta::RegisterNamespace("http://ns.adobe.com/xmp/sType/Area#", "stArea");
   77|      1|      SXMPMeta::RegisterNamespace("http://cipa.jp/exif/1.0/", "exifEX");
   78|      1|      SXMPMeta::RegisterNamespace("http://ns.adobe.com/camera-raw-saved-settings/1.0/", "crss");
   79|      1|      SXMPMeta::RegisterNamespace("http://www.audio/", "audio");
   80|      1|      SXMPMeta::RegisterNamespace("http://www.video/", "video");
   81|      1|#endif
   82|      1|    } else {
   83|      0|      throw Error(ErrorCode::kerXMPToolkitError, 2, "Failed to initialize XMP Toolkit");
   84|      0|    }
   85|      1|  }
_ZN5Exiv225XmpToolkitLifetimeManagerD2Ev:
   87|      1|  ~XmpToolkitLifetimeManager() {
   88|       |    // Use Unsafe version to avoid acquiring mutex during static destruction.
   89|       |    // This is safe because static destruction is single-threaded per C++ standard.
   90|      1|    XmpProperties::unregisterAllNsNoLock(XmpProperties::LifetimeKey{});
   91|      1|    SXMPMeta::Terminate();
   92|      1|  }

_ZN5Exiv210XmpSidecarC2ENSt3__110unique_ptrINS_7BasicIoENS1_14default_deleteIS3_EEEERKNS_15ImageCtorParamsE:
   30|  1.66k|    Image(ImageType::xmp, mdXmp, std::move(io), params) {
   31|  1.66k|  if (params.create() && io_->open() == 0) {
  ------------------
  |  Branch (31:7): [True: 0, False: 1.66k]
  |  Branch (31:26): [True: 0, False: 0]
  ------------------
   32|      0|    IoCloser closer(*io_);
   33|      0|    io_->write(reinterpret_cast<const byte*>(xmlHeader), xmlHdrCnt);
   34|      0|  }
   35|  1.66k|}  // XmpSidecar::XmpSidecar
_ZN5Exiv210XmpSidecar12readMetadataEv:
   46|  1.66k|void XmpSidecar::readMetadata() {
   47|       |#ifdef EXIV2_DEBUG_MESSAGES
   48|       |  std::cerr << "Reading XMP file " << io_->path() << "\n";
   49|       |#endif
   50|  1.66k|  if (io_->open() != 0) {
  ------------------
  |  Branch (50:7): [True: 0, False: 1.66k]
  ------------------
   51|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   52|      0|  }
   53|  1.66k|  IoCloser closer(*io_);
   54|       |  // Ensure that this is the correct image type
   55|  1.66k|  if (!isXmpType(*io_, false)) {
  ------------------
  |  Branch (55:7): [True: 0, False: 1.66k]
  ------------------
   56|      0|    if (io_->error() || io_->eof())
  ------------------
  |  Branch (56:9): [True: 0, False: 0]
  |  Branch (56:25): [True: 0, False: 0]
  ------------------
   57|      0|      throw Error(ErrorCode::kerFailedToReadImageData);
   58|      0|    throw Error(ErrorCode::kerNotAnImage, "XMP");
   59|      0|  }
   60|       |  // Read the XMP packet from the IO stream
   61|  1.66k|  std::string xmpPacket;
   62|  1.66k|  const long len = 64 * 1024;
   63|  1.66k|  auto buf = std::make_unique<byte[]>(len);
   64|  4.05k|  while (auto l = io_->read(buf.get(), len)) {
  ------------------
  |  Branch (64:15): [True: 2.38k, False: 1.66k]
  ------------------
   65|  2.38k|    xmpPacket.append(reinterpret_cast<char*>(buf.get()), l);
   66|  2.38k|  }
   67|  1.66k|  if (io_->error())
  ------------------
  |  Branch (67:7): [True: 0, False: 1.66k]
  ------------------
   68|      0|    throw Error(ErrorCode::kerFailedToReadImageData);
   69|  1.66k|  clearMetadata();
   70|  1.66k|  xmpPacket_ = std::move(xmpPacket);
   71|  1.66k|  const DecodeParams dp(max_recursion_depth_);
   72|  1.66k|  if (!xmpPacket_.empty() && XmpParser::decode(xmpData_, xmpPacket_, dp)) {
  ------------------
  |  Branch (72:7): [True: 1.66k, False: 1]
  |  Branch (72:30): [True: 200, False: 1.46k]
  ------------------
   73|    200|#ifndef SUPPRESS_WARNINGS
   74|    200|    EXV_WARNING << "Failed to decode XMP metadata.\n";
  ------------------
  |  |  138|    200|  if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (138:7): [True: 0, False: 200]
  |  |  |  Branch (138:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  139|    200|  LogMsg(LogMsg::warn).os()
  ------------------
   75|    200|#endif
   76|    200|  }
   77|       |
   78|       |  // #1112 - store dates to deal with loss of TZ information during conversions
   79|  10.0k|  for (const auto& xmp : xmpData_) {
  ------------------
  |  Branch (79:24): [True: 10.0k, False: 1.66k]
  ------------------
   80|  10.0k|    std::string key(xmp.key());
   81|  10.0k|    if (Internal::contains(key, "Date")) {
  ------------------
  |  Branch (81:9): [True: 743, False: 9.32k]
  ------------------
   82|    743|      dates_[key] = xmp.value().toString();
   83|    743|    }
   84|  10.0k|  }
   85|       |
   86|  1.66k|  copyXmpToIptc(xmpData_, iptcData_);
   87|  1.66k|  copyXmpToExif(xmpData_, exifData_);
   88|  1.66k|}  // XmpSidecar::readMetadata
_ZN5Exiv210XmpSidecar13writeMetadataEv:
   94|  1.56k|void XmpSidecar::writeMetadata() {
   95|  1.56k|  if (io_->open() != 0) {
  ------------------
  |  Branch (95:7): [True: 0, False: 1.56k]
  ------------------
   96|      0|    throw Error(ErrorCode::kerDataSourceOpenFailed, io_->path(), strError());
   97|      0|  }
   98|  1.56k|  IoCloser closer(*io_);
   99|       |
  100|  1.56k|  if (!writeXmpFromPacket()) {
  ------------------
  |  Branch (100:7): [True: 1.56k, False: 0]
  ------------------
  101|       |    // #589 copy XMP tags
  102|  1.56k|    Exiv2::XmpData copy;
  103|  10.0k|    for (const auto& xmp : xmpData_) {
  ------------------
  |  Branch (103:26): [True: 10.0k, False: 1.56k]
  ------------------
  104|  10.0k|      if (!matchi(xmp.key(), "exif") && !matchi(xmp.key(), "iptc")) {
  ------------------
  |  Branch (104:11): [True: 9.65k, False: 356]
  |  Branch (104:11): [True: 9.62k, False: 385]
  |  Branch (104:41): [True: 9.62k, False: 29]
  ------------------
  105|  9.62k|        copy[xmp.key()] = xmp.value();
  106|  9.62k|      }
  107|  10.0k|    }
  108|       |
  109|       |    // run the converters
  110|  1.56k|    copyExifToXmp(exifData_, xmpData_);
  111|  1.56k|    copyIptcToXmp(iptcData_, xmpData_);
  112|       |
  113|       |    // #1112 - restore dates if they lost their TZ info
  114|  1.56k|    for (const auto& [sKey, value_orig] : dates_) {
  ------------------
  |  Branch (114:41): [True: 657, False: 1.56k]
  ------------------
  115|    657|      Exiv2::XmpKey key(sKey);
  116|    657|      if (xmpData_.findKey(key) != xmpData_.end()) {
  ------------------
  |  Branch (116:11): [True: 618, False: 39]
  ------------------
  117|    618|        std::string value_now(xmpData_[sKey].value().toString());
  118|       |        // std::cout << key << " -> " << value_now << " => " << value_orig << '\n';
  119|    618|        if (Internal::contains(value_orig, value_now.substr(0, 10))) {
  ------------------
  |  Branch (119:13): [True: 516, False: 102]
  ------------------
  120|    516|          xmpData_[sKey] = value_orig;
  121|    516|        }
  122|    618|      }
  123|    657|    }
  124|       |
  125|       |    // #589 - restore tags which were modified by the converters
  126|  9.37k|    for (const auto& xmp : copy) {
  ------------------
  |  Branch (126:26): [True: 9.37k, False: 1.56k]
  ------------------
  127|  9.37k|      xmpData_[xmp.key()] = xmp.value();
  128|  9.37k|    }
  129|       |
  130|  1.56k|    if (XmpParser::encode(xmpPacket_, xmpData_, XmpParser::omitPacketWrapper | XmpParser::useCompactFormat) > 1) {
  ------------------
  |  Branch (130:9): [True: 30, False: 1.53k]
  ------------------
  131|     30|#ifndef SUPPRESS_WARNINGS
  132|     30|      EXV_ERROR << "Failed to encode XMP metadata.\n";
  ------------------
  |  |  142|     30|  if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
  |  |  ------------------
  |  |  |  Branch (142:7): [True: 0, False: 30]
  |  |  |  Branch (142:43): [True: 0, False: 0]
  |  |  ------------------
  |  |  143|     30|  LogMsg(LogMsg::error).os()
  ------------------
  133|     30|#endif
  134|     30|    }
  135|  1.56k|  }
  136|  1.56k|  if (!xmpPacket_.empty()) {
  ------------------
  |  Branch (136:7): [True: 939, False: 622]
  ------------------
  137|    939|    if (!xmpPacket_.starts_with("<?xml")) {
  ------------------
  |  Branch (137:9): [True: 937, False: 2]
  ------------------
  138|    937|      xmpPacket_ = xmlHeader + xmpPacket_ + xmlFooter;
  139|    937|    }
  140|    939|    MemIo tempIo;
  141|       |
  142|       |    // Write XMP packet
  143|    939|    if (tempIo.write(reinterpret_cast<const byte*>(xmpPacket_.data()), xmpPacket_.size()) != xmpPacket_.size())
  ------------------
  |  Branch (143:9): [True: 0, False: 939]
  ------------------
  144|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  145|    939|    if (tempIo.error())
  ------------------
  |  Branch (145:9): [True: 0, False: 939]
  ------------------
  146|      0|      throw Error(ErrorCode::kerImageWriteFailed);
  147|    939|    io_->close();
  148|    939|    io_->transfer(tempIo);  // may throw
  149|    939|  }
  150|  1.56k|}  // XmpSidecar::writeMetadata
_ZN5Exiv214newXmpInstanceENSt3__110unique_ptrINS_7BasicIoENS0_14default_deleteIS2_EEEERKNS_15ImageCtorParamsE:
  154|  1.66k|Image::UniquePtr newXmpInstance(BasicIo::UniquePtr io, const ImageCtorParams& params) {
  155|  1.66k|  auto image = std::make_unique<XmpSidecar>(std::move(io), params);
  156|  1.66k|  if (!image->good()) {
  ------------------
  |  Branch (156:7): [True: 0, False: 1.66k]
  ------------------
  157|      0|    return nullptr;
  158|      0|  }
  159|  1.66k|  return image;
  160|  1.66k|}
_ZN5Exiv29isXmpTypeERNS_7BasicIoEb:
  162|  16.5k|bool isXmpType(BasicIo& iIo, bool advance) {
  163|       |  /*
  164|       |    Check if the file starts with an optional XML declaration followed by
  165|       |    either an XMP header (<?xpacket ... ?>) or an <x:xmpmeta> element.
  166|       |
  167|       |    In addition, in order for empty XmpSidecar objects as created by
  168|       |    Exiv2 to pass the test, just an XML header is also considered ok.
  169|       |   */
  170|  16.5k|  const int32_t len = 80;
  171|  16.5k|  byte buf[len];
  172|  16.5k|  iIo.read(buf, xmlHdrCnt + 1);
  173|  16.5k|  if (iIo.eof() && 0 == strncmp(reinterpret_cast<const char*>(buf), xmlHeader, xmlHdrCnt)) {
  ------------------
  |  Branch (173:7): [True: 176, False: 16.3k]
  |  Branch (173:20): [True: 3, False: 173]
  ------------------
  174|      3|    return true;
  175|      3|  }
  176|  16.5k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (176:7): [True: 0, False: 16.5k]
  |  Branch (176:22): [True: 173, False: 16.3k]
  ------------------
  177|    173|    return false;
  178|    173|  }
  179|  16.3k|  iIo.read(buf + xmlHdrCnt + 1, len - xmlHdrCnt - 1);
  180|  16.3k|  if (iIo.error() || iIo.eof()) {
  ------------------
  |  Branch (180:7): [True: 0, False: 16.3k]
  |  Branch (180:22): [True: 73, False: 16.2k]
  ------------------
  181|     73|    return false;
  182|     73|  }
  183|       |  // Skip leading BOM
  184|  16.2k|  int32_t start = 0;
  185|  16.2k|  if (0 == strncmp(reinterpret_cast<const char*>(buf), "\xef\xbb\xbf", 3)) {
  ------------------
  |  Branch (185:7): [True: 78, False: 16.2k]
  ------------------
  186|     78|    start = 3;
  187|     78|  }
  188|  16.2k|  bool rc = false;
  189|  16.2k|  std::string head(reinterpret_cast<const char*>(buf + start), len - start);
  190|  16.2k|  if (head.starts_with("<?xml")) {
  ------------------
  |  Branch (190:7): [True: 133, False: 16.1k]
  ------------------
  191|       |    // Forward to the next tag
  192|    133|    auto it = std::find(head.begin() + 5, head.end(), '<');
  193|    133|    if (it != head.end())
  ------------------
  |  Branch (193:9): [True: 127, False: 6]
  ------------------
  194|    127|      head = head.substr(std::distance(head.begin(), it));
  195|    133|  }
  196|  16.2k|  if (head.starts_with("<?xpacket") || head.starts_with("<x:xmpmeta")) {
  ------------------
  |  Branch (196:7): [True: 2.11k, False: 14.1k]
  |  Branch (196:40): [True: 2.87k, False: 11.2k]
  ------------------
  197|  4.98k|    rc = true;
  198|  4.98k|  }
  199|  16.2k|  if (!advance || !rc) {
  ------------------
  |  Branch (199:7): [True: 16.2k, False: 0]
  |  Branch (199:19): [True: 0, False: 0]
  ------------------
  200|  16.2k|    iIo.seek(-(len - start), BasicIo::cur);  // Swallow the BOM
  201|  16.2k|  }
  202|  16.2k|  return rc;
  203|  16.3k|}
xmpsidecar.cpp:_ZN5Exiv2L6matchiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPKc:
   90|  19.6k|static bool matchi(const std::string& key, const char* substr) {
   91|  19.6k|  return Internal::contains(Internal::lower(key), substr);
   92|  19.6k|}

XMP_NewExpatAdapter:
   68|  3.74k|{
   69|  3.74k|	return new ExpatAdapter;
   70|  3.74k|}	// XMP_NewExpatAdapter
_ZN12ExpatAdapterC2Ev:
   74|  3.74k|ExpatAdapter::ExpatAdapter() : parser(0)
   75|  3.74k|{
   76|       |
   77|       |	#if XMP_DebugBuild
   78|       |		this->elemNesting = 0;
   79|       |		#if DumpXMLParseEvents
   80|       |			if ( this->parseLog == 0 ) this->parseLog = stdout;
   81|       |		#endif
   82|       |	#endif
   83|       |
   84|  3.74k|	this->parser = XML_ParserCreateNS ( 0, FullNameSeparator );
  ------------------
  |  |   33|  3.74k|#define FullNameSeparator	'@'
  ------------------
   85|  3.74k|	if ( this->parser == 0 ) XMP_Throw ( "Failure creating Expat parser", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (85:7): [True: 0, False: 3.74k]
  ------------------
   86|       |	
   87|  3.74k|	XML_SetUserData ( this->parser, this );
   88|       |	
   89|  3.74k|	XML_SetNamespaceDeclHandler ( this->parser, StartNamespaceDeclHandler, EndNamespaceDeclHandler );
   90|  3.74k|	XML_SetElementHandler ( this->parser, StartElementHandler, EndElementHandler );
   91|       |
   92|  3.74k|	XML_SetCharacterDataHandler ( this->parser, CharacterDataHandler );
   93|  3.74k|	XML_SetCdataSectionHandler ( this->parser, StartCdataSectionHandler, EndCdataSectionHandler );
   94|       |
   95|  3.74k|	XML_SetProcessingInstructionHandler ( this->parser, ProcessingInstructionHandler );
   96|  3.74k|	XML_SetCommentHandler ( this->parser, CommentHandler );
   97|       |
   98|  3.74k|	#if BanAllEntityUsage
   99|  3.74k|		XML_SetStartDoctypeDeclHandler ( this->parser, StartDoctypeDeclHandler );
  100|  3.74k|		isAborted = false;
  101|  3.74k|	#endif
  102|       |
  103|  3.74k|	this->parseStack.push_back ( &this->tree );	// Push the XML root node.
  104|       |
  105|  3.74k|}	// ExpatAdapter::ExpatAdapter
_ZN12ExpatAdapterD2Ev:
  110|  3.74k|{
  111|       |
  112|  3.74k|	if ( this->parser != 0 ) XML_ParserFree ( this->parser );
  ------------------
  |  Branch (112:7): [True: 3.74k, False: 0]
  ------------------
  113|  3.74k|	this->parser = 0;
  114|       |
  115|  3.74k|}	// ExpatAdapter::~ExpatAdapter
_ZN12ExpatAdapter11ParseBufferEPKvmb:
  126|  3.78k|{
  127|  3.78k|	enum XML_Status status;
  128|       |	
  129|  3.78k|	if ( length == 0 ) {	// Expat does not like empty buffers.
  ------------------
  |  Branch (129:7): [True: 0, False: 3.78k]
  ------------------
  130|      0|		if ( ! last ) return;
  ------------------
  |  Branch (130:8): [True: 0, False: 0]
  ------------------
  131|      0|		buffer = kOneSpace;
  132|      0|		length = 1;
  133|      0|	}
  134|       |	
  135|  3.78k|	status = XML_Parse ( this->parser, (const char *)buffer, length, last );
  136|       |	
  137|  3.78k|	#if BanAllEntityUsage
  138|  3.78k|		if ( this->isAborted ) XMP_Throw ( "DOCTYPE is not allowed", kXMPErr_BadXML );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (138:8): [True: 0, False: 3.78k]
  ------------------
  139|  3.78k|	#endif
  140|       |
  141|  3.78k|	if ( status != XML_STATUS_OK ) {
  ------------------
  |  Branch (141:7): [True: 43, False: 3.74k]
  ------------------
  142|       |	
  143|     43|		XMP_StringPtr errMsg = "XML parsing failure";
  144|       |
  145|       |		#if 0	// XMP_DebugBuild	// Disable for now to make test output uniform. Restore later with thread safety.
  146|       |		
  147|       |			// *** This is a good candidate for a callback error notification mechanism.
  148|       |			// *** This code is not thread safe, the sExpatMessage isn't locked. But that's OK for debug usage.
  149|       |
  150|       |			enum XML_Error expatErr = XML_GetErrorCode ( this->parser );
  151|       |			const char *   expatMsg = XML_ErrorString ( expatErr );
  152|       |			int errLine = XML_GetCurrentLineNumber ( this->parser );
  153|       |		
  154|       |			char msgBuffer[1000];
  155|       |			// AUDIT: Use of sizeof(msgBuffer) for snprintf length is safe.
  156|       |			snprintf ( msgBuffer, sizeof(msgBuffer), "# Expat error %d at line %d, \"%s\"", expatErr, errLine, expatMsg );
  157|       |			sExpatMessage = msgBuffer;
  158|       |			errMsg = sExpatMessage.c_str();
  159|       |
  160|       |			#if  DumpXMLParseEvents
  161|       |				if ( this->parseLog != 0 ) fprintf ( this->parseLog, "%s\n", errMsg, expatErr, errLine, expatMsg );
  162|       |			#endif
  163|       |
  164|       |		#endif
  165|       |
  166|     43|		XMP_Throw ( errMsg, kXMPErr_BadXML );
  ------------------
  |  |  199|     43|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  167|       |
  168|      0|	}
  169|       |	
  170|  3.78k|}	// ExpatAdapter::ParseBuffer
ExpatAdapter.cpp:_ZL25StartNamespaceDeclHandlerPvPKcS1_:
  242|  25.5k|{
  243|  25.5k|	IgnoreParam(userData);
  ------------------
  |  |  117|  25.5k|#define IgnoreParam(p)	(void)p
  ------------------
  244|       |	
  245|       |	// As a bug fix hack, change a URI of "http://purl.org/dc/1.1/" to ""http://purl.org/dc/elements/1.1/.
  246|       |	// Early versions of Flash that put XMP in SWF used a bad URI for the dc: namespace.
  247|       |	
  248|       |	#if XMP_DebugBuild & DumpXMLParseEvents		// Avoid unused variable warning.
  249|       |		ExpatAdapter * thiz = (ExpatAdapter*)userData;
  250|       |	#endif
  251|       |
  252|  25.5k|	if ( prefix == 0 ) prefix = "_dflt_";	// Have default namespace.
  ------------------
  |  Branch (252:7): [True: 645, False: 24.9k]
  ------------------
  253|  25.5k|	if ( uri == 0 ) return;	// Ignore, have xmlns:pre="", no URI to register.
  ------------------
  |  Branch (253:7): [True: 198, False: 25.3k]
  ------------------
  254|       |	
  255|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  256|       |		if ( thiz->parseLog != 0 ) {
  257|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  258|       |			fprintf ( thiz->parseLog, "StartNamespace: %s - \"%s\"\n", prefix, uri );
  259|       |		}
  260|       |	#endif
  261|       |	
  262|  25.3k|	if ( XMP_LitMatch ( uri, "http://purl.org/dc/1.1/" ) ) uri = "http://purl.org/dc/elements/1.1/";
  ------------------
  |  |   96|  25.3k|#define XMP_LitMatch(s,l)		(std::strcmp((s),(l)) == 0)
  |  |  ------------------
  |  |  |  Branch (96:28): [True: 36, False: 25.3k]
  |  |  ------------------
  ------------------
  263|  25.3k|	XMPMeta::RegisterNamespace ( uri, prefix );
  264|       |
  265|  25.3k|}	// StartNamespaceDeclHandler
ExpatAdapter.cpp:_ZL23EndNamespaceDeclHandlerPvPKc:
  270|  25.5k|{
  271|  25.5k|	IgnoreParam(userData);
  ------------------
  |  |  117|  25.5k|#define IgnoreParam(p)	(void)p
  ------------------
  272|       |
  273|       |	#if XMP_DebugBuild & DumpXMLParseEvents		// Avoid unused variable warning.
  274|       |		ExpatAdapter * thiz = (ExpatAdapter*)userData;
  275|       |	#endif
  276|       |
  277|  25.5k|	if ( prefix == 0 ) prefix = "_dflt_";	// Have default namespace.
  ------------------
  |  Branch (277:7): [True: 645, False: 24.9k]
  ------------------
  278|       |	
  279|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  280|       |		if ( thiz->parseLog != 0 ) {
  281|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  282|       |			fprintf ( thiz->parseLog, "EndNamespace: %s\n", prefix );
  283|       |		}
  284|       |	#endif
  285|       |	
  286|       |	// ! Nothing to do, Expat has done all of the XML processing.
  287|       |
  288|  25.5k|}	// EndNamespaceDeclHandler
ExpatAdapter.cpp:_ZL19StartElementHandlerPvPKcPS1_:
  293|  75.1k|{
  294|  75.1k|	XMP_Assert ( attrs != 0 );
  ------------------
  |  |  142|  75.1k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  295|  75.1k|	ExpatAdapter * thiz = (ExpatAdapter*)userData;
  296|       |	
  297|  75.1k|	size_t attrCount = 0;
  298|   213k|	for ( XMP_StringPtr* a = attrs; *a != 0; ++a ) ++attrCount;
  ------------------
  |  Branch (298:34): [True: 138k, False: 75.1k]
  ------------------
  299|  75.1k|	if ( (attrCount & 1) != 0 )	XMP_Throw ( "Expat attribute info has odd length", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (299:7): [True: 0, False: 75.1k]
  ------------------
  300|  75.1k|	attrCount = attrCount/2;	// They are name/value pairs.
  301|       |	
  302|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  303|       |		if ( thiz->parseLog != 0 ) {
  304|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  305|       |			fprintf ( thiz->parseLog, "StartElement: %s, %d attrs", name, attrCount );
  306|       |			for ( XMP_StringPtr* attr = attrs; *attr != 0; attr += 2 ) {
  307|       |				XMP_StringPtr attrName = *attr;
  308|       |				XMP_StringPtr attrValue = *(attr+1);
  309|       |				fprintf ( thiz->parseLog, ", %s = \"%s\"", attrName, attrValue );
  310|       |			}
  311|       |			fprintf ( thiz->parseLog, "\n" );
  312|       |		}
  313|       |	#endif
  314|       |
  315|  75.1k|	XML_Node * parentNode = thiz->parseStack.back();
  316|  75.1k|	XML_Node * elemNode   = new XML_Node ( parentNode, "", kElemNode );
  317|       |	
  318|  75.1k|	SetQualName ( name, elemNode );
  319|       |	
  320|   144k|	for ( XMP_StringPtr* attr = attrs; *attr != 0; attr += 2 ) {
  ------------------
  |  Branch (320:37): [True: 69.2k, False: 75.1k]
  ------------------
  321|       |
  322|  69.2k|		XMP_StringPtr attrName = *attr;
  323|  69.2k|		XMP_StringPtr attrValue = *(attr+1);
  324|  69.2k|		XML_Node * attrNode = new XML_Node ( elemNode, "", kAttrNode );
  325|       |
  326|  69.2k|		SetQualName ( attrName, attrNode );
  327|  69.2k|		attrNode->value = attrValue;
  328|  69.2k|		if ( attrNode->name == "xml:lang" ) NormalizeLangValue ( &attrNode->value );
  ------------------
  |  Branch (328:8): [True: 8.98k, False: 60.2k]
  ------------------
  329|  69.2k|		elemNode->attrs.push_back ( attrNode );
  330|       |
  331|  69.2k|	}
  332|       |	
  333|  75.1k|	parentNode->content.push_back ( elemNode );
  334|  75.1k|	thiz->parseStack.push_back ( elemNode );
  335|       |	
  336|  75.1k|	if ( elemNode->name == "rdf:RDF" ) {
  ------------------
  |  Branch (336:7): [True: 3.45k, False: 71.6k]
  ------------------
  337|  3.45k|		thiz->rootNode = elemNode;
  338|  3.45k|		++thiz->rootCount;
  339|  3.45k|	}
  340|       |	#if XMP_DebugBuild
  341|       |		++thiz->elemNesting;
  342|       |	#endif
  343|       |
  344|  75.1k|}	// StartElementHandler
ExpatAdapter.cpp:_ZL11SetQualNamePKcP8XML_Node:
  187|   144k|{
  188|       |	// Expat delivers the full name as a catenation of namespace URI, separator, and local name.
  189|       |
  190|       |	// As a compatibility hack, an "about" or "ID" attribute of an rdf:Description element is
  191|       |	// changed to "rdf:about" or rdf:ID. Easier done here than in the RDF recognizer.
  192|       |	
  193|       |	// As a bug fix hack, change a URI of "http://purl.org/dc/1.1/" to ""http://purl.org/dc/elements/1.1/.
  194|       |	// Early versions of Flash that put XMP in SWF used a bad URI for the dc: namespace.
  195|       |
  196|       |	// ! This code presumes the RDF namespace prefix is "rdf".
  197|       |
  198|   144k|	size_t sepPos = strlen(fullName);
  199|  13.7M|	for ( --sepPos; sepPos > 0; --sepPos ) {
  ------------------
  |  Branch (199:18): [True: 13.7M, False: 3.51k]
  ------------------
  200|  13.7M|		if ( fullName[sepPos] == FullNameSeparator ) break;
  ------------------
  |  |   33|  13.7M|#define FullNameSeparator	'@'
  ------------------
  |  Branch (200:8): [True: 140k, False: 13.5M]
  ------------------
  201|  13.7M|	}
  202|       |
  203|   144k|	if ( fullName[sepPos] == FullNameSeparator ) {
  ------------------
  |  |   33|   144k|#define FullNameSeparator	'@'
  ------------------
  |  Branch (203:7): [True: 140k, False: 3.51k]
  ------------------
  204|       |
  205|   140k|		XMP_StringPtr prefix;
  206|   140k|		XMP_StringLen prefixLen;
  207|   140k|		XMP_StringPtr localPart = fullName + sepPos + 1;
  208|       |
  209|   140k|		node->ns.assign ( fullName, sepPos );
  210|   140k|		if ( node->ns == "http://purl.org/dc/1.1/" ) node->ns = "http://purl.org/dc/elements/1.1/";
  ------------------
  |  Branch (210:8): [True: 136, False: 140k]
  ------------------
  211|       |
  212|   140k|		bool found = XMPMeta::GetNamespacePrefix ( node->ns.c_str(), &prefix, &prefixLen );
  213|   140k|		if ( ! found ) XMP_Throw ( "Unknown URI in Expat full name", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (213:8): [True: 0, False: 140k]
  ------------------
  214|   140k|		node->nsPrefixLen = prefixLen;	// ! Includes the ':'.
  215|       |		
  216|   140k|		node->name = prefix;
  217|   140k|		node->name += localPart;
  218|       |
  219|   140k|	} else {
  220|       |
  221|  3.51k|		node->name = fullName;	// The name is not in a namespace.
  222|       |	
  223|  3.51k|		if ( node->parent->name == "rdf:Description" ) {
  ------------------
  |  Branch (223:8): [True: 1.52k, False: 1.99k]
  ------------------
  224|  1.52k|			if ( node->name == "about" ) {
  ------------------
  |  Branch (224:9): [True: 41, False: 1.48k]
  ------------------
  225|     41|				node->ns   = kXMP_NS_RDF;
  226|     41|				node->name = "rdf:about";
  227|     41|				node->nsPrefixLen = 4;	// ! Include the ':'.
  228|  1.48k|			} else if ( node->name == "ID" ) {
  ------------------
  |  Branch (228:16): [True: 22, False: 1.46k]
  ------------------
  229|     22|				node->ns   = kXMP_NS_RDF;
  230|     22|				node->name = "rdf:ID";
  231|     22|				node->nsPrefixLen = 4;	// ! Include the ':'.
  232|     22|			}
  233|  1.52k|		}
  234|       |		
  235|  3.51k|	}
  236|       |
  237|   144k|}	// SetQualName
ExpatAdapter.cpp:_ZL17EndElementHandlerPvPKc:
  349|  75.1k|{
  350|  75.1k|	IgnoreParam(name);
  ------------------
  |  |  117|  75.1k|#define IgnoreParam(p)	(void)p
  ------------------
  351|       |	
  352|  75.1k|	ExpatAdapter * thiz = (ExpatAdapter*)userData;
  353|       |
  354|       |	#if XMP_DebugBuild
  355|       |		--thiz->elemNesting;
  356|       |	#endif
  357|  75.1k|	(void) thiz->parseStack.pop_back();
  358|       |	
  359|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  360|       |		if ( thiz->parseLog != 0 ) {
  361|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  362|       |			fprintf ( thiz->parseLog, "EndElement: %s\n", name );
  363|       |		}
  364|       |	#endif
  365|       |
  366|  75.1k|}	// EndElementHandler
ExpatAdapter.cpp:_ZL20CharacterDataHandlerPvPKci:
  371|   256k|{
  372|   256k|	ExpatAdapter * thiz = (ExpatAdapter*)userData;
  373|       |	
  374|   256k|	if ( (cData == 0) || (len == 0) ) { cData = ""; len = 0; }
  ------------------
  |  Branch (374:7): [True: 0, False: 256k]
  |  Branch (374:23): [True: 0, False: 256k]
  ------------------
  375|       |	
  376|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  377|       |		if ( thiz->parseLog != 0 ) {
  378|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  379|       |			fprintf ( thiz->parseLog, "CharContent: \"" );
  380|       |			for ( int i = 0; i < len; ++i ) fprintf ( thiz->parseLog, "%c", cData[i] );
  381|       |			fprintf ( thiz->parseLog, "\"\n" );
  382|       |		}
  383|       |	#endif
  384|       |	
  385|   256k|	XML_Node * parentNode = thiz->parseStack.back();
  386|   256k|	XML_Node * cDataNode  = new XML_Node ( parentNode, "", kCDataNode );
  387|       |	
  388|   256k|	cDataNode->value.assign ( cData, len );
  389|   256k|	parentNode->content.push_back ( cDataNode );
  390|       |	
  391|   256k|}	// CharacterDataHandler
ExpatAdapter.cpp:_ZL28ProcessingInstructionHandlerPvPKcS1_:
  436|  2.23k|{
  437|  2.23k|	XMP_Assert ( target != 0 );
  ------------------
  |  |  142|  2.23k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  438|  2.23k|	ExpatAdapter * thiz = (ExpatAdapter*)userData;
  439|       |
  440|  2.23k|	if ( ! XMP_LitMatch ( target, "xpacket" ) ) return;	// Ignore all PIs except the XMP packet wrapper.
  ------------------
  |  |   96|  2.23k|#define XMP_LitMatch(s,l)		(std::strcmp((s),(l)) == 0)
  ------------------
  |  Branch (440:7): [True: 610, False: 1.62k]
  ------------------
  441|  1.62k|	if ( data == 0 ) data = "";
  ------------------
  |  Branch (441:7): [True: 0, False: 1.62k]
  ------------------
  442|       |	
  443|       |	#if XMP_DebugBuild & DumpXMLParseEvents
  444|       |		if ( thiz->parseLog != 0 ) {
  445|       |			PrintIndent ( thiz->parseLog, thiz->elemNesting );
  446|       |			fprintf ( thiz->parseLog, "PI: %s - \"%s\"\n", target, data );
  447|       |		}
  448|       |	#endif
  449|       |	
  450|  1.62k|	XML_Node * parentNode = thiz->parseStack.back();
  451|  1.62k|	XML_Node * piNode  = new XML_Node ( parentNode, target, kPINode );
  452|       |	
  453|  1.62k|	piNode->value.assign ( data );
  454|  1.62k|	parentNode->content.push_back ( piNode );
  455|       |	
  456|  1.62k|}	// ProcessingInstructionHandler

_Z10ProcessRDFP8XMP_NodeRK8XML_Nodej:
  624|  3.35k|{
  625|  3.35k|	IgnoreParam(options);
  ------------------
  |  |  117|  3.35k|#define IgnoreParam(p)	(void)p
  ------------------
  626|       |	
  627|  3.35k|	RDF_RDF ( xmpTree, rdfNode );
  628|       |
  629|  3.35k|}	// ProcessRDF
ParseRDF.cpp:_ZL7RDF_RDFP8XMP_NodeRK8XML_Node:
  646|  3.35k|{
  647|       |
  648|  3.35k|	if ( ! xmlNode.attrs.empty() ) XMP_Throw ( "Invalid attributes of rdf:RDF element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      7|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (648:7): [True: 7, False: 3.34k]
  ------------------
  649|  3.34k|	RDF_NodeElementList ( xmpTree, xmlNode, kIsTopLevel );
  650|       |
  651|  3.34k|}	// RDF_RDF
ParseRDF.cpp:_ZL19RDF_NodeElementListP8XMP_NodeRK8XML_Nodeb:
  663|  3.34k|{
  664|  3.34k|	XMP_Assert ( isTopLevel );
  ------------------
  |  |  142|  3.34k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  665|       |	
  666|  3.34k|	XML_cNodePos currChild = xmlParent.content.begin();	// *** Change these loops to the indexed pattern.
  667|  3.34k|	XML_cNodePos endChild  = xmlParent.content.end();
  668|       |
  669|  17.9k|	for ( ; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (669:10): [True: 14.6k, False: 3.34k]
  ------------------
  670|  14.6k|		if ( (*currChild)->IsWhitespaceNode() ) continue;
  ------------------
  |  Branch (670:8): [True: 11.1k, False: 3.49k]
  ------------------
  671|  3.49k|		RDF_NodeElement ( xmpParent, **currChild, isTopLevel );
  672|  3.49k|	}
  673|       |
  674|  3.34k|}	// RDF_NodeElementList
ParseRDF.cpp:_ZL15RDF_NodeElementP8XMP_NodeRK8XML_Nodeb:
  694|  6.19k|{
  695|  6.19k|	RDFTermKind nodeTerm = GetRDFTermKind ( xmlNode.name );
  696|  6.19k|	if ( (nodeTerm != kRDFTerm_Description) && (nodeTerm != kRDFTerm_Other) ) {
  ------------------
  |  Branch (696:7): [True: 2.74k, False: 3.45k]
  |  Branch (696:45): [True: 20, False: 2.72k]
  ------------------
  697|     20|		XMP_Throw ( "Node element must be rdf:Description or typedNode", kXMPErr_BadRDF );
  ------------------
  |  |  199|     20|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  698|      0|	}
  699|       |
  700|  6.17k|	if ( isTopLevel && (nodeTerm == kRDFTerm_Other) ) {
  ------------------
  |  Branch (700:7): [True: 3.49k, False: 2.67k]
  |  Branch (700:21): [True: 73, False: 3.42k]
  ------------------
  701|     73|		XMP_Throw ( "Top level typedNode not allowed", kXMPErr_BadXMP );
  ------------------
  |  |  199|     73|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  702|  6.09k|	} else {
  703|  6.09k|		RDF_NodeElementAttrs ( xmpParent, xmlNode, isTopLevel );
  704|  6.09k|		RDF_PropertyElementList ( xmpParent, xmlNode, isTopLevel );
  705|  6.09k|	}
  706|       |
  707|  6.17k|}	// RDF_NodeElement
ParseRDF.cpp:_ZL14GetRDFTermKindRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  264|   157k|{
  265|   157k|	RDFTermKind term = kRDFTerm_Other;
  266|       |
  267|       |	// Arranged to hopefully minimize the parse time for large XMP.
  268|       |
  269|   157k|	if ( (name.size() > 4) && (strncmp ( name.c_str(), "rdf:", 4 ) == 0) ) {
  ------------------
  |  Branch (269:7): [True: 157k, False: 194]
  |  Branch (269:28): [True: 58.0k, False: 99.1k]
  ------------------
  270|       |
  271|  58.0k|		if ( name == "rdf:li" ) {
  ------------------
  |  Branch (271:8): [True: 43.5k, False: 14.4k]
  ------------------
  272|  43.5k|			term = kRDFTerm_li;
  273|  43.5k|		} else if ( name == "rdf:parseType" ) {
  ------------------
  |  Branch (273:15): [True: 16, False: 14.4k]
  ------------------
  274|     16|			term = kRDFTerm_parseType;
  275|  14.4k|		} else if ( name == "rdf:Description" ) {
  ------------------
  |  Branch (275:15): [True: 3.46k, False: 10.9k]
  ------------------
  276|  3.46k|			term = kRDFTerm_Description;
  277|  10.9k|		} else if ( name == "rdf:about" ) {
  ------------------
  |  Branch (277:15): [True: 779, False: 10.1k]
  ------------------
  278|    779|			term = kRDFTerm_about;
  279|  10.1k|		} else if ( name == "rdf:resource" ) {
  ------------------
  |  Branch (279:15): [True: 19, False: 10.1k]
  ------------------
  280|     19|			term = kRDFTerm_resource;
  281|  10.1k|		} else if ( name == "rdf:RDF" ) {
  ------------------
  |  Branch (281:15): [True: 18, False: 10.1k]
  ------------------
  282|     18|			term = kRDFTerm_RDF;
  283|  10.1k|		} else if ( name == "rdf:ID" ) {
  ------------------
  |  Branch (283:15): [True: 78, False: 10.0k]
  ------------------
  284|     78|			term = kRDFTerm_ID;
  285|  10.0k|		} else if ( name == "rdf:nodeID" ) {
  ------------------
  |  Branch (285:15): [True: 41, False: 10.0k]
  ------------------
  286|     41|			term = kRDFTerm_nodeID;
  287|  10.0k|		} else if ( name == "rdf:datatype" ) {
  ------------------
  |  Branch (287:15): [True: 2, False: 10.0k]
  ------------------
  288|      2|			term = kRDFTerm_datatype;
  289|  10.0k|		} else if ( name == "rdf:aboutEach" ) {
  ------------------
  |  Branch (289:15): [True: 3, False: 10.0k]
  ------------------
  290|      3|			term = kRDFTerm_aboutEach;
  291|  10.0k|		} else if ( name == "rdf:aboutEachPrefix" ) {
  ------------------
  |  Branch (291:15): [True: 5, False: 10.0k]
  ------------------
  292|      5|			term = kRDFTerm_aboutEachPrefix;
  293|  10.0k|		} else if ( name == "rdf:bagID" ) {
  ------------------
  |  Branch (293:15): [True: 26, False: 9.99k]
  ------------------
  294|     26|			term = kRDFTerm_bagID;
  295|     26|		}
  296|       |
  297|  58.0k|	}
  298|       |
  299|   157k|	return term;
  300|       |
  301|   157k|}	// GetRDFTermKind
ParseRDF.cpp:_ZL20RDF_NodeElementAttrsP8XMP_NodeRK8XML_Nodeb:
  731|  6.09k|{
  732|  6.09k|	XMP_OptionBits exclusiveAttrs = 0;	// Used to detect attributes that are mutually exclusive.
  733|       |
  734|  6.09k|	XML_cNodePos currAttr = xmlNode.attrs.begin();
  735|  6.09k|	XML_cNodePos endAttr  = xmlNode.attrs.end();
  736|       |
  737|  17.5k|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (737:10): [True: 11.6k, False: 5.86k]
  ------------------
  738|       |
  739|  11.6k|		RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name );
  740|       |
  741|  11.6k|		switch ( attrTerm ) {
  742|       |
  743|     48|			case kRDFTerm_ID     :
  ------------------
  |  Branch (743:4): [True: 48, False: 11.6k]
  ------------------
  744|     49|			case kRDFTerm_nodeID :
  ------------------
  |  Branch (744:4): [True: 1, False: 11.6k]
  ------------------
  745|    828|			case kRDFTerm_about  :
  ------------------
  |  Branch (745:4): [True: 779, False: 10.9k]
  ------------------
  746|       |
  747|    828|				if ( exclusiveAttrs & kExclusiveAttrMask ) XMP_Throw ( "Mutally exclusive about, ID, nodeID attributes", kXMPErr_BadRDF );
  ------------------
  |  |  199|     11|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (747:10): [True: 11, False: 817]
  ------------------
  748|    817|				exclusiveAttrs |= (1 << attrTerm);
  749|       |
  750|    817|				if ( isTopLevel && (attrTerm == kRDFTerm_about) ) {
  ------------------
  |  Branch (750:10): [True: 804, False: 13]
  |  Branch (750:24): [True: 773, False: 31]
  ------------------
  751|       |					// This is the rdf:about attribute on a top level node. Set the XMP tree name if
  752|       |					// it doesn't have a name yet. Make sure this name matches the XMP tree name.
  753|    773|					XMP_Assert ( xmpParent->parent == 0 );	// Must be the tree root node.
  ------------------
  |  |  142|    773|	#define XMP_Assert(c)	((void) 0)
  ------------------
  754|    773|					if ( xmpParent->name.empty() ) {
  ------------------
  |  Branch (754:11): [True: 698, False: 75]
  ------------------
  755|    698|						xmpParent->name = (*currAttr)->value;
  756|    698|					} else if ( ! (*currAttr)->value.empty() ) {
  ------------------
  |  Branch (756:18): [True: 57, False: 18]
  ------------------
  757|     57|						if ( xmpParent->name != (*currAttr)->value ) XMP_Throw ( "Mismatched top level rdf:about values", kXMPErr_BadXMP );
  ------------------
  |  |  199|     50|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (757:12): [True: 50, False: 7]
  ------------------
  758|      7|					}
  759|    773|				}
  760|       |
  761|    767|				break;
  762|       |
  763|  10.8k|			case kRDFTerm_Other :
  ------------------
  |  Branch (763:4): [True: 10.8k, False: 875]
  ------------------
  764|  10.8k|				AddChildNode ( xmpParent, **currAttr, (*currAttr)->value.c_str(), isTopLevel );
  765|  10.8k|				break;
  766|       |
  767|     47|			default :
  ------------------
  |  Branch (767:4): [True: 47, False: 11.6k]
  ------------------
  768|     47|				XMP_Throw ( "Invalid nodeElement attribute", kXMPErr_BadRDF );
  ------------------
  |  |  199|     47|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  769|       |
  770|  11.6k|		}
  771|       |
  772|  11.6k|	}
  773|       |
  774|  6.09k|}	// RDF_NodeElementAttrs
ParseRDF.cpp:_ZL12AddChildNodeP8XMP_NodeRK8XML_NodePKcb:
  362|  78.2k|{
  363|       |	#if 0
  364|       |		cout << "AddChildNode, parent = " << xmpParent->name << ", child = " << xmlNode.name;
  365|       |		cout << ", value = \"" << value << '"';
  366|       |		if ( isTopLevel ) cout << ", top level";
  367|       |		cout << endl;
  368|       |	#endif
  369|       |	
  370|  78.2k|	if ( xmlNode.ns.empty() ) {
  ------------------
  |  Branch (370:7): [True: 183, False: 78.0k]
  ------------------
  371|    183|		XMP_Throw ( "XML namespace required for all elements and attributes", kXMPErr_BadRDF );
  ------------------
  |  |  199|    183|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  372|      0|	}
  373|       |		
  374|  78.0k|	XMP_StringPtr  childName    = xmlNode.name.c_str();
  375|  78.0k|	const bool     isArrayItem  = (xmlNode.name == "rdf:li");
  376|  78.0k|	const bool     isValueNode  = (xmlNode.name == "rdf:value");
  377|  78.0k|	XMP_OptionBits childOptions = 0;
  378|       |	
  379|  78.0k|	if ( isTopLevel ) {
  ------------------
  |  Branch (379:7): [True: 15.9k, False: 62.1k]
  ------------------
  380|       |
  381|       |		// Lookup the schema node, adjust the XMP parent pointer.
  382|  15.9k|		XMP_Assert ( xmpParent->parent == 0 );	// Incoming parent must be the tree root.
  ------------------
  |  |  142|  15.9k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  383|  15.9k|		XMP_Node * schemaNode = FindSchemaNode ( xmpParent, xmlNode.ns.c_str(), kXMP_CreateNodes );
  ------------------
  |  |  295|  15.9k|#define kXMP_CreateNodes	true
  ------------------
  384|  15.9k|		if ( schemaNode->options & kXMP_NewImplicitNode ) schemaNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|  15.9k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
              		if ( schemaNode->options & kXMP_NewImplicitNode ) schemaNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|  8.31k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (384:8): [True: 8.31k, False: 7.63k]
  ------------------
  385|       |			// *** Should use "opt &= ~flag" (no conditional), need runtime check for proper 32 bit code.
  386|  15.9k|		xmpParent = schemaNode;
  387|       |		
  388|       |		// If this is an alias set the isAlias flag in the node and the hasAliases flag in the tree.
  389|  15.9k|		if ( sRegisteredAliasMap->find ( xmlNode.name ) != sRegisteredAliasMap->end() ) {
  ------------------
  |  Branch (389:8): [True: 0, False: 15.9k]
  ------------------
  390|      0|			childOptions |= kXMP_PropIsAlias;
  391|      0|			schemaNode->parent->options |= kXMP_PropHasAliases;
  392|      0|		}
  393|       |		
  394|  15.9k|	}
  395|       |
  396|       |	// Make sure that this is not a duplicate of a named node.
  397|  78.0k|	if ( ! (isArrayItem | isValueNode) ) {
  ------------------
  |  Branch (397:7): [True: 34.6k, False: 43.4k]
  ------------------
  398|  34.6k|		if ( FindChildNode ( xmpParent, childName, kXMP_ExistingOnly ) != 0 ) {
  ------------------
  |  |  296|  34.6k|#define kXMP_ExistingOnly	false
  ------------------
  |  Branch (398:8): [True: 35, False: 34.5k]
  ------------------
  399|     35|			XMP_Throw ( "Duplicate property or field node", kXMPErr_BadXMP );
  ------------------
  |  |  199|     35|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  400|      0|		}
  401|       |		
  402|  34.6k|	}
  403|       |	
  404|       |	// Add the new child to the XMP parent node.
  405|  78.0k|	XMP_Node * newChild = new XMP_Node ( xmpParent, childName, value, childOptions );
  406|  78.0k|	if ( (! isValueNode) || xmpParent->children.empty() ) {
  ------------------
  |  Branch (406:7): [True: 78.0k, False: 23]
  |  Branch (406:26): [True: 0, False: 23]
  ------------------
  407|  78.0k|		 xmpParent->children.push_back ( newChild );
  408|  78.0k|	} else {
  409|     33|		 xmpParent->children.insert ( xmpParent->children.begin(), newChild );
  410|     33|	}
  411|  78.0k|	if ( isValueNode ) {
  ------------------
  |  Branch (411:7): [True: 23, False: 78.0k]
  ------------------
  412|     23|		if ( isTopLevel || (! (xmpParent->options & kXMP_PropValueIsStruct)) ) XMP_Throw ( "Misplaced rdf:value element", kXMPErr_BadRDF );
  ------------------
  |  |  199|     18|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (412:8): [True: 18, False: 5]
  |  Branch (412:22): [True: 0, False: 5]
  ------------------
  413|      5|		xmpParent->options |= kRDF_HasValueElem;
  414|      5|	}
  415|       |	
  416|  78.0k|	if ( isArrayItem ) {
  ------------------
  |  Branch (416:7): [True: 43.4k, False: 34.5k]
  ------------------
  417|  43.4k|		if ( ! (xmpParent->options & kXMP_PropValueIsArray) ) XMP_Throw ( "Misplaced rdf:li element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      9|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (417:8): [True: 9, False: 43.4k]
  ------------------
  418|  43.4k|		newChild->name = kXMP_ArrayItemName;
  ------------------
  |  |  293|  43.4k|#define kXMP_ArrayItemName	"[]"
  ------------------
  419|       |		#if 0	// *** XMP_DebugBuild
  420|       |			newChild->_namePtr = newChild->name.c_str();
  421|       |		#endif
  422|  43.4k|	}
  423|       |	
  424|  78.0k|	return newChild;
  425|       |
  426|  78.0k|}	// AddChildNode
ParseRDF.cpp:_ZL23RDF_PropertyElementListP8XMP_NodeRK8XML_Nodeb:
  786|  6.15k|{
  787|  6.15k|	XML_cNodePos currChild = xmlParent.content.begin();
  788|  6.15k|	XML_cNodePos endChild  = xmlParent.content.end();
  789|       |
  790|   161k|	for ( ; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (790:10): [True: 155k, False: 6.04k]
  ------------------
  791|   155k|		if ( (*currChild)->IsWhitespaceNode() ) continue;
  ------------------
  |  Branch (791:8): [True: 105k, False: 49.9k]
  ------------------
  792|  49.9k|		if ( (*currChild)->kind != kElemNode ) {
  ------------------
  |  Branch (792:8): [True: 109, False: 49.8k]
  ------------------
  793|    109|			XMP_Throw ( "Expected property element node not found", kXMPErr_BadRDF );
  ------------------
  |  |  199|    109|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  794|      0|		}
  795|  49.8k|		RDF_PropertyElement ( xmpParent, **currChild, isTopLevel );
  796|  49.8k|	}
  797|       |
  798|  6.15k|}	// RDF_PropertyElementList
ParseRDF.cpp:_ZL19RDF_PropertyElementP8XMP_NodeRK8XML_Nodeb:
  853|  49.8k|{
  854|  49.8k|	RDFTermKind nodeTerm = GetRDFTermKind ( xmlNode.name );
  855|  49.8k|	if ( ! IsPropertyElementName ( nodeTerm ) ) XMP_Throw ( "Invalid property element name", kXMPErr_BadRDF );
  ------------------
  |  |  199|     29|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (855:7): [True: 29, False: 49.7k]
  ------------------
  856|       |	
  857|  49.7k|	if ( xmlNode.attrs.size() > 3 ) {
  ------------------
  |  Branch (857:7): [True: 3.45k, False: 46.3k]
  ------------------
  858|       |
  859|       |		// Only an emptyPropertyElt can have more than 3 attributes.
  860|  3.45k|		RDF_EmptyPropertyElement ( xmpParent, xmlNode, isTopLevel );
  861|       |
  862|  46.3k|	} else {
  863|       |
  864|       |		// Look through the attributes for one that isn't rdf:ID or xml:lang, it will usually tell
  865|       |		// what we should be dealing with. The called routines must verify their specific syntax!
  866|       |
  867|  46.3k|		XML_cNodePos currAttr = xmlNode.attrs.begin();
  868|  46.3k|		XML_cNodePos endAttr  = xmlNode.attrs.end();
  869|  46.3k|		XMP_VarString * attrName = 0;
  870|       |
  871|  55.0k|		for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (871:11): [True: 12.5k, False: 42.4k]
  ------------------
  872|  12.5k|			attrName = &((*currAttr)->name);
  873|  12.5k|			if ( (*attrName != "xml:lang") && (*attrName != "rdf:ID") ) break;
  ------------------
  |  Branch (873:9): [True: 3.87k, False: 8.65k]
  |  Branch (873:38): [True: 3.85k, False: 22]
  ------------------
  874|  12.5k|		}
  875|       |
  876|  46.3k|		if ( currAttr != endAttr ) {
  ------------------
  |  Branch (876:8): [True: 3.85k, False: 42.4k]
  ------------------
  877|       |
  878|  3.85k|			XMP_Assert ( attrName != 0 );
  ------------------
  |  |  142|  3.85k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  879|  3.85k|			XMP_VarString& attrValue = (*currAttr)->value;
  880|       |
  881|  3.85k|			if ( *attrName == "rdf:datatype" ) {
  ------------------
  |  Branch (881:9): [True: 40, False: 3.81k]
  ------------------
  882|     40|				RDF_LiteralPropertyElement ( xmpParent, xmlNode, isTopLevel );
  883|  3.81k|			} else if ( *attrName != "rdf:parseType" ) {
  ------------------
  |  Branch (883:16): [True: 3.45k, False: 358]
  ------------------
  884|  3.45k|				RDF_EmptyPropertyElement ( xmpParent, xmlNode, isTopLevel );
  885|  3.45k|			} else if ( attrValue == "Literal" ) {
  ------------------
  |  Branch (885:16): [True: 1, False: 357]
  ------------------
  886|      1|				RDF_ParseTypeLiteralPropertyElement ( xmpParent, xmlNode, isTopLevel );
  887|    357|			} else if ( attrValue == "Resource" ) {
  ------------------
  |  Branch (887:16): [True: 290, False: 67]
  ------------------
  888|    290|				RDF_ParseTypeResourcePropertyElement ( xmpParent, xmlNode, isTopLevel );
  889|    290|			} else if ( attrValue == "Collection" ) {
  ------------------
  |  Branch (889:16): [True: 0, False: 67]
  ------------------
  890|      0|				RDF_ParseTypeCollectionPropertyElement ( xmpParent, xmlNode, isTopLevel );
  891|     67|			} else {
  892|     67|				RDF_ParseTypeOtherPropertyElement ( xmpParent, xmlNode, isTopLevel );
  893|     67|			}
  894|       |
  895|  42.4k|		} else {
  896|       |
  897|       |			// Only rdf:ID and xml:lang, could be a resourcePropertyElt, a literalPropertyElt, or an.
  898|       |			// emptyPropertyElt. Look at the child XML nodes to decide which.
  899|       |
  900|  42.4k|			if ( xmlNode.content.empty() ) {
  ------------------
  |  Branch (900:9): [True: 257, False: 42.2k]
  ------------------
  901|       |
  902|    257|				RDF_EmptyPropertyElement ( xmpParent, xmlNode, isTopLevel );
  903|       |
  904|  42.2k|			} else {
  905|       |			
  906|  42.2k|				XML_cNodePos currChild = xmlNode.content.begin();
  907|  42.2k|				XML_cNodePos endChild  = xmlNode.content.end();
  908|       |
  909|   129k|				for ( ; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (909:13): [True: 90.1k, False: 39.4k]
  ------------------
  910|  90.1k|					if ( (*currChild)->kind != kCDataNode ) break;
  ------------------
  |  Branch (910:11): [True: 2.75k, False: 87.3k]
  ------------------
  911|  90.1k|				}
  912|       |				
  913|  42.2k|				if ( currChild == endChild ) {
  ------------------
  |  Branch (913:10): [True: 39.4k, False: 2.75k]
  ------------------
  914|  39.4k|					RDF_LiteralPropertyElement ( xmpParent, xmlNode, isTopLevel );
  915|  39.4k|				} else {
  916|  2.75k|					RDF_ResourcePropertyElement ( xmpParent, xmlNode, isTopLevel );
  917|  2.75k|				}
  918|       |			
  919|  42.2k|			}
  920|       |
  921|  42.4k|		}
  922|       |		
  923|  46.3k|	}
  924|       |
  925|  49.7k|}	// RDF_PropertyElement
ParseRDF.cpp:_ZL21IsPropertyElementNameh:
  349|  49.8k|{
  350|       |
  351|  49.8k|	if 	( (term == kRDFTerm_Description) || IsOldTerm ( term ) ) return false;
  ------------------
  |  Branch (351:8): [True: 12, False: 49.8k]
  |  Branch (351:42): [True: 0, False: 49.8k]
  ------------------
  352|  49.8k|	return (! IsCoreSyntaxTerm ( term ));
  353|       |
  354|  49.8k|}	// IsPropertyElementName
ParseRDF.cpp:_ZL9IsOldTermh:
  333|  49.8k|{
  334|       |
  335|  49.8k|	if 	( (kRDFTerm_FirstOld <= term) && (term <= kRDFTerm_LastOld) ) return true;
  ------------------
  |  Branch (335:8): [True: 0, False: 49.8k]
  |  Branch (335:39): [True: 0, False: 0]
  ------------------
  336|  49.8k|	return false;
  337|       |
  338|  49.8k|}	// IsOldTerm
ParseRDF.cpp:_ZL16IsCoreSyntaxTermh:
  316|  49.8k|{
  317|       |
  318|  49.8k|	if 	( (kRDFTerm_FirstCore <= term) && (term <= kRDFTerm_LastCore) ) return true;
  ------------------
  |  Branch (318:8): [True: 43.5k, False: 6.26k]
  |  Branch (318:40): [True: 17, False: 43.5k]
  ------------------
  319|  49.7k|	return false;
  320|       |
  321|  49.8k|}	// IsCoreSyntaxTerm
ParseRDF.cpp:_ZL24RDF_EmptyPropertyElementP8XMP_NodeRK8XML_Nodeb:
 1189|  7.17k|{
 1190|  7.17k|	bool hasPropertyAttrs = false;
 1191|  7.17k|	bool hasResourceAttr  = false;
 1192|  7.17k|	bool hasNodeIDAttr    = false;
 1193|  7.17k|	bool hasValueAttr     = false;
 1194|       |	
 1195|  7.17k|	const XML_Node * valueNode = 0;	// ! Can come from rdf:value or rdf:resource.
 1196|       |	
 1197|  7.17k|	if ( ! xmlNode.content.empty() ) XMP_Throw ( "Nested content not allowed with rdf:resource or property attributes", kXMPErr_BadRDF );
  ------------------
  |  |  199|     80|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1197:7): [True: 80, False: 7.09k]
  ------------------
 1198|       |	
 1199|       |	// First figure out what XMP this maps to and remember the XML node for a simple value.
 1200|       |	
 1201|  7.09k|	XML_cNodePos currAttr = xmlNode.attrs.begin();
 1202|  7.09k|	XML_cNodePos endAttr  = xmlNode.attrs.end();
 1203|       |
 1204|  52.5k|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (1204:10): [True: 45.5k, False: 7.06k]
  ------------------
 1205|       |
 1206|  45.5k|		RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name );
 1207|       |
 1208|  45.5k|		switch ( attrTerm ) {
 1209|       |
 1210|     15|			case kRDFTerm_ID :
  ------------------
  |  Branch (1210:4): [True: 15, False: 45.5k]
  ------------------
 1211|       |				// Nothing to do.
 1212|     15|				break;
 1213|       |
 1214|     19|			case kRDFTerm_resource :
  ------------------
  |  Branch (1214:4): [True: 19, False: 45.4k]
  ------------------
 1215|     19|				if ( hasNodeIDAttr ) XMP_Throw ( "Empty property element can't have both rdf:resource and rdf:nodeID", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1215:10): [True: 0, False: 19]
  ------------------
 1216|     19|				if ( hasValueAttr ) XMP_Throw ( "Empty property element can't have both rdf:value and rdf:resource", kXMPErr_BadXMP );
  ------------------
  |  |  199|      5|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1216:10): [True: 5, False: 14]
  ------------------
 1217|     14|				hasResourceAttr = true;
 1218|     14|				if ( ! hasValueAttr ) valueNode = *currAttr;
  ------------------
  |  Branch (1218:10): [True: 14, False: 0]
  ------------------
 1219|     14|				break;
 1220|       |
 1221|     25|			case kRDFTerm_nodeID :
  ------------------
  |  Branch (1221:4): [True: 25, False: 45.4k]
  ------------------
 1222|     25|				if ( hasResourceAttr ) XMP_Throw ( "Empty property element can't have both rdf:resource and rdf:nodeID", kXMPErr_BadRDF );
  ------------------
  |  |  199|     10|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1222:10): [True: 10, False: 15]
  ------------------
 1223|     15|				hasNodeIDAttr = true;
 1224|     15|				break;
 1225|       |
 1226|  45.4k|			case kRDFTerm_Other :
  ------------------
  |  Branch (1226:4): [True: 45.4k, False: 70]
  ------------------
 1227|  45.4k|				if ( (*currAttr)->name == "rdf:value" ) {
  ------------------
  |  Branch (1227:10): [True: 1.14k, False: 44.2k]
  ------------------
 1228|  1.14k|					if ( hasResourceAttr ) XMP_Throw ( "Empty property element can't have both rdf:value and rdf:resource", kXMPErr_BadXMP );
  ------------------
  |  |  199|      2|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1228:11): [True: 2, False: 1.14k]
  ------------------
 1229|  1.14k|					hasValueAttr = true;
 1230|  1.14k|					valueNode = *currAttr;
 1231|  44.2k|				} else if ( (*currAttr)->name != "xml:lang" ) {
  ------------------
  |  Branch (1231:17): [True: 44.1k, False: 97]
  ------------------
 1232|  44.1k|					hasPropertyAttrs = true;
 1233|  44.1k|				}
 1234|  45.4k|				break;
 1235|       |
 1236|  45.4k|			default :
  ------------------
  |  Branch (1236:4): [True: 11, False: 45.5k]
  ------------------
 1237|     11|				XMP_Throw ( "Unrecognized attribute of empty property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|     11|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1238|      0|				break;
 1239|       |
 1240|  45.5k|		}
 1241|       |
 1242|  45.5k|	}
 1243|       |	
 1244|       |	// Create the right kind of child node and visit the attributes again to add the fields or qualifiers.
 1245|       |	// ! Because of implementation vagaries, the xmpParent is the tree root for top level properties.
 1246|       |	// ! The schema is found, created if necessary, by AddChildNode.
 1247|       |	
 1248|  7.06k|	XMP_Node * childNode = AddChildNode ( xmpParent, xmlNode, "", isTopLevel );
 1249|  7.06k|	bool childIsStruct = false;
 1250|       |	
 1251|  7.06k|	if ( hasValueAttr | hasResourceAttr ) {
  ------------------
  |  Branch (1251:7): [True: 1.14k, False: 5.91k]
  ------------------
 1252|  1.14k|		childNode->value = valueNode->value;
 1253|  1.14k|		if ( ! hasValueAttr ) childNode->options |= kXMP_PropValueIsURI;	// ! Might have both rdf:value and rdf:resource.
  ------------------
  |  Branch (1253:8): [True: 2, False: 1.14k]
  ------------------
 1254|  5.91k|	} else if ( hasPropertyAttrs ) {
  ------------------
  |  Branch (1254:14): [True: 5.59k, False: 327]
  ------------------
 1255|  5.59k|		childNode->options |= kXMP_PropValueIsStruct;
 1256|  5.59k|		childIsStruct = true;
 1257|  5.59k|	}
 1258|       |		
 1259|  7.06k|	currAttr = xmlNode.attrs.begin();
 1260|  7.06k|	endAttr  = xmlNode.attrs.end();
 1261|       |
 1262|  52.3k|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (1262:10): [True: 45.2k, False: 7.00k]
  ------------------
 1263|       |
 1264|  45.2k|		if ( *currAttr == valueNode ) continue;	// Skip the rdf:value or rdf:resource attribute holding the value.
  ------------------
  |  Branch (1264:8): [True: 1.14k, False: 44.1k]
  ------------------
 1265|  44.1k|		RDFTermKind attrTerm = GetRDFTermKind ( (*currAttr)->name );
 1266|       |
 1267|  44.1k|		switch ( attrTerm ) {
 1268|       |
 1269|     15|			case kRDFTerm_ID       :
  ------------------
  |  Branch (1269:4): [True: 15, False: 44.1k]
  ------------------
 1270|     30|			case kRDFTerm_nodeID   :
  ------------------
  |  Branch (1270:4): [True: 15, False: 44.1k]
  ------------------
 1271|     30|				break;	// Ignore all rdf:ID and rdf:nodeID attributes.w
 1272|       |				
 1273|      0|			case kRDFTerm_resource :
  ------------------
  |  Branch (1273:4): [True: 0, False: 44.1k]
  ------------------
 1274|      0|				AddQualifierNode ( childNode, **currAttr );
 1275|      0|				break;
 1276|       |
 1277|  44.1k|			case kRDFTerm_Other :
  ------------------
  |  Branch (1277:4): [True: 44.1k, False: 30]
  ------------------
 1278|  44.1k|				if ( (! childIsStruct) || (*currAttr)->name == "xml:lang" ) {
  ------------------
  |  Branch (1278:10): [True: 26.2k, False: 17.8k]
  |  Branch (1278:31): [True: 10, False: 17.8k]
  ------------------
 1279|  26.2k|					AddQualifierNode ( childNode, **currAttr );
 1280|  26.2k|				} else {
 1281|  17.8k|					AddChildNode ( childNode, **currAttr, (*currAttr)->value.c_str(), false );
 1282|  17.8k|				}
 1283|  44.1k|				break;
 1284|       |
 1285|      0|			default :
  ------------------
  |  Branch (1285:4): [True: 0, False: 44.1k]
  ------------------
 1286|      0|				XMP_Throw ( "Unrecognized attribute of empty property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1287|      0|				break;
 1288|       |
 1289|  44.1k|		}
 1290|       |
 1291|  44.1k|	}
 1292|       |
 1293|  7.06k|}	// RDF_EmptyPropertyElement
ParseRDF.cpp:_ZL16AddQualifierNodeP8XMP_NodeRK8XML_Node:
  483|  34.8k|{
  484|  34.8k|	if ( attr.ns.empty() ) {
  ------------------
  |  Branch (484:7): [True: 15, False: 34.8k]
  ------------------
  485|     15|		XMP_Throw ( "XML namespace required for all elements and attributes", kXMPErr_BadRDF );
  ------------------
  |  |  199|     15|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  486|      0|	}
  487|       |	
  488|  34.8k|	return AddQualifierNode ( xmpParent, attr.name, attr.value );
  489|       |
  490|  34.8k|}	// AddQualifierNode
ParseRDF.cpp:_ZL16AddQualifierNodeP8XMP_NodeRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_:
  435|  34.9k|{
  436|       |
  437|       |	#if 0
  438|       |		cout << "AddQualifierNode, parent = " << xmpParent->name << ", name = " << name;
  439|       |		cout << ", value = \"" << value << '"' << endl;
  440|       |	#endif
  441|       |	
  442|  34.9k|	const bool isLang = (name == "xml:lang");
  443|  34.9k|	const bool isType = (name == "rdf:type");
  444|       |
  445|  34.9k|	XMP_Node * newQual = 0;
  446|       |
  447|  34.9k|		newQual = new XMP_Node ( xmpParent, name, value, kXMP_PropIsQualifier );
  448|       |
  449|  34.9k|		if ( ! (isLang | isType) ) {
  ------------------
  |  Branch (449:8): [True: 26.1k, False: 8.75k]
  ------------------
  450|  26.1k|			xmpParent->qualifiers.push_back ( newQual );
  451|  26.1k|		} else if ( isLang ) {
  ------------------
  |  Branch (451:15): [True: 8.65k, False: 95]
  ------------------
  452|  8.65k|			if ( xmpParent->qualifiers.empty() ) {
  ------------------
  |  Branch (452:9): [True: 8.65k, False: 6]
  ------------------
  453|  8.65k|				xmpParent->qualifiers.push_back ( newQual );
  454|  8.65k|			} else {
  455|      6|				xmpParent->qualifiers.insert ( xmpParent->qualifiers.begin(), newQual );
  456|      6|			}
  457|  8.65k|			xmpParent->options |= kXMP_PropHasLang;
  458|  8.65k|		} else {
  459|     95|			XMP_Assert ( isType );
  ------------------
  |  |  142|     95|	#define XMP_Assert(c)	((void) 0)
  ------------------
  460|     95|			if ( xmpParent->qualifiers.empty() ) {
  ------------------
  |  Branch (460:9): [True: 74, False: 21]
  ------------------
  461|     74|				xmpParent->qualifiers.push_back ( newQual );
  462|     74|			} else {
  463|     21|				size_t offset = 0;
  464|     21|				if ( XMP_PropHasLang ( xmpParent->options ) ) offset = 1;
  ------------------
  |  Branch (464:10): [True: 15, False: 6]
  ------------------
  465|     21|				xmpParent->qualifiers.insert ( xmpParent->qualifiers.begin()+offset, newQual );
  466|     21|			}
  467|     95|			xmpParent->options |= kXMP_PropHasType;
  468|     95|		}
  469|       |
  470|  34.9k|		xmpParent->options |= kXMP_PropHasQualifiers;
  471|       |
  472|  34.9k|	return newQual;
  473|       |
  474|  34.9k|}	// AddQualifierNode
ParseRDF.cpp:_ZL26RDF_LiteralPropertyElementP8XMP_NodeRK8XML_Nodeb:
 1014|  39.5k|{
 1015|  39.5k|	XMP_Node * newChild = AddChildNode ( xmpParent, xmlNode, "", isTopLevel );
 1016|       |	
 1017|  39.5k|	XML_cNodePos currAttr = xmlNode.attrs.begin();
 1018|  39.5k|	XML_cNodePos endAttr  = xmlNode.attrs.end();
 1019|       |
 1020|  48.1k|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (1020:10): [True: 8.65k, False: 39.4k]
  ------------------
 1021|  8.65k|		XMP_VarString & attrName = (*currAttr)->name;
 1022|  8.65k|		if ( attrName == "xml:lang" ) {
  ------------------
  |  Branch (1022:8): [True: 8.56k, False: 84]
  ------------------
 1023|  8.56k|			AddQualifierNode ( newChild, **currAttr );
 1024|  8.56k|		} else if ( (attrName == "rdf:ID") || (attrName == "rdf:datatype") ) {
  ------------------
  |  Branch (1024:15): [True: 7, False: 77]
  |  Branch (1024:41): [True: 40, False: 37]
  ------------------
 1025|     47|			continue;	// Ignore all rdf:ID and rdf:datatype attributes.
 1026|     47|		} else {
 1027|     37|			XMP_Throw ( "Invalid attribute for literal property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|     37|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1028|      0|		}
 1029|  8.65k|	}
 1030|       |	
 1031|  39.4k|	XML_cNodePos currChild = xmlNode.content.begin();
 1032|  39.4k|	XML_cNodePos endChild  = xmlNode.content.end();
 1033|  39.4k|	size_t      textSize  = 0;
 1034|       |
 1035|   120k|	for ( ; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (1035:10): [True: 81.1k, False: 39.4k]
  ------------------
 1036|  81.1k|		if ( (*currChild)->kind != kCDataNode ) XMP_Throw ( "Invalid child of literal property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      3|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1036:8): [True: 3, False: 81.1k]
  ------------------
 1037|  81.1k|		textSize += (*currChild)->value.size();
 1038|  81.1k|	}
 1039|       |	
 1040|  39.4k|	newChild->value.reserve ( textSize );
 1041|       |
 1042|   120k|	for ( currChild = xmlNode.content.begin(); currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (1042:45): [True: 81.1k, False: 39.4k]
  ------------------
 1043|  81.1k|		newChild->value += (*currChild)->value;
 1044|  81.1k|	}
 1045|       |
 1046|       |	#if 0	// *** XMP_DebugBuild
 1047|       |		newChild->_valuePtr = newChild->value.c_str();
 1048|       |	#endif
 1049|       |	
 1050|  39.4k|}	// RDF_LiteralPropertyElement
ParseRDF.cpp:_ZL35RDF_ParseTypeLiteralPropertyElementP8XMP_NodeRK8XML_Nodeb:
 1064|      1|{
 1065|      1|	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|      1|#define IgnoreParam(p)	(void)p
  ------------------
              	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|      1|#define IgnoreParam(p)	(void)p
  ------------------
              	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|      1|#define IgnoreParam(p)	(void)p
  ------------------
 1066|       |	
 1067|      1|	XMP_Throw ( "ParseTypeLiteral property element not allowed", kXMPErr_BadXMP );
  ------------------
  |  |  199|      1|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1068|       |
 1069|      0|}	// RDF_ParseTypeLiteralPropertyElement
ParseRDF.cpp:_ZL36RDF_ParseTypeResourcePropertyElementP8XMP_NodeRK8XML_Nodeb:
 1086|    290|{
 1087|       |
 1088|    290|	XMP_Node * newStruct = AddChildNode ( xmpParent, xmlNode, "", isTopLevel );
 1089|    290|	newStruct->options  |= kXMP_PropValueIsStruct;
 1090|       |	
 1091|    290|	XML_cNodePos currAttr = xmlNode.attrs.begin();
 1092|    290|	XML_cNodePos endAttr  = xmlNode.attrs.end();
 1093|       |
 1094|    580|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (1094:10): [True: 290, False: 290]
  ------------------
 1095|    290|		XMP_VarString & attrName = (*currAttr)->name;
 1096|    290|		if ( attrName == "rdf:parseType" ) {
  ------------------
  |  Branch (1096:8): [True: 290, False: 0]
  ------------------
 1097|    290|			continue;	// ! The caller ensured the value is "Resource".
 1098|    290|		} else if ( attrName == "xml:lang" ) {
  ------------------
  |  Branch (1098:15): [True: 0, False: 0]
  ------------------
 1099|      0|			AddQualifierNode ( newStruct, **currAttr );
 1100|      0|		} else if ( attrName == "rdf:ID" ) {
  ------------------
  |  Branch (1100:15): [True: 0, False: 0]
  ------------------
 1101|      0|			continue;	// Ignore all rdf:ID attributes.
 1102|      0|		} else {
 1103|      0|			XMP_Throw ( "Invalid attribute for ParseTypeResource property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1104|      0|		}
 1105|    290|	}
 1106|       |
 1107|    290|	RDF_PropertyElementList ( newStruct, xmlNode, kNotTopLevel );
 1108|       |
 1109|    290|	if ( newStruct->options & kRDF_HasValueElem ) FixupQualifiedNode ( newStruct );
  ------------------
  |  Branch (1109:7): [True: 0, False: 290]
  ------------------
 1110|       |	
 1111|       |	// *** Need to look for arrays using rdf:Description and rdf:type.
 1112|       |
 1113|    290|}	// RDF_ParseTypeResourcePropertyElement
ParseRDF.cpp:_ZL18FixupQualifiedNodeP8XMP_Node:
  504|      5|{
  505|      5|	size_t qualNum, qualLim;
  506|      5|	size_t childNum, childLim;
  507|       |
  508|      5|	XMP_Enforce ( (xmpParent->options & kXMP_PropValueIsStruct) && (! xmpParent->children.empty()) );
  ------------------
  |  |  148|     10|		if ( ! (c) ) {																				\
  |  |  ------------------
  |  |  |  Branch (148:11): [True: 5, False: 0]
  |  |  |  Branch (148:11): [True: 5, False: 0]
  |  |  ------------------
  |  |  149|      0|			const char * assert_msg = _NotifyMsg ( XMP_Enforce, (c), __FILE__, __LINE__ );			\
  |  |  ------------------
  |  |  |  |  139|      0|#define _NotifyMsg(n,c,f,l)	#n " failed: " #c " in " f " at line " _MakeStr(l)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define _MakeStr(p)			#p
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|			XMP_Throw ( assert_msg , kXMPErr_EnforceFailure );										\
  |  |  ------------------
  |  |  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  |  |  ------------------
  |  |  151|      0|		}
  ------------------
  509|       |
  510|      5|	XMP_Node * valueNode = xmpParent->children[0];
  511|      5|	XMP_Enforce ( valueNode->name == "rdf:value" );
  ------------------
  |  |  148|      5|		if ( ! (c) ) {																				\
  |  |  ------------------
  |  |  |  Branch (148:8): [True: 0, False: 5]
  |  |  ------------------
  |  |  149|      0|			const char * assert_msg = _NotifyMsg ( XMP_Enforce, (c), __FILE__, __LINE__ );			\
  |  |  ------------------
  |  |  |  |  139|      0|#define _NotifyMsg(n,c,f,l)	#n " failed: " #c " in " f " at line " _MakeStr(l)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define _MakeStr(p)			#p
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|			XMP_Throw ( assert_msg , kXMPErr_EnforceFailure );										\
  |  |  ------------------
  |  |  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  |  |  ------------------
  |  |  151|      0|		}
  ------------------
  512|       |	
  513|      5|	xmpParent->qualifiers.reserve ( xmpParent->qualifiers.size() + xmpParent->children.size() + valueNode->qualifiers.size() );
  514|       |	
  515|       |	// Move the qualifiers on the value node to the parent. Make sure an xml:lang qualifier stays at
  516|       |	// the front. Check for duplicate names between the value node's qualifiers and the parent's
  517|       |	// children. The parent's children are about to become qualifiers. Check here, between the
  518|       |	// groups. Intra-group duplicates are caught by AddChildNode.
  519|       |	
  520|      5|	qualNum = 0;
  521|      5|	qualLim = valueNode->qualifiers.size();
  522|       |	
  523|      5|	if ( valueNode->options & kXMP_PropHasLang ) {
  ------------------
  |  Branch (523:7): [True: 0, False: 5]
  ------------------
  524|       |
  525|      0|		if ( xmpParent->options & kXMP_PropHasLang ) XMP_Throw ( "Redundant xml:lang for rdf:value element", kXMPErr_BadXMP );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (525:8): [True: 0, False: 0]
  ------------------
  526|       |
  527|      0|		XMP_Node * langQual = valueNode->qualifiers[0];
  528|       |		
  529|      0|		XMP_Assert ( langQual->name == "xml:lang" );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  530|      0|		langQual->parent = xmpParent;
  531|      0|		xmpParent->options |= kXMP_PropHasLang;
  532|       |
  533|      0|		if ( xmpParent->qualifiers.empty() ) {
  ------------------
  |  Branch (533:8): [True: 0, False: 0]
  ------------------
  534|      0|			xmpParent->qualifiers.push_back ( langQual );	// *** Should use utilities to add qual & set parent.
  535|      0|		} else {
  536|      0|			xmpParent->qualifiers.insert ( xmpParent->qualifiers.begin(), langQual );
  537|      0|		}
  538|      0|		valueNode->qualifiers[0] = 0;	// We just moved it to the parent.
  539|       |
  540|      0|		qualNum = 1;	// Start the remaining copy after the xml:lang qualifier.
  541|       |
  542|      0|	}
  543|       |	
  544|      5|	for ( ; qualNum != qualLim; ++qualNum ) {
  ------------------
  |  Branch (544:10): [True: 0, False: 5]
  ------------------
  545|       |
  546|      0|		XMP_Node * currQual = valueNode->qualifiers[qualNum];
  547|      0|		if ( FindChildNode ( xmpParent, currQual->name.c_str(), kXMP_ExistingOnly ) != 0 ) {
  ------------------
  |  |  296|      0|#define kXMP_ExistingOnly	false
  ------------------
  |  Branch (547:8): [True: 0, False: 0]
  ------------------
  548|      0|			XMP_Throw ( "Duplicate qualifier node", kXMPErr_BadXMP );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  549|      0|		}
  550|       |
  551|      0|		currQual->parent = xmpParent;
  552|      0|		xmpParent->qualifiers.push_back ( currQual );
  553|      0|		valueNode->qualifiers[qualNum] = 0;	// We just moved it to the parent.
  554|       |
  555|      0|	}
  556|       |	
  557|      5|	valueNode->qualifiers.clear();	// ! There should be nothing but null pointers.
  558|       |	
  559|       |	// Change the parent's other children into qualifiers. This loop starts at 1, child 0 is the
  560|       |	// rdf:value node. Put xml:lang at the front, append all others.
  561|       |	
  562|     46|	for ( childNum = 1, childLim = xmpParent->children.size(); childNum != childLim; ++childNum ) {
  ------------------
  |  Branch (562:61): [True: 41, False: 5]
  ------------------
  563|       |
  564|     41|		XMP_Node * currQual = xmpParent->children[childNum];
  565|       |	
  566|     41|			bool isLang = (currQual->name == "xml:lang");
  567|       |			
  568|     41|			currQual->options |= kXMP_PropIsQualifier;
  569|     41|			currQual->parent = xmpParent;
  570|       |
  571|     41|			if ( isLang ) {
  ------------------
  |  Branch (571:9): [True: 0, False: 41]
  ------------------
  572|      0|				if ( xmpParent->options & kXMP_PropHasLang ) XMP_Throw ( "Duplicate xml:lang qualifier", kXMPErr_BadXMP );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (572:10): [True: 0, False: 0]
  ------------------
  573|      0|				xmpParent->options |= kXMP_PropHasLang;
  574|     41|			} else if ( currQual->name == "rdf:type" ) {
  ------------------
  |  Branch (574:16): [True: 0, False: 41]
  ------------------
  575|      0|				xmpParent->options |= kXMP_PropHasType;
  576|      0|			}
  577|       |
  578|     41|			if ( (! isLang) || xmpParent->qualifiers.empty() ) {
  ------------------
  |  Branch (578:9): [True: 41, False: 0]
  |  Branch (578:23): [True: 0, False: 0]
  ------------------
  579|     41|				xmpParent->qualifiers.push_back ( currQual );
  580|     41|			} else {
  581|      0|				xmpParent->qualifiers.insert ( xmpParent->qualifiers.begin(), currQual );
  582|      0|			}
  583|     41|			xmpParent->children[childNum] = 0;	// We just moved it to the qualifers.
  584|       |		
  585|     41|	}
  586|       |	
  587|      5|	if ( ! xmpParent->qualifiers.empty() ) xmpParent->options |= kXMP_PropHasQualifiers;
  ------------------
  |  Branch (587:7): [True: 5, False: 0]
  ------------------
  588|       |	
  589|       |	// Move the options and value last, other checks need the parent's original options. Move the
  590|       |	// value node's children to be the parent's children. Delete the now useless value node.
  591|       |	
  592|      5|	XMP_Assert ( xmpParent->options & (kXMP_PropValueIsStruct | kRDF_HasValueElem) );
  ------------------
  |  |  142|      5|	#define XMP_Assert(c)	((void) 0)
  ------------------
  593|      5|	xmpParent->options &= ~ (static_cast<unsigned long>(kXMP_PropValueIsStruct) | static_cast<unsigned long>(kRDF_HasValueElem));
  594|      5|	xmpParent->options |= valueNode->options;
  595|       |	
  596|      5|	xmpParent->value.swap ( valueNode->value );
  597|       |	#if 0	// *** XMP_DebugBuild
  598|       |		xmpParent->_valuePtr = xmpParent->value.c_str();
  599|       |	#endif
  600|       |
  601|      5|	xmpParent->children[0] = 0;	// ! Remove the value node itself before the swap.
  602|      5|	xmpParent->children.swap ( valueNode->children );
  603|       |	
  604|      5|	for ( size_t childNum = 0, childLim = xmpParent->children.size(); childNum != childLim; ++childNum ) {
  ------------------
  |  Branch (604:68): [True: 0, False: 5]
  ------------------
  605|      0|		XMP_Node * currChild = xmpParent->children[childNum];
  606|      0|		currChild->parent = xmpParent;
  607|      0|	}
  608|       |
  609|      5|	delete valueNode;
  610|       |	
  611|      5|}	// FixupQualifiedNode
ParseRDF.cpp:_ZL33RDF_ParseTypeOtherPropertyElementP8XMP_NodeRK8XML_Nodeb:
 1146|     67|{
 1147|     67|	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|     67|#define IgnoreParam(p)	(void)p
  ------------------
              	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|     67|#define IgnoreParam(p)	(void)p
  ------------------
              	IgnoreParam(xmpParent); IgnoreParam(xmlNode); IgnoreParam(isTopLevel); 
  ------------------
  |  |  117|     67|#define IgnoreParam(p)	(void)p
  ------------------
 1148|       |
 1149|     67|	XMP_Throw ( "ParseTypeOther property element not allowed", kXMPErr_BadXMP );
  ------------------
  |  |  199|     67|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1150|       |
 1151|      0|}	// RDF_ParseTypeOtherPropertyElement
ParseRDF.cpp:_ZL27RDF_ResourcePropertyElementP8XMP_NodeRK8XML_Nodeb:
  942|  2.75k|{
  943|  2.75k|	if ( isTopLevel && (xmlNode.name == "iX:changes") ) return;	// Strip old "punchcard" chaff.
  ------------------
  |  Branch (943:7): [True: 2.66k, False: 92]
  |  Branch (943:21): [True: 0, False: 2.66k]
  ------------------
  944|       |	
  945|  2.75k|	XMP_Node * newCompound = AddChildNode ( xmpParent, xmlNode, "", isTopLevel );
  946|       |	
  947|  2.75k|	XML_cNodePos currAttr = xmlNode.attrs.begin();
  948|  2.75k|	XML_cNodePos endAttr  = xmlNode.attrs.end();
  949|       |
  950|  2.77k|	for ( ; currAttr != endAttr; ++currAttr ) {
  ------------------
  |  Branch (950:10): [True: 15, False: 2.75k]
  ------------------
  951|     15|		XMP_VarString & attrName = (*currAttr)->name;
  952|     15|		if ( attrName == "xml:lang" ) {
  ------------------
  |  Branch (952:8): [True: 9, False: 6]
  ------------------
  953|      9|			AddQualifierNode ( newCompound, **currAttr );
  954|      9|		} else if ( attrName == "rdf:ID" ) {
  ------------------
  |  Branch (954:15): [True: 6, False: 0]
  ------------------
  955|      6|			continue;	// Ignore all rdf:ID attributes.
  956|      6|		} else {
  957|      0|			XMP_Throw ( "Invalid attribute for resource property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  958|      0|		}
  959|     15|	}
  960|       |	
  961|  2.75k|	XML_cNodePos currChild = xmlNode.content.begin();
  962|  2.75k|	XML_cNodePos endChild  = xmlNode.content.end();
  963|       |
  964|  8.93k|	for ( ; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (964:10): [True: 8.93k, False: 1]
  ------------------
  965|  8.93k|		if ( ! (*currChild)->IsWhitespaceNode() ) break;
  ------------------
  |  Branch (965:8): [True: 2.75k, False: 6.17k]
  ------------------
  966|  8.93k|	}
  967|  2.75k|	if ( currChild == endChild ) XMP_Throw ( "Missing child of resource property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (967:7): [True: 0, False: 2.75k]
  ------------------
  968|  2.75k|	if ( (*currChild)->kind != kElemNode ) XMP_Throw ( "Children of resource property element must be XML elements", kXMPErr_BadRDF );
  ------------------
  |  |  199|     47|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (968:7): [True: 47, False: 2.71k]
  ------------------
  969|       |
  970|  2.71k|	if ( (*currChild)->name == "rdf:Bag" ) {
  ------------------
  |  Branch (970:7): [True: 95, False: 2.61k]
  ------------------
  971|     95|		newCompound->options |= kXMP_PropValueIsArray;
  972|  2.61k|	} else if ( (*currChild)->name == "rdf:Seq" ) {
  ------------------
  |  Branch (972:14): [True: 1.20k, False: 1.41k]
  ------------------
  973|  1.20k|		newCompound->options |= kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered;
  974|  1.41k|	} else if ( (*currChild)->name == "rdf:Alt" ) {
  ------------------
  |  Branch (974:14): [True: 1.29k, False: 116]
  ------------------
  975|  1.29k|		newCompound->options |= kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate;
  976|  1.29k|	} else {
  977|    116|		newCompound->options |= kXMP_PropValueIsStruct;
  978|    116|		if ( (*currChild)->name != "rdf:Description" ) {
  ------------------
  |  Branch (978:8): [True: 85, False: 31]
  ------------------
  979|     85|			XMP_VarString typeName ( (*currChild)->ns );
  980|     85|			size_t        colonPos = (*currChild)->name.find_first_of(':');
  981|     85|			if ( colonPos == XMP_VarString::npos ) XMP_Throw ( "All XML elements must be in a namespace", kXMPErr_BadXMP );
  ------------------
  |  |  199|     10|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (981:9): [True: 10, False: 75]
  ------------------
  982|     75|			typeName.append ( (*currChild)->name, colonPos, XMP_VarString::npos );
  983|     75|			AddQualifierNode ( newCompound, XMP_VarString("rdf:type"), typeName );
  984|     75|		}
  985|    116|	}
  986|       |
  987|  2.70k|	RDF_NodeElement ( newCompound, **currChild, kNotTopLevel );
  988|  2.70k|	if ( newCompound->options & kRDF_HasValueElem ) {
  ------------------
  |  Branch (988:7): [True: 5, False: 2.69k]
  ------------------
  989|      5|		FixupQualifiedNode ( newCompound );
  990|  2.69k|	} else if ( newCompound->options & kXMP_PropArrayIsAlternate ) {
  ------------------
  |  Branch (990:14): [True: 1.12k, False: 1.56k]
  ------------------
  991|  1.12k|		DetectAltText ( newCompound );
  992|  1.12k|	}
  993|       |
  994|  7.70k|	for ( ++currChild; currChild != endChild; ++currChild ) {
  ------------------
  |  Branch (994:21): [True: 5.03k, False: 2.66k]
  ------------------
  995|  5.03k|		if ( ! (*currChild)->IsWhitespaceNode() ) XMP_Throw ( "Invalid child of resource property element", kXMPErr_BadRDF );
  ------------------
  |  |  199|     31|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (995:8): [True: 31, False: 5.00k]
  ------------------
  996|  5.00k|	}
  997|       |
  998|  2.70k|}	// RDF_ResourcePropertyElement

_Z28InitializeUnicodeConversionsv:
  147|      1|{
  148|      1|	UC_Assert ( (sizeof(UTF8Unit) == 1) && (sizeof(UTF16Unit) == 2) && (sizeof(UTF32Unit) == 4) ); 
  149|       |
  150|      1|	UTF16Unit u16  = 0x00FF;
  151|      1|	bool bigEndian = (*((UTF8Unit*)&u16) == 0);
  152|       |
  153|      1|	UTF8_to_UTF16Native = UTF8_to_UTF16Nat;
  154|      1|	UTF8_to_UTF32Native = UTF8_to_UTF32Nat;
  155|      1|	UTF16Native_to_UTF8 = UTF16Nat_to_UTF8;
  156|      1|	UTF32Native_to_UTF8 = UTF32Nat_to_UTF8;
  157|       |	
  158|      1|	if ( bigEndian ) {
  ------------------
  |  Branch (158:7): [True: 0, False: 1]
  ------------------
  159|       |	
  160|      0|		swap32to16Offset = 0;
  161|       |
  162|      0|		CodePoint_to_UTF16BE = CodePoint_to_UTF16Nat;
  163|      0|		CodePoint_to_UTF16LE = CodePoint_to_UTF16Swp;
  164|       |
  165|      0|		CodePoint_from_UTF16BE = CodePoint_from_UTF16Nat;
  166|      0|		CodePoint_from_UTF16LE = CodePoint_from_UTF16Swp;
  167|       |
  168|      0|		UTF8_to_UTF16BE = UTF8_to_UTF16Nat;
  169|      0|		UTF8_to_UTF16LE = UTF8_to_UTF16Swp;
  170|      0|		UTF8_to_UTF32BE = UTF8_to_UTF32Nat;
  171|      0|		UTF8_to_UTF32LE = UTF8_to_UTF32Swp;
  172|       |
  173|      0|		UTF16BE_to_UTF8 = UTF16Nat_to_UTF8;
  174|      0|		UTF16LE_to_UTF8 = UTF16Swp_to_UTF8;
  175|      0|		UTF32BE_to_UTF8 = UTF32Nat_to_UTF8;
  176|      0|		UTF32LE_to_UTF8 = UTF32Swp_to_UTF8;
  177|       |
  178|      0|		UTF16BE_to_UTF32BE = UTF16Nat_to_UTF32Nat;
  179|      0|		UTF16BE_to_UTF32LE = UTF16Nat_to_UTF32Swp;
  180|      0|		UTF16LE_to_UTF32BE = UTF16Swp_to_UTF32Nat;
  181|      0|		UTF16LE_to_UTF32LE = UTF16Swp_to_UTF32Swp;
  182|       |
  183|      0|		UTF32BE_to_UTF16BE = UTF32Nat_to_UTF16Nat;
  184|      0|		UTF32BE_to_UTF16LE = UTF32Nat_to_UTF16Swp;
  185|      0|		UTF32LE_to_UTF16BE = UTF32Swp_to_UTF16Nat;
  186|      0|		UTF32LE_to_UTF16LE = UTF32Swp_to_UTF16Swp;
  187|       |
  188|      1|	} else {
  189|       |	
  190|      1|		swap32to16Offset = 1;	// ! Offset in UTF16 units!
  191|       |
  192|      1|		CodePoint_to_UTF16BE = CodePoint_to_UTF16Swp;
  193|      1|		CodePoint_to_UTF16LE = CodePoint_to_UTF16Nat;
  194|       |
  195|      1|		CodePoint_from_UTF16BE = CodePoint_from_UTF16Swp;
  196|      1|		CodePoint_from_UTF16LE = CodePoint_from_UTF16Nat;
  197|       |
  198|      1|		UTF8_to_UTF16BE = UTF8_to_UTF16Swp;
  199|      1|		UTF8_to_UTF16LE = UTF8_to_UTF16Nat;
  200|      1|		UTF8_to_UTF32BE = UTF8_to_UTF32Swp;
  201|      1|		UTF8_to_UTF32LE = UTF8_to_UTF32Nat;
  202|       |
  203|      1|		UTF16BE_to_UTF8 = UTF16Swp_to_UTF8;
  204|      1|		UTF16LE_to_UTF8 = UTF16Nat_to_UTF8;
  205|      1|		UTF32BE_to_UTF8 = UTF32Swp_to_UTF8;
  206|      1|		UTF32LE_to_UTF8 = UTF32Nat_to_UTF8;
  207|       |
  208|      1|		UTF16BE_to_UTF32BE = UTF16Swp_to_UTF32Swp;
  209|      1|		UTF16BE_to_UTF32LE = UTF16Swp_to_UTF32Nat;
  210|      1|		UTF16LE_to_UTF32BE = UTF16Nat_to_UTF32Swp;
  211|      1|		UTF16LE_to_UTF32LE = UTF16Nat_to_UTF32Nat;
  212|       |
  213|      1|		UTF32BE_to_UTF16BE = UTF32Swp_to_UTF16Swp;
  214|      1|		UTF32BE_to_UTF16LE = UTF32Swp_to_UTF16Nat;
  215|      1|		UTF32LE_to_UTF16BE = UTF32Nat_to_UTF16Swp;
  216|      1|		UTF32LE_to_UTF16LE = UTF32Nat_to_UTF16Nat;
  217|       |
  218|      1|	}
  219|       |
  220|      1|}	// InitializeUnicodeConversions
_Z19CodePoint_from_UTF8PKhmPjPm:
  567|  43.4k|{
  568|  43.4k|	UTF8Unit inUnit;	// ! Don't read until we know there is input.
  569|  43.4k|	size_t unitCount = 0;
  570|       |
  571|  43.4k|	UC_Assert ( (utf8In != 0) && (cpOut != 0) && (utf8Read != 0) );
  572|  43.4k|	if ( utf8Len == 0 ) goto Done;
  ------------------
  |  Branch (572:7): [True: 0, False: 43.4k]
  ------------------
  573|  43.4k|	inUnit = *utf8In;
  574|  43.4k|	if ( inUnit >= 0x80 ) goto MultiByte;	// ! Force linear execution path for ASCII.
  ------------------
  |  Branch (574:7): [True: 43.4k, False: 0]
  ------------------
  575|       |	
  576|      0|	unitCount = 1;
  577|      0|	*cpOut = inUnit;	// ! Don't put after Done, don't write if no input.
  578|       |	
  579|      0|Done:	
  580|      0|	*utf8Read = unitCount;
  581|      0|	return;
  582|       |
  583|  43.4k|MultiByte:
  584|  43.4k|	CodePoint_from_UTF8_Multi ( utf8In, utf8Len, cpOut, utf8Read );
  585|  43.4k|	return;
  586|       |	
  587|      0|}	// CodePoint_from_UTF8
UnicodeConversions.cpp:_ZL25CodePoint_from_UTF8_MultiPKhmPjPm:
  516|  43.4k|{
  517|  43.4k|	UTF8Unit  inUnit = *utf8In;
  518|  43.4k|	size_t    unitCount = 0;
  519|  43.4k|	UTF32Unit cp;	// ! Avoid gcc complaints about declarations after goto's.
  520|  43.4k|	const UTF8Unit * utf8Pos;
  521|       |
  522|       |	// -------------------------------------------------------------------------------------
  523|       |	// We've got a multibyte UTF-8 character. The first byte has the number of bytes and the
  524|       |	// highest order data bits. The other bytes each add 6 more data bits.
  525|       |	
  526|       |	#if 0	// This might be a more effcient way to count the bytes.
  527|       |		static XMP_Uns8 kByteCounts[16] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 3, 4 };
  528|       |		size_t bytesNeeded = kByteCounts [ inUnit >> 4 ];
  529|       |		if ( (bytesNeeded < 2) || ((bytesNeeded == 4) && ((inUnit & 0x08) != 0)) ) {
  530|       |			UC_Throw ( "Invalid UTF-8 sequence length", kXMPErr_BadParam );
  531|       |		}
  532|       |	#endif
  533|       |
  534|  43.4k|	size_t bytesNeeded = 0;	// Count the leading 1 bits in the first byte.
  535|   131k|	for ( UTF8Unit temp = inUnit; temp > 0x7F; temp = temp << 1 ) ++bytesNeeded;
  ------------------
  |  Branch (535:32): [True: 88.2k, False: 43.4k]
  ------------------
  536|       |		// *** Consider CPU-specific assembly inline, e.g. cntlzw on PowerPC.
  537|       |	
  538|  43.4k|	if ( (bytesNeeded < 2) || (bytesNeeded > 4) ) UC_Throw ( "Invalid UTF-8 sequence length", kXMPErr_BadParam );
  ------------------
  |  |   18|     21|	#define UC_Throw(msg,id)  throw XMP_Error ( id, msg )
  ------------------
  |  Branch (538:7): [True: 11, False: 43.4k]
  |  Branch (538:28): [True: 10, False: 43.4k]
  ------------------
  539|  43.4k|	if ( bytesNeeded > utf8Len ) goto Done;	// Not enough input in this buffer.
  ------------------
  |  Branch (539:7): [True: 0, False: 43.4k]
  ------------------
  540|  43.4k|	unitCount = bytesNeeded;
  541|       |	
  542|  43.4k|	cp = inUnit & ((1 << (7-unitCount)) - 1);	// Isolate the initial data bits in the bottom of cp.
  543|       |	
  544|  43.4k|	utf8Pos = utf8In + 1;	// We've absorbed the first byte.
  545|  88.1k|	for ( --bytesNeeded; bytesNeeded > 0; --bytesNeeded, ++utf8Pos ) {
  ------------------
  |  Branch (545:23): [True: 44.7k, False: 43.3k]
  ------------------
  546|  44.7k|		inUnit = *utf8Pos;
  547|  44.7k|		if ( (inUnit & UTF8Unit(0xC0)) != UTF8Unit(0x80) ) UC_Throw ( "Invalid UTF-8 data byte", kXMPErr_BadParam );
  ------------------
  |  |   18|      7|	#define UC_Throw(msg,id)  throw XMP_Error ( id, msg )
  ------------------
  |  Branch (547:8): [True: 7, False: 44.7k]
  ------------------
  548|  44.7k|		cp = (cp << 6) | (inUnit & 0x3F);
  549|  44.7k|	}
  550|       |	
  551|  43.3k|	if ( cp >= 0xD800 ) {	// Skip the next comparisons most of the time.
  ------------------
  |  Branch (551:7): [True: 344, False: 43.0k]
  ------------------
  552|    344|		if ( (0xD800 <= cp) && (cp <= 0xDFFF) ) UC_Throw ( "Bad UTF-8 - surrogate code point", kXMPErr_BadParam );
  ------------------
  |  |   18|      1|	#define UC_Throw(msg,id)  throw XMP_Error ( id, msg )
  ------------------
  |  Branch (552:8): [True: 344, False: 0]
  |  Branch (552:26): [True: 1, False: 343]
  ------------------
  553|    343|		if ( cp > 0x10FFFF ) UC_Throw ( "Bad UTF-8 - out of range", kXMPErr_BadParam );
  ------------------
  |  |   18|      0|	#define UC_Throw(msg,id)  throw XMP_Error ( id, msg )
  ------------------
  |  Branch (553:8): [True: 0, False: 343]
  ------------------
  554|    343|	}
  555|       |	
  556|  43.3k|	*cpOut = cp;	// ! Don't put after Done, don't write if no input.
  557|       |	
  558|  43.3k|Done:	
  559|  43.3k|	*utf8Read = unitCount;
  560|  43.3k|	return;
  561|       |	
  562|  43.3k|}	// CodePoint_from_UTF8_Multi

XMPCore_Impl.cpp:_ZL19VerifySimpleXMLNamePKcS0_:
   87|   592k|{
   88|       |
   89|   592k|	const XMP_Uns8 * nameStart = (const XMP_Uns8 *) _nameStart;
   90|   592k|	const XMP_Uns8 * nameEnd   = (const XMP_Uns8 *) _nameEnd;
   91|   592k|	const XMP_Uns8 * namePos   = nameStart;
   92|   592k|	XMP_Uns32 cp;
   93|       |	
   94|       |	// The first character is more restricted.
   95|       |	
   96|   592k|	if ( nameStart >= nameEnd ) XMP_Throw ( "Empty XML name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (96:7): [True: 0, False: 592k]
  ------------------
   97|       |
   98|   592k|	cp = *namePos;
   99|   592k|	if ( cp < 0x80 ) {
  ------------------
  |  Branch (99:7): [True: 592k, False: 222]
  ------------------
  100|   592k|		++namePos;
  101|   592k|		if ( ! IsStartChar_ASCII(cp) ) goto NameError;
  ------------------
  |  Branch (101:8): [True: 0, False: 592k]
  ------------------
  102|   592k|	} else {
  103|    222|		cp = GetCodePoint ( &namePos );
  104|    222|		if ( ! IsStartChar_NonASCII(cp) ) goto NameError;
  ------------------
  |  Branch (104:8): [True: 0, False: 222]
  ------------------
  105|    222|	}
  106|       |
  107|       |	// Check the rest of the name.
  108|       |	
  109|  59.2M|	while ( namePos < nameEnd ) {
  ------------------
  |  Branch (109:10): [True: 58.6M, False: 592k]
  ------------------
  110|  58.6M|		cp = *namePos;
  111|  58.6M|		if ( cp < 0x80 ) {
  ------------------
  |  Branch (111:8): [True: 58.5M, False: 22.2k]
  ------------------
  112|  58.5M|			++namePos;
  113|  58.5M|			if ( (! IsStartChar_ASCII(cp)) && (! IsOtherChar_ASCII(cp)) ) goto NameError;
  ------------------
  |  Branch (113:9): [True: 277k, False: 58.3M]
  |  Branch (113:38): [True: 0, False: 277k]
  ------------------
  114|  58.5M|		} else {
  115|  22.2k|			cp = GetCodePoint ( &namePos );
  116|  22.2k|			if ( (! IsStartChar_NonASCII(cp)) && (! IsOtherChar_NonASCII(cp)) ) goto NameError;
  ------------------
  |  Branch (116:9): [True: 10.5k, False: 11.6k]
  |  Branch (116:41): [True: 0, False: 10.5k]
  ------------------
  117|  22.2k|		}
  118|  58.6M|	}
  119|       |
  120|   592k|	return;
  121|       |
  122|   592k|NameError:
  123|      0|	XMP_Throw ( "Bad XML name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  124|       |	
  125|      0|}	// VerifySimpleXMLName
XMPCore_Impl.cpp:_ZL17IsStartChar_ASCIIj:
   31|  59.1M|{
   32|       |	// ASCII starting characters for an XML name.
   33|  59.1M|	if ( (('a' <= cp) && (cp <= 'z')) || (('A' <= cp) && (cp <= 'Z')) || (cp == '_') ) return true;
  ------------------
  |  Branch (33:8): [True: 33.6M, False: 25.5M]
  |  Branch (33:23): [True: 33.6M, False: 0]
  |  Branch (33:40): [True: 25.2M, False: 277k]
  |  Branch (33:55): [True: 25.2M, False: 31.8k]
  |  Branch (33:71): [True: 31.8k, False: 277k]
  ------------------
   34|   277k|	return false;
   35|  59.1M|}
XMPCore_Impl.cpp:_ZL12GetCodePointPPKh:
   19|  22.4k|{
   20|  22.4k|	const XMP_Uns8 * u8Ptr = *utf8Str_io;
   21|  22.4k|	XMP_Uns32 cp;
   22|  22.4k|	size_t u8Len;
   23|  22.4k|	CodePoint_from_UTF8 ( u8Ptr, 4, &cp, &u8Len );	// Throws an exception for errors.
   24|  22.4k|	*utf8Str_io = u8Ptr + u8Len;
   25|  22.4k|	return cp;
   26|  22.4k|}
XMPCore_Impl.cpp:_ZL20IsStartChar_NonASCIIj:
   40|  22.4k|{
   41|       |	// Non-ASCII starting characters for an XML name.
   42|       |	
   43|  22.4k|	if ( ((0xC0 <= cp) && (cp <= 0xD6))  || ((0xD8 <= cp) && (cp <= 0xF6)) ) return true;
  ------------------
  |  Branch (43:8): [True: 12.3k, False: 10.1k]
  |  Branch (43:24): [True: 319, False: 12.0k]
  |  Branch (43:43): [True: 12.0k, False: 10.1k]
  |  Branch (43:59): [True: 5.83k, False: 6.16k]
  ------------------
   44|  16.2k|	if ( ((0xF8 <= cp) && (cp <= 0x2FF)) || ((0x370 <= cp) && (cp <= 0x37D)) ) return true;
  ------------------
  |  Branch (44:8): [True: 6.16k, False: 10.1k]
  |  Branch (44:24): [True: 3.08k, False: 3.08k]
  |  Branch (44:43): [True: 2.63k, False: 10.5k]
  |  Branch (44:60): [True: 0, False: 2.63k]
  ------------------
   45|       |
   46|  13.2k|	if ( ((0x37F <= cp) && (cp <= 0x1FFF))  || ((0x200C <= cp) && (cp <= 0x200D)) ) return true;
  ------------------
  |  Branch (46:8): [True: 2.63k, False: 10.5k]
  |  Branch (46:25): [True: 2.12k, False: 511]
  |  Branch (46:46): [True: 511, False: 10.5k]
  |  Branch (46:64): [True: 0, False: 511]
  ------------------
   47|  11.0k|	if ( ((0x2070 <= cp) && (cp <= 0x218F)) || ((0x2C00 <= cp) && (cp <= 0x2FEF)) ) return true;
  ------------------
  |  Branch (47:8): [True: 511, False: 10.5k]
  |  Branch (47:26): [True: 0, False: 511]
  |  Branch (47:46): [True: 511, False: 10.5k]
  |  Branch (47:64): [True: 0, False: 511]
  ------------------
   48|  11.0k|	if ( ((0x3001 <= cp) && (cp <= 0xD7FF)) || ((0xF900 <= cp) && (cp <= 0xFDCF)) ) return true;
  ------------------
  |  Branch (48:8): [True: 511, False: 10.5k]
  |  Branch (48:26): [True: 511, False: 0]
  |  Branch (48:46): [True: 0, False: 10.5k]
  |  Branch (48:64): [True: 0, False: 0]
  ------------------
   49|  10.5k|	if ( ((0xFDF0 <= cp) && (cp <= 0xFFFD)) || ((0x10000 <= cp) && (cp <= 0xEFFFF)) ) return true;
  ------------------
  |  Branch (49:8): [True: 0, False: 10.5k]
  |  Branch (49:26): [True: 0, False: 0]
  |  Branch (49:46): [True: 0, False: 10.5k]
  |  Branch (49:65): [True: 0, False: 0]
  ------------------
   50|       |
   51|  10.5k|	return false;
   52|       |
   53|  10.5k|}
XMPCore_Impl.cpp:_ZL17IsOtherChar_ASCIIj:
   58|   277k|{
   59|       |	// ASCII following characters for an XML name.
   60|   277k|	if ( (('0' <= cp) && (cp <= '9')) || (cp == '-') || (cp == '.') ) return true;
  ------------------
  |  Branch (60:8): [True: 198k, False: 78.8k]
  |  Branch (60:23): [True: 198k, False: 0]
  |  Branch (60:39): [True: 36.9k, False: 41.8k]
  |  Branch (60:54): [True: 41.8k, False: 0]
  ------------------
   61|      0|	return false;
   62|   277k|}
XMPCore_Impl.cpp:_ZL20IsOtherChar_NonASCIIj:
   67|  10.5k|{
   68|       |	// Non-ASCII following characters for an XML name.
   69|  10.5k|	if ( (cp == 0xB7) || ((0x300 <= cp) && (cp <= 0x36F))  || ((0x203F <= cp) && (cp <= 0x2040)) ) return true;
  ------------------
  |  Branch (69:7): [True: 10.1k, False: 445]
  |  Branch (69:24): [True: 445, False: 0]
  |  Branch (69:41): [True: 445, False: 0]
  |  Branch (69:61): [True: 0, False: 0]
  |  Branch (69:79): [True: 0, False: 0]
  ------------------
   70|      0|	return false;
   71|  10.5k|}
XMPMeta-GetSet.cpp:_ZL12GetCodePointPPKh:
   19|  6.41k|{
   20|  6.41k|	const XMP_Uns8 * u8Ptr = *utf8Str_io;
   21|  6.41k|	XMP_Uns32 cp;
   22|  6.41k|	size_t u8Len;
   23|  6.41k|	CodePoint_from_UTF8 ( u8Ptr, 4, &cp, &u8Len );	// Throws an exception for errors.
   24|  6.41k|	*utf8Str_io = u8Ptr + u8Len;
   25|  6.41k|	return cp;
   26|  6.41k|}
XMPMeta.cpp:_ZL19VerifySimpleXMLNamePKcS0_:
   87|  25.7k|{
   88|       |
   89|  25.7k|	const XMP_Uns8 * nameStart = (const XMP_Uns8 *) _nameStart;
   90|  25.7k|	const XMP_Uns8 * nameEnd   = (const XMP_Uns8 *) _nameEnd;
   91|  25.7k|	const XMP_Uns8 * namePos   = nameStart;
   92|  25.7k|	XMP_Uns32 cp;
   93|       |	
   94|       |	// The first character is more restricted.
   95|       |	
   96|  25.7k|	if ( nameStart >= nameEnd ) XMP_Throw ( "Empty XML name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (96:7): [True: 0, False: 25.7k]
  ------------------
   97|       |
   98|  25.7k|	cp = *namePos;
   99|  25.7k|	if ( cp < 0x80 ) {
  ------------------
  |  Branch (99:7): [True: 25.6k, False: 128]
  ------------------
  100|  25.6k|		++namePos;
  101|  25.6k|		if ( ! IsStartChar_ASCII(cp) ) goto NameError;
  ------------------
  |  Branch (101:8): [True: 0, False: 25.6k]
  ------------------
  102|  25.6k|	} else {
  103|    128|		cp = GetCodePoint ( &namePos );
  104|    128|		if ( ! IsStartChar_NonASCII(cp) ) goto NameError;
  ------------------
  |  Branch (104:8): [True: 0, False: 128]
  ------------------
  105|    128|	}
  106|       |
  107|       |	// Check the rest of the name.
  108|       |	
  109|  7.74M|	while ( namePos < nameEnd ) {
  ------------------
  |  Branch (109:10): [True: 7.71M, False: 25.7k]
  ------------------
  110|  7.71M|		cp = *namePos;
  111|  7.71M|		if ( cp < 0x80 ) {
  ------------------
  |  Branch (111:8): [True: 7.70M, False: 14.4k]
  ------------------
  112|  7.70M|			++namePos;
  113|  7.70M|			if ( (! IsStartChar_ASCII(cp)) && (! IsOtherChar_ASCII(cp)) ) goto NameError;
  ------------------
  |  Branch (113:9): [True: 90.4k, False: 7.61M]
  |  Branch (113:38): [True: 0, False: 90.4k]
  ------------------
  114|  7.70M|		} else {
  115|  14.4k|			cp = GetCodePoint ( &namePos );
  116|  14.4k|			if ( (! IsStartChar_NonASCII(cp)) && (! IsOtherChar_NonASCII(cp)) ) goto NameError;
  ------------------
  |  Branch (116:9): [True: 9.79k, False: 4.63k]
  |  Branch (116:41): [True: 0, False: 9.79k]
  ------------------
  117|  14.4k|		}
  118|  7.71M|	}
  119|       |
  120|  25.7k|	return;
  121|       |
  122|  25.7k|NameError:
  123|      0|	XMP_Throw ( "Bad XML name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  124|       |	
  125|      0|}	// VerifySimpleXMLName
XMPMeta.cpp:_ZL17IsStartChar_ASCIIj:
   31|  7.72M|{
   32|       |	// ASCII starting characters for an XML name.
   33|  7.72M|	if ( (('a' <= cp) && (cp <= 'z')) || (('A' <= cp) && (cp <= 'Z')) || (cp == '_') ) return true;
  ------------------
  |  Branch (33:8): [True: 7.31M, False: 416k]
  |  Branch (33:23): [True: 7.31M, False: 0]
  |  Branch (33:40): [True: 325k, False: 90.4k]
  |  Branch (33:55): [True: 315k, False: 9.99k]
  |  Branch (33:71): [True: 9.99k, False: 90.4k]
  ------------------
   34|  90.4k|	return false;
   35|  7.72M|}
XMPMeta.cpp:_ZL12GetCodePointPPKh:
   19|  14.5k|{
   20|  14.5k|	const XMP_Uns8 * u8Ptr = *utf8Str_io;
   21|  14.5k|	XMP_Uns32 cp;
   22|  14.5k|	size_t u8Len;
   23|  14.5k|	CodePoint_from_UTF8 ( u8Ptr, 4, &cp, &u8Len );	// Throws an exception for errors.
   24|  14.5k|	*utf8Str_io = u8Ptr + u8Len;
   25|  14.5k|	return cp;
   26|  14.5k|}
XMPMeta.cpp:_ZL20IsStartChar_NonASCIIj:
   40|  14.5k|{
   41|       |	// Non-ASCII starting characters for an XML name.
   42|       |	
   43|  14.5k|	if ( ((0xC0 <= cp) && (cp <= 0xD6))  || ((0xD8 <= cp) && (cp <= 0xF6)) ) return true;
  ------------------
  |  Branch (43:8): [True: 4.87k, False: 9.67k]
  |  Branch (43:24): [True: 182, False: 4.69k]
  |  Branch (43:43): [True: 4.69k, False: 9.67k]
  |  Branch (43:59): [True: 60, False: 4.63k]
  ------------------
   44|  14.3k|	if ( ((0xF8 <= cp) && (cp <= 0x2FF)) || ((0x370 <= cp) && (cp <= 0x37D)) ) return true;
  ------------------
  |  Branch (44:8): [True: 4.63k, False: 9.67k]
  |  Branch (44:24): [True: 2.67k, False: 1.96k]
  |  Branch (44:43): [True: 1.85k, False: 9.79k]
  |  Branch (44:60): [True: 0, False: 1.85k]
  ------------------
   45|       |
   46|  11.6k|	if ( ((0x37F <= cp) && (cp <= 0x1FFF))  || ((0x200C <= cp) && (cp <= 0x200D)) ) return true;
  ------------------
  |  Branch (46:8): [True: 1.85k, False: 9.79k]
  |  Branch (46:25): [True: 1.75k, False: 97]
  |  Branch (46:46): [True: 97, False: 9.79k]
  |  Branch (46:64): [True: 0, False: 97]
  ------------------
   47|  9.88k|	if ( ((0x2070 <= cp) && (cp <= 0x218F)) || ((0x2C00 <= cp) && (cp <= 0x2FEF)) ) return true;
  ------------------
  |  Branch (47:8): [True: 97, False: 9.79k]
  |  Branch (47:26): [True: 0, False: 97]
  |  Branch (47:46): [True: 97, False: 9.79k]
  |  Branch (47:64): [True: 0, False: 97]
  ------------------
   48|  9.88k|	if ( ((0x3001 <= cp) && (cp <= 0xD7FF)) || ((0xF900 <= cp) && (cp <= 0xFDCF)) ) return true;
  ------------------
  |  Branch (48:8): [True: 97, False: 9.79k]
  |  Branch (48:26): [True: 97, False: 0]
  |  Branch (48:46): [True: 0, False: 9.79k]
  |  Branch (48:64): [True: 0, False: 0]
  ------------------
   49|  9.79k|	if ( ((0xFDF0 <= cp) && (cp <= 0xFFFD)) || ((0x10000 <= cp) && (cp <= 0xEFFFF)) ) return true;
  ------------------
  |  Branch (49:8): [True: 0, False: 9.79k]
  |  Branch (49:26): [True: 0, False: 0]
  |  Branch (49:46): [True: 0, False: 9.79k]
  |  Branch (49:65): [True: 0, False: 0]
  ------------------
   50|       |
   51|  9.79k|	return false;
   52|       |
   53|  9.79k|}
XMPMeta.cpp:_ZL17IsOtherChar_ASCIIj:
   58|  90.4k|{
   59|       |	// ASCII following characters for an XML name.
   60|  90.4k|	if ( (('0' <= cp) && (cp <= '9')) || (cp == '-') || (cp == '.') ) return true;
  ------------------
  |  Branch (60:8): [True: 50.0k, False: 40.3k]
  |  Branch (60:23): [True: 50.0k, False: 0]
  |  Branch (60:39): [True: 26.0k, False: 14.2k]
  |  Branch (60:54): [True: 14.2k, False: 0]
  ------------------
   61|      0|	return false;
   62|  90.4k|}
XMPMeta.cpp:_ZL20IsOtherChar_NonASCIIj:
   67|  9.79k|{
   68|       |	// Non-ASCII following characters for an XML name.
   69|  9.79k|	if ( (cp == 0xB7) || ((0x300 <= cp) && (cp <= 0x36F))  || ((0x203F <= cp) && (cp <= 0x2040)) ) return true;
  ------------------
  |  Branch (69:7): [True: 9.67k, False: 115]
  |  Branch (69:24): [True: 115, False: 0]
  |  Branch (69:41): [True: 115, False: 0]
  |  Branch (69:61): [True: 0, False: 0]
  |  Branch (69:79): [True: 0, False: 0]
  ------------------
   70|      0|	return false;
   71|  9.79k|}

WXMPIterator_PropCTor_1:
   40|  4.28k|{
   41|  4.28k|    XMP_ENTER_WRAPPER ( "WXMPIterator_PropCTor_1" )
  ------------------
  |  |  241|  4.28k|	AnnounceEntry ( proc );									\
  |  |  242|  4.28k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  4.28k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  4.28k|	try {													\
  |  |  245|  4.28k|		XMP_AutoMutex mutex;								\
  |  |  246|  4.28k|		wResult->errMessage = 0;
  ------------------
   42|       |
   43|  4.28k|		if ( schemaNS == 0 ) schemaNS = "";
  ------------------
  |  Branch (43:8): [True: 0, False: 4.28k]
  ------------------
   44|  4.28k|		if ( propName == 0 ) propName = "";
  ------------------
  |  Branch (44:8): [True: 0, False: 4.28k]
  ------------------
   45|       |
   46|  4.28k|		const XMPMeta & xmpObj = WtoXMPMeta_Ref ( xmpRef );
  ------------------
  |  |  108|  4.28k|#define WtoXMPMeta_Ref(xmpRef)	*((const XMPMeta *)(xmpRef))
  ------------------
   47|  4.28k|		XMPIterator *   iter   = new XMPIterator ( xmpObj, schemaNS, propName, options );
   48|  4.28k|		++iter->clientRefs;
   49|  4.28k|		XMP_Assert ( iter->clientRefs == 1 );
  ------------------
  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  ------------------
   50|  4.28k|		wResult->ptrResult = XMPIteratorRef ( iter );
   51|       |
   52|  4.28k|    XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  4.28k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  4.28k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  4.28k|	AnnounceExit();
  ------------------
   53|  4.28k|}
WXMPIterator_DecrementRefCount_1:
   96|  4.28k|{
   97|  4.28k|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
   98|  4.28k|	XMP_ENTER_WRAPPER ( "WXMPIterator_DecrementRefCount_1" )
  ------------------
  |  |  241|  4.28k|	AnnounceEntry ( proc );									\
  |  |  242|  4.28k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  4.28k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  4.28k|	try {													\
  |  |  245|  4.28k|		XMP_AutoMutex mutex;								\
  |  |  246|  4.28k|		wResult->errMessage = 0;
  ------------------
   99|       |
  100|  4.28k|		XMPIterator * thiz = (XMPIterator*)iterRef;
  101|       |		
  102|  4.28k|		XMP_Assert ( thiz->clientRefs > 0 );
  ------------------
  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  103|  4.28k|		--thiz->clientRefs;
  104|  4.28k|		if ( thiz->clientRefs <= 0 ) delete ( thiz );
  ------------------
  |  Branch (104:8): [True: 4.28k, False: 0]
  ------------------
  105|       |
  106|  4.28k|	XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|  4.28k|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|  4.28k|	AnnounceExit();
  ------------------
  107|  4.28k|}
WXMPIterator_Next_1:
  136|   148k|{
  137|   148k|    XMP_ENTER_WRAPPER ( "WXMPIterator_Next_1" )
  ------------------
  |  |  241|   148k|	AnnounceEntry ( proc );									\
  |  |  242|   148k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|   148k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|   148k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|   148k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|   148k|	try {													\
  |  |  245|   148k|		XMP_AutoMutex mutex;								\
  |  |  246|   148k|		wResult->errMessage = 0;
  ------------------
  138|       |
  139|   148k|		if ( schemaNS == 0 ) schemaNS = &voidStringPtr;
  ------------------
  |  Branch (139:8): [True: 0, False: 148k]
  ------------------
  140|   148k|		if ( nsSize == 0 ) nsSize = &voidStringLen;
  ------------------
  |  Branch (140:8): [True: 0, False: 148k]
  ------------------
  141|   148k|		if ( propPath == 0 ) propPath = &voidStringPtr;
  ------------------
  |  Branch (141:8): [True: 0, False: 148k]
  ------------------
  142|   148k|		if ( pathSize == 0 ) pathSize = &voidStringLen;
  ------------------
  |  Branch (142:8): [True: 0, False: 148k]
  ------------------
  143|   148k|		if ( propValue == 0 ) propValue = &voidStringPtr;
  ------------------
  |  Branch (143:8): [True: 0, False: 148k]
  ------------------
  144|   148k|		if ( valueSize == 0 ) valueSize = &voidStringLen;
  ------------------
  |  Branch (144:8): [True: 0, False: 148k]
  ------------------
  145|   148k|		if ( propOptions == 0 ) propOptions = &voidOptionBits;
  ------------------
  |  Branch (145:8): [True: 0, False: 148k]
  ------------------
  146|       |
  147|   148k|		XMPIterator * iter = WtoXMPIterator_Ptr ( iterRef );
  ------------------
  |  |  112|   148k|#define WtoXMPIterator_Ptr(iterRef)	(((iterRef) == 0) ? 0 : (XMPIterator *)(iterRef))
  |  |  ------------------
  |  |  |  Branch (112:38): [True: 0, False: 148k]
  |  |  ------------------
  ------------------
  148|   148k|		XMP_Bool found = iter->Next ( schemaNS, nsSize, propPath, pathSize, propValue, valueSize, propOptions );
  149|   148k|		wResult->int32Result = found;
  150|       |
  151|   148k|    XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
  ------------------
  |  |  253|   148k|		if ( keep ) mutex.KeepLock();		\
  |  |  ------------------
  |  |  |  Branch (253:8): [True: 144k, False: 4.03k]
  |  |  ------------------
  |  |  254|   148k|	XMP_CATCH_EXCEPTIONS					\
  |  |  ------------------
  |  |  |  |  265|   148k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|     58|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|     58|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|     58|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|     58|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 58]
  |  |  |  |  ------------------
  |  |  |  |  270|     58|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|     58|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  255|   148k|	AnnounceExit();
  ------------------
  152|   148k|}
WXMPUtils_UnlockIter_1:
  174|   144k|{
  175|   144k|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
  176|   144k|    XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPUtils_UnlockIter_1" )
  ------------------
  |  |  235|   144k|	AnnounceNoLock ( proc );								\
  |  |  236|   144k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|   144k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|   144k|	try {													\
  |  |  238|   144k|		wResult->errMessage = 0;
  ------------------
  177|       |
  178|   144k|		XMPIterator * iter = WtoXMPIterator_Ptr ( iterRef );
  ------------------
  |  |  112|   144k|#define WtoXMPIterator_Ptr(iterRef)	(((iterRef) == 0) ? 0 : (XMPIterator *)(iterRef))
  |  |  ------------------
  |  |  |  Branch (112:38): [True: 0, False: 144k]
  |  |  ------------------
  ------------------
  179|   144k|		iter->UnlockIter ( options );
  180|       |
  181|   144k|    XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|   144k|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|   144k|	AnnounceExit();
  ------------------
  182|   144k|}

WXMPMeta_Initialize_1:
   50|      1|{
   51|      1|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Initialize_1" )
  ------------------
  |  |  235|      1|	AnnounceNoLock ( proc );								\
  |  |  236|      1|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|      1|	try {													\
  |  |  238|      1|		wResult->errMessage = 0;
  ------------------
   52|       |
   53|      1|		bool ok = XMPMeta::Initialize();
   54|      1|		wResult->int32Result = ok;
   55|       |
   56|      1|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|      1|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|      1|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|      1|	AnnounceExit();
  ------------------
   57|      1|}
WXMPMeta_Terminate_1:
   62|      1|{
   63|      1|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
   64|      1|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Terminate_1" )
  ------------------
  |  |  235|      1|	AnnounceNoLock ( proc );								\
  |  |  236|      1|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|      1|	try {													\
  |  |  238|      1|		wResult->errMessage = 0;
  ------------------
   65|       |
   66|      1|		XMPMeta::Terminate();
   67|       |
   68|      1|	XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|      1|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|      1|	AnnounceExit();
  ------------------
   69|      0|}
WXMPMeta_CTor_1:
   77|  5.53k|{
   78|  5.53k|	XMP_ENTER_WRAPPER ( "WXMPMeta_CTor_1" )
  ------------------
  |  |  241|  5.53k|	AnnounceEntry ( proc );									\
  |  |  242|  5.53k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  5.53k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  5.53k|	try {													\
  |  |  245|  5.53k|		XMP_AutoMutex mutex;								\
  |  |  246|  5.53k|		wResult->errMessage = 0;
  ------------------
   79|       |
   80|  5.53k|		XMPMeta * xmpObj = new XMPMeta();
   81|  5.53k|		++xmpObj->clientRefs;
   82|  5.53k|		XMP_Assert ( xmpObj->clientRefs == 1 );
  ------------------
  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  ------------------
   83|  5.53k|		wResult->ptrResult = XMPMetaRef ( xmpObj );
   84|       |
   85|  5.53k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  5.53k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  5.53k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  5.53k|	AnnounceExit();
  ------------------
   86|  5.53k|}
WXMPMeta_DecrementRefCount_1:
  108|  5.53k|{
  109|  5.53k|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
  110|  5.53k|	XMP_ENTER_WRAPPER ( "WXMPMeta_DecrementRefCount_1" )
  ------------------
  |  |  241|  5.53k|	AnnounceEntry ( proc );									\
  |  |  242|  5.53k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  5.53k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  5.53k|	try {													\
  |  |  245|  5.53k|		XMP_AutoMutex mutex;								\
  |  |  246|  5.53k|		wResult->errMessage = 0;
  ------------------
  111|       |
  112|  5.53k|		XMPMeta * thiz = (XMPMeta*)xmpRef;
  113|       |		
  114|  5.53k|		XMP_Assert ( thiz->clientRefs > 0 );
  ------------------
  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  115|  5.53k|		--thiz->clientRefs;
  116|  5.53k|		if ( thiz->clientRefs <= 0 ) delete ( thiz );
  ------------------
  |  Branch (116:8): [True: 5.53k, False: 0]
  ------------------
  117|       |
  118|  5.53k|	XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|  5.53k|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|  5.53k|	AnnounceExit();
  ------------------
  119|  5.53k|}
WXMPMeta_Unlock_1:
  207|  55.0k|{
  208|  55.0k|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
  209|  55.0k|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Unlock_1" )
  ------------------
  |  |  235|  55.0k|	AnnounceNoLock ( proc );								\
  |  |  236|  55.0k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  55.0k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|  55.0k|	try {													\
  |  |  238|  55.0k|		wResult->errMessage = 0;
  ------------------
  210|       |
  211|  55.0k|		XMPMeta::Unlock ( options );
  212|       |
  213|  55.0k|	XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|  55.0k|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|  55.0k|	AnnounceExit();
  ------------------
  214|  55.0k|}
WXMPMeta_RegisterNamespace_1:
  222|    348|{
  223|    348|	XMP_ENTER_WRAPPER ( "WXMPMeta_RegisterNamespace_1" )
  ------------------
  |  |  241|    348|	AnnounceEntry ( proc );									\
  |  |  242|    348|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|    348|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|    348|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|    348|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|    348|	try {													\
  |  |  245|    348|		XMP_AutoMutex mutex;								\
  |  |  246|    348|		wResult->errMessage = 0;
  ------------------
  224|       |
  225|    348|		if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (225:8): [True: 0, False: 348]
  |  Branch (225:31): [True: 0, False: 348]
  ------------------
  226|    348|		if ( (prefix == 0) || (*prefix == 0) ) XMP_Throw ( "Empty prefix", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (226:8): [True: 0, False: 348]
  |  Branch (226:25): [True: 0, False: 348]
  ------------------
  227|       |
  228|    348|		XMPMeta::RegisterNamespace ( namespaceURI, prefix );
  229|       |
  230|    348|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|    348|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|    348|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|    348|	AnnounceExit();
  ------------------
  231|    348|}
WXMPMeta_GetNamespacePrefix_1:
  240|  55.0k|{
  241|  55.0k|	XMP_ENTER_WRAPPER ( "WXMPMeta_GetNamespacePrefix_1" )
  ------------------
  |  |  241|  55.0k|	AnnounceEntry ( proc );									\
  |  |  242|  55.0k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  55.0k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  55.0k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  55.0k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  55.0k|	try {													\
  |  |  245|  55.0k|		XMP_AutoMutex mutex;								\
  |  |  246|  55.0k|		wResult->errMessage = 0;
  ------------------
  242|       |
  243|  55.0k|		if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (243:8): [True: 0, False: 55.0k]
  |  Branch (243:31): [True: 0, False: 55.0k]
  ------------------
  244|       |
  245|  55.0k|		if ( namespacePrefix == 0 ) namespacePrefix = &voidStringPtr;
  ------------------
  |  Branch (245:8): [True: 0, False: 55.0k]
  ------------------
  246|  55.0k|		if ( prefixSize == 0 ) prefixSize = &voidStringLen;
  ------------------
  |  Branch (246:8): [True: 0, False: 55.0k]
  ------------------
  247|       |
  248|  55.0k|		bool found = XMPMeta::GetNamespacePrefix ( namespaceURI, namespacePrefix, prefixSize );
  249|  55.0k|		wResult->int32Result = found;
  250|       |		
  251|  55.0k|	XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
  ------------------
  |  |  253|  55.0k|		if ( keep ) mutex.KeepLock();		\
  |  |  ------------------
  |  |  |  Branch (253:8): [True: 55.0k, False: 7]
  |  |  ------------------
  |  |  254|  55.0k|	XMP_CATCH_EXCEPTIONS					\
  |  |  ------------------
  |  |  |  |  265|  55.0k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  255|  55.0k|	AnnounceExit();
  ------------------
  252|  55.0k|}
WXMPMeta_DeleteNamespace_1:
  280|    326|{
  281|    326|	XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteNamespace_1" )
  ------------------
  |  |  241|    326|	AnnounceEntry ( proc );									\
  |  |  242|    326|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|    326|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|    326|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|    326|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|    326|	try {													\
  |  |  245|    326|		XMP_AutoMutex mutex;								\
  |  |  246|    326|		wResult->errMessage = 0;
  ------------------
  282|       |
  283|    326|		if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (283:8): [True: 0, False: 326]
  |  Branch (283:31): [True: 0, False: 326]
  ------------------
  284|       |
  285|    326|		XMPMeta::DeleteNamespace ( namespaceURI );
  286|       |
  287|    326|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|    326|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|    326|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|    326|	AnnounceExit();
  ------------------
  288|    326|}
WXMPMeta_SetProperty_1:
  522|  92.2k|{
  523|  92.2k|	XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_1" )
  ------------------
  |  |  241|  92.2k|	AnnounceEntry ( proc );									\
  |  |  242|  92.2k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  92.2k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  92.2k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  92.2k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  92.2k|	try {													\
  |  |  245|  92.2k|		XMP_AutoMutex mutex;								\
  |  |  246|  92.2k|		wResult->errMessage = 0;
  ------------------
  524|       |
  525|  92.2k|		if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (525:8): [True: 0, False: 92.2k]
  |  Branch (525:27): [True: 0, False: 92.2k]
  ------------------
  526|  92.2k|		if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (526:8): [True: 0, False: 92.2k]
  |  Branch (526:27): [True: 0, False: 92.2k]
  ------------------
  527|       |
  528|  92.2k|		XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
  ------------------
  |  |  109|  92.2k|#define WtoXMPMeta_Ptr(xmpRef)	(((xmpRef) == 0) ? 0 : (XMPMeta *)(xmpRef))
  |  |  ------------------
  |  |  |  Branch (109:33): [True: 0, False: 92.2k]
  |  |  ------------------
  ------------------
  529|  92.2k|		meta->SetProperty ( schemaNS, propName, propValue, options );
  530|       |		
  531|  92.2k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  92.2k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  92.2k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|     97|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|     97|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|     97|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|     97|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 97]
  |  |  |  |  ------------------
  |  |  |  |  270|     97|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|     97|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  92.2k|	AnnounceExit();
  ------------------
  532|  92.2k|}
WXMPMeta_AppendArrayItem_1:
  566|  2.33k|{
  567|  2.33k|	XMP_ENTER_WRAPPER ( "WXMPMeta_AppendArrayItem_1" )
  ------------------
  |  |  241|  2.33k|	AnnounceEntry ( proc );									\
  |  |  242|  2.33k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  2.33k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  2.33k|	try {													\
  |  |  245|  2.33k|		XMP_AutoMutex mutex;								\
  |  |  246|  2.33k|		wResult->errMessage = 0;
  ------------------
  568|       |
  569|  2.33k|		if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (569:8): [True: 0, False: 2.33k]
  |  Branch (569:27): [True: 0, False: 2.33k]
  ------------------
  570|  2.33k|		if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (570:8): [True: 0, False: 2.33k]
  |  Branch (570:28): [True: 0, False: 2.33k]
  ------------------
  571|       |
  572|  2.33k|		XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
  ------------------
  |  |  109|  2.33k|#define WtoXMPMeta_Ptr(xmpRef)	(((xmpRef) == 0) ? 0 : (XMPMeta *)(xmpRef))
  |  |  ------------------
  |  |  |  Branch (109:33): [True: 0, False: 2.33k]
  |  |  ------------------
  ------------------
  573|  2.33k|		meta->AppendArrayItem ( schemaNS, arrayName, arrayOptions, itemValue, options );
  574|       |		
  575|  2.33k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  2.33k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  2.33k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  2.33k|	AnnounceExit();
  ------------------
  576|  2.33k|}
WXMPMeta_SetQualifier_1:
  614|  2.33k|{
  615|  2.33k|	XMP_ENTER_WRAPPER ( "WXMPMeta_SetQualifier_1" )
  ------------------
  |  |  241|  2.33k|	AnnounceEntry ( proc );									\
  |  |  242|  2.33k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  2.33k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  2.33k|	try {													\
  |  |  245|  2.33k|		XMP_AutoMutex mutex;								\
  |  |  246|  2.33k|		wResult->errMessage = 0;
  ------------------
  616|       |
  617|  2.33k|		if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (617:8): [True: 0, False: 2.33k]
  |  Branch (617:27): [True: 0, False: 2.33k]
  ------------------
  618|  2.33k|		if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (618:8): [True: 0, False: 2.33k]
  |  Branch (618:27): [True: 0, False: 2.33k]
  ------------------
  619|  2.33k|		if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (619:8): [True: 0, False: 2.33k]
  |  Branch (619:25): [True: 0, False: 2.33k]
  ------------------
  620|  2.33k|		if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (620:8): [True: 0, False: 2.33k]
  |  Branch (620:27): [True: 0, False: 2.33k]
  ------------------
  621|       |
  622|  2.33k|		XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
  ------------------
  |  |  109|  2.33k|#define WtoXMPMeta_Ptr(xmpRef)	(((xmpRef) == 0) ? 0 : (XMPMeta *)(xmpRef))
  |  |  ------------------
  |  |  |  Branch (109:33): [True: 0, False: 2.33k]
  |  |  ------------------
  ------------------
  623|  2.33k|		meta->SetQualifier ( schemaNS, propName, qualNS, qualName, qualValue, options );
  624|       |		
  625|  2.33k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  2.33k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  2.33k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  2.33k|	AnnounceExit();
  ------------------
  626|  2.33k|}
WXMPMeta_CountArrayItems_1:
 1168|  2.05k|{
 1169|  2.05k|	XMP_ENTER_WRAPPER ( "WXMPMeta_CountArrayItems_1" )
  ------------------
  |  |  241|  2.05k|	AnnounceEntry ( proc );									\
  |  |  242|  2.05k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  2.05k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  2.05k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  2.05k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  2.05k|	try {													\
  |  |  245|  2.05k|		XMP_AutoMutex mutex;								\
  |  |  246|  2.05k|		wResult->errMessage = 0;
  ------------------
 1170|       |		
 1171|  2.05k|		if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1171:8): [True: 0, False: 2.05k]
  |  Branch (1171:27): [True: 0, False: 2.05k]
  ------------------
 1172|  2.05k|		if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1172:8): [True: 0, False: 2.05k]
  |  Branch (1172:28): [True: 0, False: 2.05k]
  ------------------
 1173|       |
 1174|  2.05k|		const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
  ------------------
  |  |  108|  2.05k|#define WtoXMPMeta_Ref(xmpRef)	*((const XMPMeta *)(xmpRef))
  ------------------
 1175|  2.05k|		XMP_Index count = meta.CountArrayItems ( schemaNS, arrayName );
 1176|  2.05k|		wResult->int32Result = count;
 1177|       |		
 1178|  2.05k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  2.05k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  2.05k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  2.05k|	AnnounceExit();
  ------------------
 1179|  2.05k|}
WXMPMeta_UnlockObject_1:
 1186|  1.69k|{
 1187|  1.69k|	WXMP_Result * wResult = &void_wResult;	// ! Needed to "fool" the EnterWrapper macro.
 1188|  1.69k|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_UnlockObject_1" )
  ------------------
  |  |  235|  1.69k|	AnnounceNoLock ( proc );								\
  |  |  236|  1.69k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  1.69k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|  1.69k|	try {													\
  |  |  238|  1.69k|		wResult->errMessage = 0;
  ------------------
 1189|       |	
 1190|  1.69k|		const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
  ------------------
  |  |  108|  1.69k|#define WtoXMPMeta_Ref(xmpRef)	*((const XMPMeta *)(xmpRef))
  ------------------
 1191|  1.69k|		meta.UnlockObject ( options );
 1192|       |
 1193|  1.69k|	XMP_EXIT_WRAPPER_NO_THROW
  ------------------
  |  |  258|  1.69k|	} catch ( ... )	{							\
  |  |  259|      0|		AnnounceCatch ( "no-throw catch-all" );	\
  |  |  260|      0|		/* Do nothing. */						\
  |  |  261|      0|	}											\
  |  |  262|  1.69k|	AnnounceExit();
  ------------------
 1194|  1.69k|}
WXMPMeta_ParseFromBuffer_1:
 1270|  3.74k|{
 1271|  3.74k|	XMP_ENTER_WRAPPER ( "WXMPMeta_ParseFromBuffer_1" )
  ------------------
  |  |  241|  3.74k|	AnnounceEntry ( proc );									\
  |  |  242|  3.74k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  3.74k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  3.74k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  3.74k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  3.74k|	try {													\
  |  |  245|  3.74k|		XMP_AutoMutex mutex;								\
  |  |  246|  3.74k|		wResult->errMessage = 0;
  ------------------
 1272|       |
 1273|  3.74k|		XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
  ------------------
  |  |  109|  3.74k|#define WtoXMPMeta_Ptr(xmpRef)	(((xmpRef) == 0) ? 0 : (XMPMeta *)(xmpRef))
  |  |  ------------------
  |  |  |  Branch (109:33): [True: 0, False: 3.74k]
  |  |  ------------------
  ------------------
 1274|  3.74k|		meta->ParseFromBuffer ( buffer, bufferSize, options );
 1275|       |		
 1276|  3.74k|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|  3.74k|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|  3.74k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|    963|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|    963|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|    963|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|    963|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 963]
  |  |  |  |  ------------------
  |  |  |  |  270|    963|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|    963|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|  3.74k|	AnnounceExit();
  ------------------
 1277|  3.74k|}
WXMPMeta_SerializeToBuffer_1:
 1291|  1.69k|{
 1292|  1.69k|	XMP_ENTER_WRAPPER ( "WXMPMeta_SerializeToBuffer_1" )
  ------------------
  |  |  241|  1.69k|	AnnounceEntry ( proc );									\
  |  |  242|  1.69k|	XMP_Assert ( sXMP_InitCount > 0 );	                    \
  |  |  ------------------
  |  |  |  |  142|  1.69k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  243|  1.69k|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|  1.69k|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  244|  1.69k|	try {													\
  |  |  245|  1.69k|		XMP_AutoMutex mutex;								\
  |  |  246|  1.69k|		wResult->errMessage = 0;
  ------------------
 1293|       |
 1294|  1.69k|		if ( rdfString == 0 ) rdfString = &voidStringPtr;
  ------------------
  |  Branch (1294:8): [True: 0, False: 1.69k]
  ------------------
 1295|  1.69k|		if ( rdfSize == 0 ) rdfSize = &voidStringLen;
  ------------------
  |  Branch (1295:8): [True: 0, False: 1.69k]
  ------------------
 1296|       |		
 1297|  1.69k|		if ( newline == 0 ) newline = "";
  ------------------
  |  Branch (1297:8): [True: 0, False: 1.69k]
  ------------------
 1298|  1.69k|		if ( indent == 0 ) indent = "";
  ------------------
  |  Branch (1298:8): [True: 0, False: 1.69k]
  ------------------
 1299|       |		
 1300|  1.69k|		const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
  ------------------
  |  |  108|  1.69k|#define WtoXMPMeta_Ref(xmpRef)	*((const XMPMeta *)(xmpRef))
  ------------------
 1301|  1.69k|		meta.SerializeToBuffer ( rdfString, rdfSize, options, padding, newline, indent, baseIndent );
 1302|       |
 1303|  1.69k|	XMP_EXIT_WRAPPER_KEEP_LOCK ( true ) // ! Always keep the lock, a string is always returned!
  ------------------
  |  |  253|  1.69k|		if ( keep ) mutex.KeepLock();		\
  |  |  ------------------
  |  |  |  Branch (253:8): [True: 1.69k, Folded]
  |  |  ------------------
  |  |  254|  1.69k|	XMP_CATCH_EXCEPTIONS					\
  |  |  ------------------
  |  |  |  |  265|  1.69k|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      0|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      0|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      0|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  270|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      0|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  255|  1.69k|	AnnounceExit();
  ------------------
 1304|  1.69k|}

WXMPUtils_ConvertToDate_1:
  339|    290|{
  340|    290|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPUtils_ConvertToDate_1" )
  ------------------
  |  |  235|    290|	AnnounceNoLock ( proc );								\
  |  |  236|    290|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|    290|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|    290|	try {													\
  |  |  238|    290|		wResult->errMessage = 0;
  ------------------
  341|       |
  342|    290|		if ( binValue == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam); // ! Pointer is from the client.
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (342:8): [True: 0, False: 290]
  ------------------
  343|    290|		XMPUtils::ConvertToDate ( strValue, binValue );
  344|       |
  345|    290|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|    290|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|    290|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|    183|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|    183|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|    183|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|    183|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 183]
  |  |  |  |  ------------------
  |  |  |  |  270|    183|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|    183|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|    290|	AnnounceExit();
  ------------------
  346|    290|}
WXMPUtils_ConvertToLocalTime_1:
  395|    107|{
  396|    107|	XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPUtils_ConvertToLocalTime_1" )
  ------------------
  |  |  235|    107|	AnnounceNoLock ( proc );								\
  |  |  236|    107|	XMP_Assert ( (0 <= sLockCount) && (sLockCount <= 1) );	\
  |  |  ------------------
  |  |  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  |  |  ------------------
  |  |  237|    107|	try {													\
  |  |  238|    107|		wResult->errMessage = 0;
  ------------------
  397|       |
  398|    107|		if ( time == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam);
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (398:8): [True: 0, False: 107]
  ------------------
  399|    107|		XMPUtils::ConvertToLocalTime ( time );
  400|       |
  401|    107|	XMP_EXIT_WRAPPER
  ------------------
  |  |  249|    107|	XMP_CATCH_EXCEPTIONS	\
  |  |  ------------------
  |  |  |  |  265|    107|	} catch ( XMP_Error & xmpErr ) {								\
  |  |  |  |  266|      4|		wResult->int32Result = xmpErr.GetID(); 						\
  |  |  |  |  267|      4|		wResult->ptrResult   = (void*)"XMP";						\
  |  |  |  |  268|      4|		wResult->errMessage  = xmpErr.GetErrMsg();					\
  |  |  |  |  269|      4|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (269:8): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  270|      4|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  271|      4|	} catch ( std::exception & stdErr ) {							\
  |  |  |  |  272|      0|		wResult->int32Result = kXMPErr_StdException; 				\
  |  |  |  |  273|      0|		wResult->errMessage  = stdErr.what(); 						\
  |  |  |  |  274|      0|		if ( wResult->errMessage == 0 ) wResult->errMessage = "";	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  275|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  276|      0|	} catch ( ... ) {												\
  |  |  |  |  277|      0|		wResult->int32Result = kXMPErr_UnknownException; 			\
  |  |  |  |  278|      0|		wResult->errMessage  = "Caught unknown exception";			\
  |  |  |  |  279|      0|		AnnounceCatch ( wResult->errMessage );						\
  |  |  |  |  280|      0|	}
  |  |  ------------------
  |  |  250|    107|	AnnounceExit();
  ------------------
  402|    107|}

_ZN8XML_NodeC2EPS_PKch:
   90|   406k|            : kind(_kind), name(_name), nsPrefixLen(0), parent(_parent) {};
_ZN8XML_NodeD2Ev:
   95|   406k|	virtual ~XML_Node() { RemoveAttrs(); RemoveContent(); };
_ZN16XMLParserAdapterC2Ev:
  112|  3.74k|		: tree(0,"",kRootNode), rootNode(0), rootCount(0), charEncoding(XMP_OptionBits(-1)), pendingCount(0)
  113|  3.74k|	{
  114|       |		#if XMP_DebugBuild
  115|       |			parseLog = 0;
  116|       |		#endif
  117|  3.74k|	};
_ZN16XMLParserAdapterD2Ev:
  119|  3.74k|	virtual ~XMLParserAdapter() {};

_ZNK8XML_Node16IsWhitespaceNodeEv:
   39|   184k|{
   40|   184k|	if ( this->kind != kCDataNode ) return false;
  ------------------
  |  Branch (40:7): [True: 55.9k, False: 128k]
  ------------------
   41|       |
   42|   509k|	for ( size_t i = 0; i < this->value.size(); ++i ) {
  ------------------
  |  Branch (42:22): [True: 381k, False: 128k]
  ------------------
   43|   381k|		unsigned char ch = this->value[i];
   44|   381k|		if ( IsWhitespaceChar ( ch ) ) continue;
  ------------------
  |  |   45|   381k|#define IsWhitespaceChar(ch)	( ((ch) == ' ') || ((ch) == 0x09) || ((ch) == 0x0A) || ((ch) == 0x0D) )
  |  |  ------------------
  |  |  |  Branch (45:32): [True: 315k, False: 65.9k]
  |  |  |  Branch (45:49): [True: 681, False: 65.2k]
  |  |  |  Branch (45:67): [True: 64.9k, False: 287]
  |  |  |  Branch (45:85): [True: 27, False: 260]
  |  |  ------------------
  ------------------
   45|       |		// *** Add checks for other whitespace characters.
   46|    260|		return false;	// All the checks failed, this isn't whitespace.
   47|   381k|	}
   48|       |
   49|   128k|	return true;
   50|       |
   51|   128k|}	// XML_Node::IsWhitespaceNode
_ZN8XML_Node11RemoveAttrsEv:
  427|   406k|{
  428|       |
  429|   475k|	for ( size_t i = 0, vLim = this->attrs.size(); i < vLim; ++i ) delete this->attrs[i];
  ------------------
  |  Branch (429:49): [True: 69.2k, False: 406k]
  ------------------
  430|   406k|	this->attrs.clear();
  431|       |
  432|   406k|}	// XML_Node::RemoveAttrs
_ZN8XML_Node13RemoveContentEv:
  439|   406k|{
  440|       |
  441|   739k|	for ( size_t i = 0, vLim = this->content.size(); i < vLim; ++i ) delete this->content[i];
  ------------------
  |  Branch (441:51): [True: 333k, False: 406k]
  ------------------
  442|   406k|	this->content.clear();
  443|       |
  444|   406k|}	// XML_Node::RemoveContent

_Z13XMP_InitMutexP15pthread_mutex_t:
  114|      1|	bool XMP_InitMutex ( XMP_Mutex * mutex ) {
  115|      1|		int err = pthread_mutex_init ( mutex, 0 );
  116|      1|		return (err == 0 );
  117|      1|	}
_Z13XMP_TermMutexR15pthread_mutex_t:
  119|      1|	void XMP_TermMutex ( XMP_Mutex & mutex ) {
  120|      1|		(void) pthread_mutex_destroy ( &mutex );
  121|      1|	}
_Z23XMP_EnterCriticalRegionR15pthread_mutex_t:
  123|   328k|	void XMP_EnterCriticalRegion ( XMP_Mutex & mutex ) {
  124|   328k|		int err = pthread_mutex_lock ( &mutex );
  125|   328k|		if ( err != 0 ) XMP_Throw ( "XMP_EnterCriticalRegion - pthread_mutex_lock failure", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (125:8): [True: 0, False: 328k]
  ------------------
  126|   328k|	}
_Z22XMP_ExitCriticalRegionR15pthread_mutex_t:
  128|   328k|	void XMP_ExitCriticalRegion ( XMP_Mutex & mutex ) {
  129|   328k|		int err = pthread_mutex_unlock ( &mutex );
  130|   328k|		if ( err != 0 ) XMP_Throw ( "XMP_ExitCriticalRegion - pthread_mutex_unlock failure", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (130:8): [True: 0, False: 328k]
  ------------------
  131|   328k|	}
_Z16VerifySetOptionsjPKc:
  563|  99.5k|{
  564|       |
  565|  99.5k|	if ( options & kXMP_PropArrayIsAltText )   options |= kXMP_PropArrayIsAlternate;
  ------------------
  |  Branch (565:7): [True: 111, False: 99.3k]
  ------------------
  566|  99.5k|	if ( options & kXMP_PropArrayIsAlternate ) options |= kXMP_PropArrayIsOrdered;
  ------------------
  |  Branch (566:7): [True: 2.62k, False: 96.8k]
  ------------------
  567|  99.5k|	if ( options & kXMP_PropArrayIsOrdered )   options |= kXMP_PropValueIsArray;
  ------------------
  |  Branch (567:7): [True: 3.50k, False: 95.9k]
  ------------------
  568|       |	
  569|  99.5k|	if ( options & ~kXMP_AllSetOptionsMask ) {
  ------------------
  |  Branch (569:7): [True: 0, False: 99.5k]
  ------------------
  570|      0|		XMP_Throw ( "Unrecognized option flags", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  571|      0|	}
  572|       |	
  573|  99.5k|	if ( (options & kXMP_PropValueIsStruct) && (options & kXMP_PropValueIsArray) ) {
  ------------------
  |  Branch (573:7): [True: 4.56k, False: 94.9k]
  |  Branch (573:45): [True: 0, False: 4.56k]
  ------------------
  574|      0|		XMP_Throw ( "IsStruct and IsArray options are mutually exclusive", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  575|      0|	}
  576|       |	
  577|  99.5k|	if ( (options & kXMP_PropValueOptionsMask) && (options & kXMP_PropCompositeMask) ) {
  ------------------
  |  Branch (577:7): [True: 0, False: 99.5k]
  |  Branch (577:48): [True: 0, False: 0]
  ------------------
  578|      0|		XMP_Throw ( "Structs and arrays can't have \"value\" options", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  579|      0|	}
  580|       |	
  581|  99.5k|	if ( (propValue != 0) && (options & kXMP_PropCompositeMask) ) {
  ------------------
  |  Branch (581:7): [True: 90.0k, False: 9.49k]
  |  Branch (581:27): [True: 0, False: 90.0k]
  ------------------
  582|      0|		XMP_Throw ( "Structs and arrays can't have string values", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  583|      0|	}
  584|       |
  585|  99.5k|	return options;
  586|       |
  587|  99.5k|}	// VerifySetOptions
_Z11ExpandXPathPKcS0_PNSt3__16vectorI13XPathStepInfoNS1_9allocatorIS3_EEEE:
  662|   246k|{
  663|   246k|	XMP_Assert ( (schemaNS != 0) && (propPath != 0) && (*propPath != 0) && (expandedXPath != 0) );
  ------------------
  |  |  142|   246k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  664|       |	
  665|   246k|	XMP_StringPtr	stepBegin, stepEnd;
  666|   246k|	XMP_StringPtr	qualName, nameEnd;
  667|   246k|	XMP_VarString	currStep;
  668|       |		
  669|   246k|	qualName = nameEnd = NULL;
  670|   246k|	size_t resCount = 2;	// Guess at the number of steps. At least 2, plus 1 for each '/' or '['.
  671|  60.8M|	for ( stepEnd = propPath; *stepEnd != 0; ++stepEnd ) {
  ------------------
  |  Branch (671:28): [True: 60.6M, False: 246k]
  ------------------
  672|  60.6M|		if ( (*stepEnd == '/') || (*stepEnd == '[') ) ++resCount;
  ------------------
  |  Branch (672:8): [True: 102k, False: 60.5M]
  |  Branch (672:29): [True: 211k, False: 60.2M]
  ------------------
  673|  60.6M|	}
  674|       |	
  675|   246k|	expandedXPath->clear();
  676|   246k|	expandedXPath->reserve ( resCount );
  677|       |	
  678|       |	// -------------------------------------------------------------------------------------------
  679|       |	// Pull out the first component and do some special processing on it: add the schema namespace
  680|       |	// prefix and see if it is an alias. The start must be a qualName.
  681|       |	
  682|   246k|	stepBegin = propPath;
  683|   246k|	stepEnd = stepBegin;
  684|  45.9M|	while ( (*stepEnd != 0) && (*stepEnd != '/') && (*stepEnd != '[') && (*stepEnd != '*') ) ++stepEnd;
  ------------------
  |  Branch (684:10): [True: 45.9M, False: 30.7k]
  |  Branch (684:29): [True: 45.9M, False: 4.25k]
  |  Branch (684:50): [True: 45.6M, False: 211k]
  |  Branch (684:71): [True: 45.6M, False: 0]
  ------------------
  685|   246k|	if ( stepEnd == stepBegin ) XMP_Throw ( "Empty initial XPath step", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (685:7): [True: 0, False: 246k]
  ------------------
  686|   246k|	currStep.assign ( stepBegin, (stepEnd - stepBegin) );
  687|       |	
  688|   246k|	VerifyXPathRoot ( schemaNS, currStep.c_str(), expandedXPath );
  689|       |
  690|   246k|	XMP_OptionBits stepFlags = kXMP_StructFieldStep;	
  691|   246k|	if ( sRegisteredAliasMap->find ( (*expandedXPath)[kRootPropStep].step ) != sRegisteredAliasMap->end() ) {
  ------------------
  |  Branch (691:7): [True: 0, False: 246k]
  ------------------
  692|      0|		stepFlags |= kXMP_StepIsAlias;
  693|      0|	}
  694|   246k|	(*expandedXPath)[kRootPropStep].options |= stepFlags;
  695|       |		
  696|       |	// -----------------------------------------------------
  697|       |	// Now continue to process the rest of the XPath string.
  698|       |
  699|   560k|	while ( *stepEnd != 0 ) {
  ------------------
  |  Branch (699:10): [True: 314k, False: 246k]
  ------------------
  700|       |
  701|   314k|		stepBegin = stepEnd;
  702|   314k|		if ( *stepBegin == '/' ) ++stepBegin;
  ------------------
  |  Branch (702:8): [True: 102k, False: 211k]
  ------------------
  703|   314k|		if ( *stepBegin == '*' ) {
  ------------------
  |  Branch (703:8): [True: 0, False: 314k]
  ------------------
  704|      0|			++stepBegin;
  705|      0|			if ( *stepBegin != '[' ) XMP_Throw ( "Missing '[' after '*'", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (705:9): [True: 0, False: 0]
  ------------------
  706|      0|		}
  707|   314k|		stepEnd = stepBegin;
  708|       |
  709|   314k|		if ( *stepBegin != '[' ) {
  ------------------
  |  Branch (709:8): [True: 102k, False: 211k]
  ------------------
  710|       |		
  711|       |			// A struct field or qualifier.
  712|   102k|			qualName = stepBegin;
  713|  13.9M|			while ( (*stepEnd != 0) && (*stepEnd != '/') && (*stepEnd != '[') && (*stepEnd != '*') ) ++stepEnd;
  ------------------
  |  Branch (713:12): [True: 13.8M, False: 101k]
  |  Branch (713:31): [True: 13.8M, False: 467]
  |  Branch (713:52): [True: 13.8M, False: 542]
  |  Branch (713:73): [True: 13.8M, False: 0]
  ------------------
  714|   102k|			nameEnd = stepEnd;
  715|   102k|			stepFlags = kXMP_StructFieldStep;	// ! Touch up later, also changing '@' to '?'.
  716|       |			
  717|   211k|		} else {
  718|       |		
  719|       |			// One of the array forms.
  720|       |		
  721|   211k|			++stepEnd;	// Look at the character after the leading '['.
  722|       |			
  723|   211k|			if ( ('0' <= *stepEnd) && (*stepEnd <= '9') ) {
  ------------------
  |  Branch (723:9): [True: 211k, False: 0]
  |  Branch (723:30): [True: 211k, False: 0]
  ------------------
  724|       |
  725|       |				// A numeric (decimal integer) array index.
  726|   745k|				while ( (*stepEnd != 0) && ('0' <= *stepEnd) && (*stepEnd <= '9') ) ++stepEnd;
  ------------------
  |  Branch (726:13): [True: 745k, False: 0]
  |  Branch (726:32): [True: 745k, False: 0]
  |  Branch (726:53): [True: 534k, False: 211k]
  ------------------
  727|   211k|				if ( *stepEnd != ']' ) XMP_Throw ( "Missing ']' for integer array index", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (727:10): [True: 0, False: 211k]
  ------------------
  728|   211k|				stepFlags = kXMP_ArrayIndexStep;
  729|       |
  730|   211k|			} else {
  731|       |
  732|       |				// Could be "[last()]" or one of the selector forms. Find the ']' or '='.
  733|       |				
  734|      0|				while ( (*stepEnd != 0) && (*stepEnd != ']') && (*stepEnd != '=') ) ++stepEnd;
  ------------------
  |  Branch (734:13): [True: 0, False: 0]
  |  Branch (734:32): [True: 0, False: 0]
  |  Branch (734:53): [True: 0, False: 0]
  ------------------
  735|      0|				if ( *stepEnd == 0 ) XMP_Throw ( "Missing ']' or '=' for array index", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (735:10): [True: 0, False: 0]
  ------------------
  736|       |
  737|      0|				if ( *stepEnd == ']' ) {
  ------------------
  |  Branch (737:10): [True: 0, False: 0]
  ------------------
  738|       |
  739|      0|					if ( strncmp ( "[last()", stepBegin, (stepEnd - stepBegin) ) != 0 ) {
  ------------------
  |  Branch (739:11): [True: 0, False: 0]
  ------------------
  740|      0|						XMP_Throw ( "Invalid non-numeric array index", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  741|      0|					}
  742|      0|					stepFlags = kXMP_ArrayLastStep;
  743|       |
  744|      0|				} else {
  745|       |
  746|      0|					qualName = stepBegin+1;
  747|      0|					nameEnd = stepEnd;
  748|      0|					++stepEnd;	// Absorb the '=', remember the quote.
  749|      0|					const char quote = *stepEnd;
  750|      0|					if ( (quote != '\'') && (quote != '"') ) {
  ------------------
  |  Branch (750:11): [True: 0, False: 0]
  |  Branch (750:30): [True: 0, False: 0]
  ------------------
  751|      0|						XMP_Throw ( "Invalid quote in array selector", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  752|      0|					}
  753|       |
  754|      0|					++stepEnd;	// Absorb the leading quote.
  755|      0|					while ( *stepEnd != 0 ) {
  ------------------
  |  Branch (755:14): [True: 0, False: 0]
  ------------------
  756|      0|						if ( *stepEnd == quote ) {
  ------------------
  |  Branch (756:12): [True: 0, False: 0]
  ------------------
  757|      0|							if ( *(stepEnd+1) != quote ) break;
  ------------------
  |  Branch (757:13): [True: 0, False: 0]
  ------------------
  758|      0|							++stepEnd;
  759|      0|						}
  760|      0|						++stepEnd;
  761|      0|					}
  762|      0|					if ( *stepEnd == 0 ) {
  ------------------
  |  Branch (762:11): [True: 0, False: 0]
  ------------------
  763|      0|						XMP_Throw ( "No terminating quote for array selector", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  764|      0|					}
  765|      0|					++stepEnd;	// Absorb the trailing quote.
  766|       |					
  767|      0|					stepFlags = kXMP_FieldSelectorStep;	// ! Touch up later, also changing '@' to '?'.
  768|       |
  769|      0|				}
  770|       |
  771|      0|			}
  772|       |
  773|   211k|			if ( *stepEnd != ']' ) XMP_Throw ( "Missing ']' for array index", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (773:9): [True: 0, False: 211k]
  ------------------
  774|   211k|			++stepEnd;
  775|       |			
  776|   211k|		}
  777|       |
  778|   314k|		if ( stepEnd == stepBegin ) XMP_Throw ( "Empty XPath step", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (778:8): [True: 0, False: 314k]
  ------------------
  779|   314k|		currStep.assign ( stepBegin, (stepEnd - stepBegin) );
  780|       |
  781|   314k|		if ( GetStepKind ( stepFlags ) == kXMP_StructFieldStep ) {
  ------------------
  |  |  408|   314k|#define GetStepKind(f)	((f) & kXMP_StepKindMask)
  ------------------
  |  Branch (781:8): [True: 102k, False: 211k]
  ------------------
  782|       |
  783|   102k|			if ( currStep[0] == '@' ) {
  ------------------
  |  Branch (783:9): [True: 0, False: 102k]
  ------------------
  784|      0|				currStep[0] = '?';
  785|      0|				if ( currStep != "?xml:lang" ) XMP_Throw ( "Only xml:lang allowed with '@'", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (785:10): [True: 0, False: 0]
  ------------------
  786|      0|			}
  787|   102k|			if ( currStep[0] == '?' ) {
  ------------------
  |  Branch (787:9): [True: 66.6k, False: 35.6k]
  ------------------
  788|  66.6k|				++qualName;
  789|  66.6k|				stepFlags = kXMP_QualifierStep;
  790|  66.6k|			}
  791|   102k|			VerifyQualName ( qualName, nameEnd );
  792|       |
  793|   211k|		} else if ( GetStepKind ( stepFlags ) == kXMP_FieldSelectorStep ) {
  ------------------
  |  |  408|   211k|#define GetStepKind(f)	((f) & kXMP_StepKindMask)
  ------------------
  |  Branch (793:15): [True: 0, False: 211k]
  ------------------
  794|       |
  795|      0|			if ( currStep[1] == '@' ) {
  ------------------
  |  Branch (795:9): [True: 0, False: 0]
  ------------------
  796|      0|				currStep[1] = '?';
  797|      0|				if ( strncmp ( currStep.c_str(), "[?xml:lang=", 11 ) != 0 ) {
  ------------------
  |  Branch (797:10): [True: 0, False: 0]
  ------------------
  798|      0|					XMP_Throw ( "Only xml:lang allowed with '@'", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  799|      0|				}
  800|      0|			}
  801|      0|			if ( currStep[1] == '?' ) {
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|				++qualName;
  803|      0|				stepFlags = kXMP_QualSelectorStep;
  804|      0|			}
  805|      0|			VerifyQualName ( qualName, nameEnd );
  806|       |
  807|      0|		}
  808|       |
  809|   314k|		expandedXPath->push_back ( XPathStepInfo ( currStep, stepFlags ) );
  810|       |
  811|   314k|	}
  812|       |
  813|   246k|}	// ExpandXPath
_Z14FindSchemaNodeP8XMP_NodePKcbPNSt3__111__wrap_iterIPS0_EE:
  828|   285k|{
  829|   285k|	XMP_Node * schemaNode = 0;
  830|       |	
  831|   285k|	XMP_Assert ( xmpTree->parent == 0 );
  ------------------
  |  |  142|   285k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  832|       |	
  833|   776k|	for ( size_t schemaNum = 0, schemaLim = xmpTree->children.size(); schemaNum != schemaLim; ++schemaNum ) {
  ------------------
  |  Branch (833:68): [True: 743k, False: 33.2k]
  ------------------
  834|   743k|		XMP_Node * currSchema = xmpTree->children[schemaNum];
  835|   743k|		XMP_Assert ( currSchema->parent == xmpTree );
  ------------------
  |  |  142|   743k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  836|   743k|		if ( currSchema->name == nsURI ) {
  ------------------
  |  Branch (836:8): [True: 252k, False: 490k]
  ------------------
  837|   252k|			schemaNode = currSchema;
  838|   252k|			if ( ptrPos != 0 ) *ptrPos = xmpTree->children.begin() + schemaNum;
  ------------------
  |  Branch (838:9): [True: 237k, False: 15.3k]
  ------------------
  839|   252k|			break;
  840|   252k|		}
  841|   743k|	}
  842|       |	
  843|   285k|	if ( (schemaNode == 0) && createNodes ) {
  ------------------
  |  Branch (843:7): [True: 33.2k, False: 252k]
  |  Branch (843:28): [True: 12.7k, False: 20.5k]
  ------------------
  844|       |
  845|  12.7k|		schemaNode = new XMP_Node ( xmpTree, nsURI, (kXMP_SchemaNode | kXMP_NewImplicitNode) );
  ------------------
  |  |  410|  12.7k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  846|  12.7k|		XMP_StringPtr prefixPtr;
  847|  12.7k|		XMP_StringLen prefixLen;
  848|  12.7k|        bool found = XMPMeta::GetNamespacePrefix ( nsURI, &prefixPtr, &prefixLen );	// *** Use map directly?
  849|  12.7k|		XMP_Assert ( found );
  ------------------
  |  |  142|  12.7k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  850|  12.7k|		UNUSED(found);
  851|       |
  852|  12.7k|		schemaNode->value.assign ( prefixPtr, prefixLen );
  853|  12.7k|		xmpTree->children.push_back ( schemaNode );
  854|  12.7k|		if ( ptrPos != 0 ) *ptrPos = xmpTree->children.end() - 1;
  ------------------
  |  Branch (854:8): [True: 4.44k, False: 8.31k]
  ------------------
  855|       |
  856|       |		#if 0	// *** XMP_DebugBuild
  857|       |			schemaNode->_valuePtr = schemaNode->value.c_str();
  858|       |		#endif
  859|       |
  860|  12.7k|	}
  861|       |	
  862|   285k|	XMP_Assert ( (ptrPos == 0) || (schemaNode == 0) || (schemaNode == **ptrPos) );
  ------------------
  |  |  142|   285k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  863|   285k|	XMP_Assert ( (schemaNode != 0) || (! createNodes) );
  ------------------
  |  |  142|   285k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  864|   285k|	return schemaNode;
  865|       |	
  866|   285k|}	// FindSchemaNode
_Z13FindChildNodeP8XMP_NodePKcbPNSt3__111__wrap_iterIPS0_EE:
  881|   313k|{
  882|   313k|	XMP_Node * childNode = 0;
  883|       |
  884|   313k|	if ( ! (parent->options & (kXMP_SchemaNode | kXMP_PropValueIsStruct)) ) {
  ------------------
  |  Branch (884:7): [True: 10, False: 313k]
  ------------------
  885|     10|		if ( ! (parent->options & kXMP_NewImplicitNode) ) {
  ------------------
  |  |  410|     10|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (885:8): [True: 10, False: 0]
  ------------------
  886|     10|			XMP_Throw ( "Named children only allowed for schemas and structs", kXMPErr_BadXPath );
  ------------------
  |  |  199|     10|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  887|      0|		}
  888|      0|		if ( parent->options & kXMP_PropValueIsArray ) {
  ------------------
  |  Branch (888:8): [True: 0, False: 0]
  ------------------
  889|      0|			XMP_Throw ( "Named children not allowed for arrays", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  890|      0|		}
  891|      0|		if ( ! createNodes ) {	// *** Should be assert? If !createNodes, why is the parent a new implicit node?
  ------------------
  |  Branch (891:8): [True: 0, False: 0]
  ------------------
  892|      0|			XMP_Throw ( "Parent is new implicit node, but createNodes is false", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  893|      0|		}
  894|      0|		parent->options |= kXMP_PropValueIsStruct;
  895|      0|	}
  896|       |	
  897|  1.28M|	for ( size_t childNum = 0, childLim = parent->children.size(); childNum != childLim; ++childNum ) {
  ------------------
  |  Branch (897:65): [True: 1.22M, False: 61.8k]
  ------------------
  898|  1.22M|		XMP_Node * currChild = parent->children[childNum];
  899|  1.22M|		XMP_Assert ( currChild->parent == parent );
  ------------------
  |  |  142|  1.22M|	#define XMP_Assert(c)	((void) 0)
  ------------------
  900|  1.22M|		if ( currChild->name == childName ) {
  ------------------
  |  Branch (900:8): [True: 251k, False: 976k]
  ------------------
  901|   251k|			childNode = currChild;
  902|   251k|			if ( ptrPos != 0 ) *ptrPos = parent->children.begin() + childNum;
  ------------------
  |  Branch (902:9): [True: 251k, False: 289]
  ------------------
  903|   251k|			break;
  904|   251k|		}
  905|  1.22M|	}
  906|       |	
  907|   313k|	if ( (childNode == 0) && createNodes ) {
  ------------------
  |  Branch (907:7): [True: 61.8k, False: 251k]
  |  Branch (907:27): [True: 25.9k, False: 35.9k]
  ------------------
  908|  25.9k|		childNode = new XMP_Node ( parent, childName, kXMP_NewImplicitNode );
  ------------------
  |  |  410|  25.9k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  909|  25.9k|		parent->children.push_back ( childNode );
  910|  25.9k|		if ( ptrPos != 0 ) *ptrPos = parent->children.end() - 1;
  ------------------
  |  Branch (910:8): [True: 25.9k, False: 0]
  ------------------
  911|  25.9k|	}
  912|       |	
  913|   313k|	XMP_Assert ( (ptrPos == 0) || (childNode == 0) || (childNode == **ptrPos) );
  ------------------
  |  |  142|   313k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  914|   313k|	XMP_Assert ( (childNode != 0) || (! createNodes) );
  ------------------
  |  |  142|   313k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  915|   313k|	return childNode;
  916|       |	
  917|   313k|}	// FindChildNode
_Z17FindQualifierNodeP8XMP_NodePKcbPNSt3__111__wrap_iterIPS0_EE:
  934|  66.6k|{
  935|  66.6k|	XMP_Node * qualNode = 0;
  936|       |	
  937|  66.6k|	XMP_Assert ( *qualName != '?' );
  ------------------
  |  |  142|  66.6k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  938|       |	
  939|   838k|	for ( size_t qualNum = 0, qualLim = parent->qualifiers.size(); qualNum != qualLim; ++qualNum ) {
  ------------------
  |  Branch (939:65): [True: 807k, False: 31.4k]
  ------------------
  940|   807k|		XMP_Node * currQual = parent->qualifiers[qualNum];
  941|   807k|		XMP_Assert ( currQual->parent == parent );
  ------------------
  |  |  142|   807k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  942|   807k|		if ( currQual->name == qualName ) {
  ------------------
  |  Branch (942:8): [True: 35.1k, False: 771k]
  ------------------
  943|  35.1k|			qualNode = currQual;
  944|  35.1k|			if ( ptrPos != 0 ) *ptrPos = parent->qualifiers.begin() + qualNum;
  ------------------
  |  Branch (944:9): [True: 35.1k, False: 0]
  ------------------
  945|  35.1k|			break;
  946|  35.1k|		}
  947|   807k|	}
  948|       |	
  949|  66.6k|	if ( (qualNode == 0) && createNodes ) {
  ------------------
  |  Branch (949:7): [True: 31.4k, False: 35.1k]
  |  Branch (949:26): [True: 31.4k, False: 0]
  ------------------
  950|       |
  951|  31.4k|		qualNode = new XMP_Node ( parent, qualName, (static_cast<unsigned long>(kXMP_PropIsQualifier) | static_cast<unsigned long>(kXMP_NewImplicitNode)) );
  ------------------
  |  |  410|  31.4k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  952|  31.4k|		parent->options |= kXMP_PropHasQualifiers;
  953|       |
  954|  31.4k|		const bool isLang 	 = XMP_LitMatch ( qualName, "xml:lang" );
  ------------------
  |  |   96|  31.4k|#define XMP_LitMatch(s,l)		(std::strcmp((s),(l)) == 0)
  ------------------
  955|  31.4k|		const bool isType 	 = XMP_LitMatch ( qualName, "rdf:type" );
  ------------------
  |  |   96|  31.4k|#define XMP_LitMatch(s,l)		(std::strcmp((s),(l)) == 0)
  ------------------
  956|  31.4k|		const bool isSpecial = isLang | isType;
  957|       |
  958|  31.4k|		if ( isLang ) {
  ------------------
  |  Branch (958:8): [True: 5.36k, False: 26.0k]
  ------------------
  959|  5.36k|			parent->options |= kXMP_PropHasLang;
  960|  26.0k|		} else if ( isType ) {
  ------------------
  |  Branch (960:15): [True: 47, False: 26.0k]
  ------------------
  961|     47|			parent->options |= kXMP_PropHasType;
  962|     47|		}
  963|       |		
  964|  31.4k|		if ( parent->qualifiers.empty() || (! isSpecial) ) {
  ------------------
  |  Branch (964:8): [True: 6.47k, False: 24.9k]
  |  Branch (964:38): [True: 24.9k, False: 10]
  ------------------
  965|  31.4k|			parent->qualifiers.push_back ( qualNode );
  966|  31.4k|			if ( ptrPos != 0 ) *ptrPos = parent->qualifiers.end() - 1;
  ------------------
  |  Branch (966:9): [True: 31.4k, False: 0]
  ------------------
  967|  31.4k|		} else {
  968|     10|			XMP_NodePtrPos insertPos = parent->qualifiers.begin();	// ! Lang goes first, type after.
  969|     10|			if ( isType && (parent->options & kXMP_PropHasLang) ) ++insertPos;	// *** Does insert at end() work?
  ------------------
  |  Branch (969:9): [True: 10, False: 0]
  |  Branch (969:19): [True: 10, False: 0]
  ------------------
  970|     10|			insertPos = parent->qualifiers.insert ( insertPos, qualNode );
  971|     10|			if ( ptrPos != 0 ) *ptrPos = insertPos;
  ------------------
  |  Branch (971:9): [True: 10, False: 0]
  ------------------
  972|     10|		}
  973|       |
  974|  31.4k|	}
  975|       |	
  976|  66.6k|	XMP_Assert ( (ptrPos == 0) || (qualNode == 0) || (qualNode == **ptrPos) );
  ------------------
  |  |  142|  66.6k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  977|  66.6k|	XMP_Assert ( (qualNode != 0) || (! createNodes) );
  ------------------
  |  |  142|  66.6k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  978|  66.6k|	return qualNode;
  979|       |	
  980|  66.6k|}	// FindQualifierNode
_Z8FindNodeP8XMP_NodeRKNSt3__16vectorI13XPathStepInfoNS1_9allocatorIS3_EEEEbjPNS1_11__wrap_iterIPS0_EE:
 1062|   241k|{
 1063|   241k|	XMP_Node *     currNode = 0;
 1064|   241k|	XMP_NodePtrPos currPos;
 1065|   241k|	XMP_NodePtrPos newSubPos;	// Root of implicitly created subtree. Valid only if leaf is new.
 1066|   241k|	bool           leafIsNew = false;
 1067|       |	
 1068|   241k|	XMP_Assert ( (leafOptions == 0) || createNodes );
  ------------------
  |  |  142|   241k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1069|       |
 1070|   241k|	if ( expandedXPath.empty() ) XMP_Throw ( "Empty XPath", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1070:7): [True: 0, False: 241k]
  ------------------
 1071|       |	
 1072|   241k|	size_t stepNum = 1;	// By default start calling FollowXPathStep for the top level property step.
 1073|   241k|	size_t stepLim = expandedXPath.size();
 1074|       |	
 1075|       |	// The start of processing deals with the schema node and top level alias. If the top level step
 1076|       |	// is not an alias, lookup the expanded path's schema URI. Otherwise, lookup the expanded path
 1077|       |	// for the actual. While tempting, don't substitute the actual's path into the local one, don't
 1078|       |	// risk messing with the caller's use of that. Also don't call FindNode recursively, we need to
 1079|       |	// keep track of the root of the implicitly created subtree as we move down the path.
 1080|       |	
 1081|   241k|	if ( ! (expandedXPath[kRootPropStep].options & kXMP_StepIsAlias) ) {
  ------------------
  |  Branch (1081:7): [True: 241k, False: 0]
  ------------------
 1082|       |		
 1083|   241k|		currNode = FindSchemaNode ( xmpTree, expandedXPath[kSchemaStep].step.c_str(), createNodes, &currPos );
 1084|   241k|		if ( currNode == 0 ) return 0;
  ------------------
  |  Branch (1084:8): [True: 226, False: 241k]
  ------------------
 1085|       |
 1086|   241k|		if ( currNode->options & kXMP_NewImplicitNode ) {
  ------------------
  |  |  410|   241k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (1086:8): [True: 4.44k, False: 237k]
  ------------------
 1087|  4.44k|			currNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|  4.44k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
 1088|  4.44k|			if ( ! leafIsNew ) newSubPos = currPos;	// Save the top most implicit node.
  ------------------
  |  Branch (1088:9): [True: 4.44k, False: 0]
  ------------------
 1089|  4.44k|			leafIsNew = true;	// If any parent is new, the leaf will be new also.
 1090|  4.44k|		}
 1091|       |
 1092|   241k|	} else {
 1093|       |
 1094|      0|		stepNum = 2;	// ! Continue processing the original path at the second level step.
 1095|       |
 1096|      0|		XMP_AliasMapPos aliasPos = sRegisteredAliasMap->find ( expandedXPath[kRootPropStep].step );
 1097|      0|		XMP_Assert ( aliasPos != sRegisteredAliasMap->end() );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1098|       |		
 1099|      0|		currNode = FindSchemaNode ( xmpTree, aliasPos->second[kSchemaStep].step.c_str(), createNodes, &currPos );
 1100|      0|		if ( currNode == 0 ) goto EXIT;
  ------------------
  |  Branch (1100:8): [True: 0, False: 0]
  ------------------
 1101|      0|		if ( currNode->options & kXMP_NewImplicitNode ) {
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (1101:8): [True: 0, False: 0]
  ------------------
 1102|      0|			currNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
 1103|      0|			if ( ! leafIsNew ) newSubPos = currPos;	// Save the top most implicit node.
  ------------------
  |  Branch (1103:9): [True: 0, False: 0]
  ------------------
 1104|      0|			leafIsNew = true;	// If any parent is new, the leaf will be new also.
 1105|      0|		}
 1106|       |
 1107|      0|		currNode = FollowXPathStep ( currNode, aliasPos->second, 1, createNodes, &currPos );
 1108|      0|		if ( currNode == 0 ) goto EXIT;
  ------------------
  |  Branch (1108:8): [True: 0, False: 0]
  ------------------
 1109|      0|		if ( currNode->options & kXMP_NewImplicitNode ) {
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (1109:8): [True: 0, False: 0]
  ------------------
 1110|      0|			currNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
 1111|      0|			CheckImplicitStruct ( currNode, expandedXPath, 2, stepLim );
 1112|      0|			if ( ! leafIsNew ) newSubPos = currPos;	// Save the top most implicit node.
  ------------------
  |  Branch (1112:9): [True: 0, False: 0]
  ------------------
 1113|      0|			leafIsNew = true;	// If any parent is new, the leaf will be new also.
 1114|      0|		}
 1115|       |		
 1116|      0|		XMP_OptionBits arrayForm = aliasPos->second[kRootPropStep].options & kXMP_PropArrayFormMask;
 1117|      0|		XMP_Assert ( (arrayForm == 0) || (arrayForm & kXMP_PropValueIsArray) );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1118|      0|		XMP_Assert ( (arrayForm == 0) ? (aliasPos->second.size() == 2) : (aliasPos->second.size() == 3) );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1119|       |		
 1120|      0|		if ( arrayForm != 0 ) { 
  ------------------
  |  Branch (1120:8): [True: 0, False: 0]
  ------------------
 1121|      0|			currNode = FollowXPathStep ( currNode, aliasPos->second, 2, createNodes, &currPos, true );
 1122|      0|			if ( currNode == 0 ) goto EXIT;
  ------------------
  |  Branch (1122:9): [True: 0, False: 0]
  ------------------
 1123|      0|			if ( currNode->options & kXMP_NewImplicitNode ) {
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (1123:9): [True: 0, False: 0]
  ------------------
 1124|      0|				currNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
 1125|      0|				CheckImplicitStruct ( currNode, expandedXPath, 2, stepLim );
 1126|      0|				if ( ! leafIsNew ) newSubPos = currPos;	// Save the top most implicit node.
  ------------------
  |  Branch (1126:10): [True: 0, False: 0]
  ------------------
 1127|      0|				leafIsNew = true;	// If any parent is new, the leaf will be new also.
 1128|      0|			}
 1129|      0|		}
 1130|       |		
 1131|      0|	}
 1132|       |	
 1133|       |	// Now follow the remaining steps of the original XPath.
 1134|       |	
 1135|       |	// *** ??? Change all the num/lim loops back to num<lim? Probably safer.
 1136|       |	
 1137|   241k|	try {
 1138|   794k|		for ( ; stepNum < stepLim; ++stepNum ) {
  ------------------
  |  Branch (1138:11): [True: 553k, False: 241k]
  ------------------
 1139|   553k|			currNode = FollowXPathStep ( currNode, expandedXPath, stepNum, createNodes, &currPos );
 1140|   553k|			if ( currNode == 0 ) goto EXIT;
  ------------------
  |  Branch (1140:9): [True: 329, False: 553k]
  ------------------
 1141|   553k|			if ( currNode->options & kXMP_NewImplicitNode ) {
  ------------------
  |  |  410|   553k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (1141:9): [True: 95.0k, False: 457k]
  ------------------
 1142|  95.0k|				currNode->options ^= kXMP_NewImplicitNode;	// Clear the implicit node bit.
  ------------------
  |  |  410|  95.0k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
 1143|  95.0k|				CheckImplicitStruct ( currNode, expandedXPath, stepNum+1, stepLim );
 1144|  95.0k|				if ( ! leafIsNew ) newSubPos = currPos;	// Save the top most implicit node.
  ------------------
  |  Branch (1144:10): [True: 90.6k, False: 4.44k]
  ------------------
 1145|  95.0k|				leafIsNew = true;	// If any parent is new, the leaf will be new also.
 1146|  95.0k|			}
 1147|   553k|		}
 1148|   241k|	} catch ( ... ) {
 1149|     18|		if ( leafIsNew ) DeleteSubtree ( newSubPos );
  ------------------
  |  Branch (1149:8): [True: 18, False: 0]
  ------------------
 1150|     18|		throw;
 1151|     18|	}
 1152|       |	
 1153|       |	// Done. Delete the implicitly created subtree if the eventual node was not found.
 1154|       |
 1155|   241k|EXIT:
 1156|       |
 1157|   241k|	XMP_Assert ( (currNode == 0) || (currNode == *currPos) );
  ------------------
  |  |  142|   241k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1158|   241k|	XMP_Assert ( (currNode != 0) || (! createNodes) );
  ------------------
  |  |  142|   241k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1159|       |
 1160|   241k|	if ( leafIsNew ) {
  ------------------
  |  Branch (1160:7): [True: 95.0k, False: 146k]
  ------------------
 1161|  95.0k|		if ( currNode != 0 ) {
  ------------------
  |  Branch (1161:8): [True: 95.0k, False: 0]
  ------------------
 1162|  95.0k|			currNode->options |= leafOptions;
 1163|  95.0k|		} else {
 1164|      0|			DeleteSubtree ( newSubPos );
 1165|      0|		}
 1166|  95.0k|	}
 1167|       |
 1168|   241k|	if ( (currNode != 0) && (ptrPos != 0) ) *ptrPos = currPos;
  ------------------
  |  Branch (1168:7): [True: 241k, False: 329]
  |  Branch (1168:26): [True: 0, False: 241k]
  ------------------
 1169|   241k|	return currNode;
 1170|       |	
 1171|   241k|}	// FindNode
_Z18NormalizeLangValuePNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
 1343|  14.3k|{
 1344|  14.3k|	char * tagStart;
 1345|  14.3k|	char * tagEnd;
 1346|       |
 1347|       |	// Find and process the primary subtag.
 1348|       |	
 1349|  14.3k|	tagStart = (char*) value->c_str();
 1350|  1.67M|	for ( tagEnd = tagStart; (*tagEnd != 0) && (*tagEnd != '-'); ++tagEnd ) {
  ------------------
  |  Branch (1350:27): [True: 1.66M, False: 5.83k]
  |  Branch (1350:45): [True: 1.66M, False: 8.46k]
  ------------------
 1351|  1.66M|		if ( ('A' <= *tagEnd) && (*tagEnd <= 'Z') ) *tagEnd += 0x20;
  ------------------
  |  Branch (1351:8): [True: 1.57M, False: 88.8k]
  |  Branch (1351:28): [True: 7.14k, False: 1.56M]
  ------------------
 1352|  1.66M|	}
 1353|       |	
 1354|       |	// Find and process the secondary subtag.
 1355|       |	
 1356|  14.3k|	tagStart = tagEnd;
 1357|  14.3k|	if ( *tagStart == '-' ) ++tagStart;
  ------------------
  |  Branch (1357:7): [True: 8.46k, False: 5.83k]
  ------------------
 1358|  1.15M|	for ( tagEnd = tagStart; (*tagEnd != 0) && (*tagEnd != '-'); ++tagEnd ) {
  ------------------
  |  Branch (1358:27): [True: 1.13M, False: 12.5k]
  |  Branch (1358:45): [True: 1.13M, False: 1.80k]
  ------------------
 1359|  1.13M|		if ( ('A' <= *tagEnd) && (*tagEnd <= 'Z') ) *tagEnd += 0x20;
  ------------------
  |  Branch (1359:8): [True: 1.10M, False: 32.5k]
  |  Branch (1359:28): [True: 7.83k, False: 1.09M]
  ------------------
 1360|  1.13M|	}
 1361|  14.3k|	if ( tagEnd == tagStart+2 ) {
  ------------------
  |  Branch (1361:7): [True: 2.65k, False: 11.6k]
  ------------------
 1362|  2.65k|		if ( ('a' <= *tagStart) && (*tagStart <= 'z') ) *tagStart -= 0x20;
  ------------------
  |  Branch (1362:8): [True: 999, False: 1.65k]
  |  Branch (1362:30): [True: 923, False: 76]
  ------------------
 1363|  2.65k|		++tagStart;
 1364|  2.65k|		if ( ('a' <= *tagStart) && (*tagStart <= 'z') ) *tagStart -= 0x20;
  ------------------
  |  Branch (1364:8): [True: 1.83k, False: 814]
  |  Branch (1364:30): [True: 901, False: 936]
  ------------------
 1365|  2.65k|	}
 1366|       |	
 1367|       |	// Find and process the remaining subtags.
 1368|       |	
 1369|  16.6k|	while ( true ) {
  ------------------
  |  Branch (1369:10): [True: 16.6k, Folded]
  ------------------
 1370|  16.6k|		tagStart = tagEnd;
 1371|  16.6k|		if ( *tagStart == '-' ) ++tagStart;
  ------------------
  |  Branch (1371:8): [True: 2.35k, False: 14.2k]
  ------------------
 1372|  16.6k|		if ( *tagStart == 0 ) break;
  ------------------
  |  Branch (1372:8): [True: 14.3k, False: 2.32k]
  ------------------
 1373|  6.35M|		for ( tagEnd = tagStart; (*tagEnd != 0) && (*tagEnd != '-'); ++tagEnd ) {
  ------------------
  |  Branch (1373:28): [True: 6.35M, False: 1.77k]
  |  Branch (1373:46): [True: 6.35M, False: 556]
  ------------------
 1374|  6.35M|			if ( ('A' <= *tagEnd) && (*tagEnd <= 'Z') ) *tagEnd += 0x20;
  ------------------
  |  Branch (1374:9): [True: 6.29M, False: 63.4k]
  |  Branch (1374:29): [True: 6.38k, False: 6.28M]
  ------------------
 1375|  6.35M|		}
 1376|  2.32k|	}
 1377|       |	
 1378|  14.3k|}	// NormalizeLangValue
_Z18NormalizeLangArrayP8XMP_Node:
 1390|    567|{
 1391|    567|	XMP_Assert ( XMP_ArrayIsAltText(array->options) );
  ------------------
  |  |  142|    567|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1392|       |	
 1393|    567|	size_t itemNum;
 1394|    567|	size_t itemLim = array->children.size();
 1395|    567|	bool   hasDefault = false;
 1396|       |	
 1397|  5.34k|	for ( itemNum = 0; itemNum < itemLim; ++itemNum ) {
  ------------------
  |  Branch (1397:21): [True: 4.82k, False: 521]
  ------------------
 1398|       |	
 1399|  4.82k|		if ( array->children[itemNum]->qualifiers.empty() ||
  ------------------
  |  Branch (1399:8): [True: 0, False: 4.82k]
  ------------------
 1400|  4.82k|			 (array->children[itemNum]->qualifiers[0]->name != "xml:lang") ) {
  ------------------
  |  Branch (1400:5): [True: 0, False: 4.82k]
  ------------------
 1401|      0|			XMP_Throw ( "AltText array items must have an xml:lang qualifier", kXMPErr_BadXMP );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1402|      0|		}
 1403|       |
 1404|  4.82k|		if ( array->children[itemNum]->qualifiers[0]->value == "x-default" ) {
  ------------------
  |  Branch (1404:8): [True: 46, False: 4.77k]
  ------------------
 1405|     46|			hasDefault = true;
 1406|     46|			break;
 1407|     46|		}
 1408|       |
 1409|  4.82k|	}
 1410|       |
 1411|    567|	if ( hasDefault ) {
  ------------------
  |  Branch (1411:7): [True: 46, False: 521]
  ------------------
 1412|       |
 1413|     46|		if ( itemNum != 0 ) {
  ------------------
  |  Branch (1413:8): [True: 18, False: 28]
  ------------------
 1414|     18|			XMP_Node * temp = array->children[0];
 1415|     18|			array->children[0] = array->children[itemNum];
 1416|     18|			array->children[itemNum] = temp;
 1417|     18|		}
 1418|       |
 1419|       |// 09-Oct-07, ahu: disabled to avoid unexpected behaviour
 1420|       |//		if ( itemLim == 2 ) array->children[1]->value = array->children[0]->value;
 1421|       |
 1422|     46|	}
 1423|       |	
 1424|    567|}	// NormalizeLangArray
_Z13DetectAltTextP8XMP_Node:
 1434|  1.12k|{
 1435|  1.12k|	XMP_Assert ( XMP_ArrayIsAlternate(xmpParent->options) );
  ------------------
  |  |  142|  1.12k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1436|       |
 1437|  1.12k|	size_t itemNum, itemLim;
 1438|       |	
 1439|  6.22k|	for ( itemNum = 0, itemLim = xmpParent->children.size(); itemNum < itemLim; ++itemNum ) {
  ------------------
  |  Branch (1439:59): [True: 5.64k, False: 588]
  ------------------
 1440|  5.64k|		XMP_OptionBits currOptions = xmpParent->children[itemNum]->options;
 1441|  5.64k|		if ( (currOptions & kXMP_PropCompositeMask) || (! (currOptions & kXMP_PropHasLang)) ) break;
  ------------------
  |  Branch (1441:8): [True: 12, False: 5.62k]
  |  Branch (1441:50): [True: 529, False: 5.10k]
  ------------------
 1442|  5.64k|	}
 1443|       |	
 1444|  1.12k|	if ( (itemLim != 0) && (itemNum == itemLim) ) {
  ------------------
  |  Branch (1444:7): [True: 1.10k, False: 21]
  |  Branch (1444:25): [True: 567, False: 541]
  ------------------
 1445|    567|		xmpParent->options |= kXMP_PropArrayIsAltText;
 1446|    567|		NormalizeLangArray ( xmpParent );
 1447|    567|	}
 1448|       |
 1449|  1.12k|}	// DetectAltText
XMPCore_Impl.cpp:_ZL15VerifyXPathRootPKcS0_PNSt3__16vectorI13XPathStepInfoNS1_9allocatorIS3_EEEE:
  154|   246k|{
  155|       |	// Do some basic checks on the URI and name. Try to lookup the URI. See if the name is qualified.
  156|       |	
  157|   246k|	XMP_Assert ( (schemaURI != 0) && (propName != 0) && (*propName != 0) );
  ------------------
  |  |  142|   246k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  158|   246k|	XMP_Assert ( (expandedXPath != 0) && (expandedXPath->empty()) );
  ------------------
  |  |  142|   246k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  159|       |
  160|   246k|	if ( *schemaURI == 0 ) XMP_Throw ( "Schema namespace URI is required", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (160:7): [True: 0, False: 246k]
  ------------------
  161|       |
  162|   246k|	if ( (*propName == '?') || (*propName == '@') ) {
  ------------------
  |  Branch (162:7): [True: 0, False: 246k]
  |  Branch (162:29): [True: 0, False: 246k]
  ------------------
  163|      0|		XMP_Throw ( "Top level name must not be a qualifier", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  164|      0|	}
  165|  45.9M|	for ( XMP_StringPtr ch = propName; *ch != 0; ++ch ) {
  ------------------
  |  Branch (165:37): [True: 45.6M, False: 246k]
  ------------------
  166|  45.6M|		if ( (*ch == '/') || (*ch == '[') ) {
  ------------------
  |  Branch (166:8): [True: 0, False: 45.6M]
  |  Branch (166:24): [True: 0, False: 45.6M]
  ------------------
  167|      0|			XMP_Throw ( "Top level name must be simple", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  168|      0|		}
  169|  45.6M|	}
  170|       |
  171|   246k|	XMP_StringMapPos uriPos = sNamespaceURIToPrefixMap->find ( XMP_VarString ( schemaURI ) );
  172|   246k|	if ( uriPos == sNamespaceURIToPrefixMap->end() ) {
  ------------------
  |  Branch (172:7): [True: 0, False: 246k]
  ------------------
  173|      0|		XMP_Throw ( "Unregistered schema namespace URI", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  174|      0|	}
  175|       |
  176|   246k|	XMP_StringPtr colonPos = propName;
  177|  33.8M|	while ( (*colonPos != 0) && (*colonPos != ':') ) ++colonPos;
  ------------------
  |  Branch (177:10): [True: 33.7M, False: 103k]
  |  Branch (177:30): [True: 33.5M, False: 142k]
  ------------------
  178|   246k|	VerifySimpleXMLName ( propName, colonPos );	// Verify the part before any colon.
  179|       |
  180|       |	// Verify the various URI and prefix combinations. Initialize the expanded XPath.
  181|       |	
  182|   246k|	if ( *colonPos == 0 ) {
  ------------------
  |  Branch (182:7): [True: 103k, False: 142k]
  ------------------
  183|       |	
  184|       |		// The propName is unqualified, use the schemaURI and associated prefix.
  185|       |		
  186|   103k|		expandedXPath->push_back ( XPathStepInfo ( schemaURI, kXMP_SchemaNode ) );
  187|   103k|		expandedXPath->push_back ( XPathStepInfo ( uriPos->second, 0 ) );
  188|   103k|		(*expandedXPath)[kRootPropStep].step += propName;
  189|       |	
  190|   142k|	} else {
  191|       |
  192|       |		// The propName is qualified. Make sure the prefix is legit. Use the associated URI and qualified name.
  193|       |
  194|   142k|		size_t prefixLen = colonPos - propName + 1;	// ! Include the colon.
  195|   142k|		VerifySimpleXMLName ( colonPos+1, colonPos+strlen(colonPos) );
  196|       |
  197|   142k|		XMP_VarString prefix ( propName, prefixLen );
  198|   142k|		XMP_StringMapPos prefixPos = sNamespacePrefixToURIMap->find ( prefix );
  199|   142k|		if ( prefixPos == sNamespacePrefixToURIMap->end() ) {
  ------------------
  |  Branch (199:8): [True: 0, False: 142k]
  ------------------
  200|      0|			XMP_Throw ( "Unknown schema namespace prefix", kXMPErr_BadSchema );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  201|      0|		}
  202|   142k|		if ( prefix != uriPos->second ) {
  ------------------
  |  Branch (202:8): [True: 58, False: 142k]
  ------------------
  203|     58|			XMP_Throw ( "Schema namespace URI and prefix mismatch", kXMPErr_BadSchema );
  ------------------
  |  |  199|     58|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  204|      0|		}
  205|       |
  206|   142k|		expandedXPath->push_back ( XPathStepInfo ( schemaURI, kXMP_SchemaNode ) );
  207|   142k|		expandedXPath->push_back ( XPathStepInfo ( propName, 0 ) );
  208|       |	
  209|   142k|	}
  210|       |
  211|   246k|}	// VerifyXPathRoot
XMPCore_Impl.cpp:_ZL14VerifyQualNamePKcS0_:
  219|   102k|{
  220|   102k|	if ( qualName >= nameEnd ) XMP_Throw ( "Empty qualified name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (220:7): [True: 0, False: 102k]
  ------------------
  221|       |
  222|   102k|	XMP_StringPtr colonPos = qualName;
  223|  7.72M|	while ( (colonPos < nameEnd) && (*colonPos != ':') ) ++colonPos;
  ------------------
  |  Branch (223:10): [True: 7.72M, False: 0]
  |  Branch (223:34): [True: 7.61M, False: 102k]
  ------------------
  224|   102k|	if ( (colonPos == qualName) || (colonPos >= nameEnd) ) XMP_Throw ( "Ill-formed qualified name", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (224:7): [True: 0, False: 102k]
  |  Branch (224:33): [True: 0, False: 102k]
  ------------------
  225|       |
  226|   102k|	VerifySimpleXMLName ( qualName, colonPos );
  227|   102k|	VerifySimpleXMLName ( colonPos+1, nameEnd );
  228|       |
  229|   102k|	size_t prefixLen = colonPos - qualName + 1;	// ! Include the colon.
  230|   102k|	XMP_VarString prefix ( qualName, prefixLen );
  231|   102k|	XMP_StringMapPos prefixPos = sNamespacePrefixToURIMap->find ( prefix );
  232|   102k|	if ( prefixPos == sNamespacePrefixToURIMap->end() ) {
  ------------------
  |  Branch (232:7): [True: 45, False: 102k]
  ------------------
  233|     45|		XMP_Throw ( "Unknown namespace prefix for qualified name", kXMPErr_BadXPath );
  ------------------
  |  |  199|     45|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  234|      0|	}
  235|       |
  236|   102k|}	// VerifyQualName
XMPCore_Impl.cpp:_ZL15FollowXPathStepP8XMP_NodeRKNSt3__16vectorI13XPathStepInfoNS1_9allocatorIS3_EEEEmbPNS1_11__wrap_iterIPS0_EEb:
  394|   553k|{
  395|   553k|	XMP_Node * nextNode = 0;
  396|   553k|	const XPathStepInfo & nextStep = fullPath[stepNum];
  397|   553k|	XMP_Index      index    = 0;
  398|   553k|	XMP_OptionBits stepKind = nextStep.options & kXMP_StepKindMask;
  399|       |	
  400|   553k|	XMP_Assert ( (kXMP_StructFieldStep <= stepKind) && (stepKind <= kXMP_FieldSelectorStep) );
  ------------------
  |  |  142|   553k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  401|       |
  402|   553k|	if ( stepKind == kXMP_StructFieldStep ) {
  ------------------
  |  Branch (402:7): [True: 277k, False: 276k]
  ------------------
  403|       |
  404|   277k|		nextNode = FindChildNode ( parentNode, nextStep.step.c_str(), createNodes, ptrPos );
  405|       |
  406|   277k|	} else if ( stepKind == kXMP_QualifierStep ) {
  ------------------
  |  Branch (406:14): [True: 66.6k, False: 209k]
  ------------------
  407|       |	
  408|  66.6k|		XMP_StringPtr qualStep = nextStep.step.c_str();
  409|  66.6k|		XMP_Assert ( *qualStep == '?' );
  ------------------
  |  |  142|  66.6k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  410|  66.6k|		++qualStep;
  411|  66.6k|		nextNode = FindQualifierNode ( parentNode, qualStep, createNodes, ptrPos );
  412|       |
  413|   209k|	} else {
  414|       |	
  415|       |		// This is an array indexing step. First get the index, then get the node.
  416|       |
  417|   209k|		if ( ! (parentNode->options & kXMP_PropValueIsArray) ) {
  ------------------
  |  Branch (417:8): [True: 18, False: 209k]
  ------------------
  418|     18|			XMP_Throw ( "Indexing applied to non-array", kXMPErr_BadXPath );
  ------------------
  |  |  199|     18|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  419|      0|		}
  420|       |		
  421|   209k|		if ( stepKind == kXMP_ArrayIndexStep ) {
  ------------------
  |  Branch (421:8): [True: 209k, False: 0]
  ------------------
  422|   209k|			index = FindIndexedItem ( parentNode, nextStep.step, createNodes );
  423|   209k|		} else if ( stepKind == kXMP_ArrayLastStep ) {
  ------------------
  |  Branch (423:15): [True: 0, False: 0]
  ------------------
  424|      0|			index = parentNode->children.size() - 1;
  425|      0|		} else if ( stepKind == kXMP_FieldSelectorStep ) {
  ------------------
  |  Branch (425:15): [True: 0, False: 0]
  ------------------
  426|      0|			XMP_VarString fieldName, fieldValue;
  427|      0|			SplitNameAndValue ( nextStep.step, &fieldName, &fieldValue );
  428|      0|			index = LookupFieldSelector ( parentNode, fieldName.c_str(), fieldValue.c_str() );
  429|      0|		} else if ( stepKind == kXMP_QualSelectorStep ) {
  ------------------
  |  Branch (429:15): [True: 0, False: 0]
  ------------------
  430|      0|			XMP_VarString qualName, qualValue;
  431|      0|			SplitNameAndValue ( nextStep.step, &qualName, &qualValue );
  432|      0|			index = LookupQualSelector ( parentNode, qualName, qualValue );
  433|      0|		} else {
  434|      0|			XMP_Throw ( "Unknown array indexing step in FollowXPathStep", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  435|      0|		}
  436|       |		
  437|   209k|		if ( (0 <= index) && (index <= (XMP_Index)parentNode->children.size()) ) nextNode = parentNode->children[index];
  ------------------
  |  Branch (437:8): [True: 209k, False: 4]
  |  Branch (437:24): [True: 209k, False: 0]
  ------------------
  438|       |
  439|   209k|		if ( (index == -1) && createNodes && aliasedArrayItem && (stepKind == kXMP_QualSelectorStep) ) {
  ------------------
  |  Branch (439:8): [True: 4, False: 209k]
  |  Branch (439:25): [True: 4, False: 0]
  |  Branch (439:40): [True: 0, False: 4]
  |  Branch (439:60): [True: 0, False: 0]
  ------------------
  440|       |		
  441|       |			// An ugly special case without an obvious better place to be. We have an alias to the
  442|       |			// x-default item of an alt-text array. A simple reference via SetProperty must create
  443|       |			// the x-default item if it does not yet exist.
  444|       |			
  445|      0|			XMP_Assert ( parentNode->options & kXMP_PropArrayIsAltText );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  446|      0|			XMP_Assert ( (stepNum == 2) && (nextStep.step == "[?xml:lang=\"x-default\"]") );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  447|       |
  448|      0|			nextNode = new XMP_Node ( parentNode, kXMP_ArrayItemName,
  ------------------
  |  |  293|      0|#define kXMP_ArrayItemName	"[]"
  ------------------
  449|      0|									  (kXMP_PropHasQualifiers | kXMP_PropHasLang | kXMP_NewImplicitNode) );
  ------------------
  |  |  410|      0|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  450|       |
  451|      0|			XMP_Node * langQual = new XMP_Node ( nextNode, "xml:lang", "x-default", kXMP_PropIsQualifier );
  452|      0|			nextNode->qualifiers.push_back ( langQual );
  453|       |
  454|      0|			if ( parentNode->children.empty() ) {
  ------------------
  |  Branch (454:9): [True: 0, False: 0]
  ------------------
  455|      0|				parentNode->children.push_back ( nextNode );
  456|      0|			} else {
  457|      0|				parentNode->children.insert ( parentNode->children.begin(), nextNode );
  458|      0|			}
  459|       |
  460|      0|			index = 0;	// ! C-style index! The x-default item is always first.
  461|       |
  462|      0|		}
  463|       |		
  464|   209k|		if ( (nextNode != 0) && (ptrPos != 0) ) *ptrPos = parentNode->children.begin() + index;
  ------------------
  |  Branch (464:8): [True: 209k, False: 4]
  |  Branch (464:27): [True: 209k, False: 0]
  ------------------
  465|       |	
  466|   209k|	}
  467|       |
  468|   553k|	if ( (nextNode != 0) && (nextNode->options & kXMP_NewImplicitNode) ) {
  ------------------
  |  |  410|   553k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  |  Branch (468:7): [True: 553k, False: 329]
  |  Branch (468:26): [True: 95.0k, False: 457k]
  ------------------
  469|  95.0k|		nextNode->options |= (nextStep.options & kXMP_PropArrayFormMask);
  470|  95.0k|	}
  471|       |	
  472|   553k|	XMP_Assert ( (ptrPos == 0) || (nextNode == 0) || (nextNode == **ptrPos) );
  ------------------
  |  |  142|   553k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  473|   553k|	XMP_Assert ( (nextNode != 0) || (! createNodes) );
  ------------------
  |  |  142|   553k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  474|   553k|	return nextNode;
  475|       |	
  476|   553k|}	// FollowXPathStep
XMPCore_Impl.cpp:_ZL15FindIndexedItemP8XMP_NodeRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEb:
  248|   209k|{
  249|   209k|	XMP_Index index = 0;
  250|   209k|	size_t    chLim = indexStep.size() - 1;
  251|       |
  252|   209k|	XMP_Assert ( (chLim >= 2) && (indexStep[0] == '[') && (indexStep[chLim] == ']') );
  ------------------
  |  |  142|   209k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  253|       |	
  254|   740k|	for ( size_t chNum = 1; chNum != chLim; ++chNum ) {
  ------------------
  |  Branch (254:26): [True: 530k, False: 209k]
  ------------------
  255|   530k|		XMP_Assert ( ('0' <= indexStep[chNum]) && (indexStep[chNum] <= '9') );
  ------------------
  |  |  142|   530k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  256|   530k|		index = (index * 10) + (indexStep[chNum] - '0');
  257|   530k|		if ( index < 0 ) {
  ------------------
  |  Branch (257:8): [True: 0, False: 530k]
  ------------------
  258|      0|			XMP_Throw ( "Array index overflow", kXMPErr_BadXPath );	// ! Overflow, not truly negative.
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  259|      0|		}
  260|   530k|	}
  261|       |
  262|   209k|	--index;	// Change to a C-style, zero based index.
  263|   209k|	if ( index < 0 ) XMP_Throw ( "Array index must be larger than zero", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (263:7): [True: 0, False: 209k]
  ------------------
  264|       |
  265|   209k|	if ( (index == (XMP_Index)arrayNode->children.size()) && createNodes ) {	// Append a new last+1 node.
  ------------------
  |  Branch (265:7): [True: 37.7k, False: 171k]
  |  Branch (265:59): [True: 37.7k, False: 0]
  ------------------
  266|  37.7k|		XMP_Node * newItem = new XMP_Node ( arrayNode, kXMP_ArrayItemName, kXMP_NewImplicitNode );
  ------------------
  |  |  293|  37.7k|#define kXMP_ArrayItemName	"[]"
  ------------------
              		XMP_Node * newItem = new XMP_Node ( arrayNode, kXMP_ArrayItemName, kXMP_NewImplicitNode );
  ------------------
  |  |  410|  37.7k|#define kXMP_NewImplicitNode	kXMP_InsertAfterItem
  ------------------
  267|  37.7k|		arrayNode->children.push_back ( newItem );
  268|  37.7k|	}
  269|       |
  270|       |	// ! Don't throw here for a too large index. SetProperty will throw, GetProperty will not.
  271|   209k|	if ( index >= (XMP_Index)arrayNode->children.size() ) index = -1;
  ------------------
  |  Branch (271:7): [True: 4, False: 209k]
  ------------------
  272|   209k|	return index;
  273|       |	
  274|   209k|}	// FindIndexedItem
XMPCore_Impl.cpp:_ZL19CheckImplicitStructP8XMP_NodeRKNSt3__16vectorI13XPathStepInfoNS1_9allocatorIS3_EEEEmm:
  487|  95.0k|{
  488|       |
  489|  95.0k|	if ( (stepNum < stepLim) &&
  ------------------
  |  Branch (489:7): [True: 20, False: 95.0k]
  ------------------
  490|     20|		 ((node->options & kXMP_PropCompositeMask) == 0) &&
  ------------------
  |  Branch (490:4): [True: 20, False: 0]
  ------------------
  491|     20|		 (GetStepKind ( expandedXPath[stepNum].options ) == kXMP_StructFieldStep) ) {
  ------------------
  |  |  408|     20|#define GetStepKind(f)	((f) & kXMP_StepKindMask)
  ------------------
  |  Branch (491:4): [True: 0, False: 20]
  ------------------
  492|       |
  493|      0|		node->options |= kXMP_PropValueIsStruct;
  494|       |
  495|      0|	}
  496|       |
  497|  95.0k|}	// CheckImplicitStruct
XMPCore_Impl.cpp:_ZL13DeleteSubtreeNSt3__111__wrap_iterIPP8XMP_NodeEE:
  507|     18|{
  508|     18|	XMP_Node * rootNode   = *rootNodePos;
  509|     18|	XMP_Node * rootParent = rootNode->parent;
  510|       |
  511|     18|	if ( ! (rootNode->options & kXMP_PropIsQualifier) ) {
  ------------------
  |  Branch (511:7): [True: 18, False: 0]
  ------------------
  512|       |
  513|     18|		rootParent->children.erase ( rootNodePos );
  514|       |
  515|     18|	} else {
  516|       |
  517|      0|		rootParent->qualifiers.erase ( rootNodePos );
  518|       |
  519|      0|		XMP_Assert ( rootParent->options & kXMP_PropHasQualifiers);
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  520|      0|		if ( rootParent->qualifiers.empty() ) rootParent->options ^= kXMP_PropHasQualifiers;
  ------------------
  |  Branch (520:8): [True: 0, False: 0]
  ------------------
  521|       |
  522|      0|		if ( rootNode->name == "xml:lang" ) {
  ------------------
  |  Branch (522:8): [True: 0, False: 0]
  ------------------
  523|      0|			XMP_Assert ( rootParent->options & kXMP_PropHasLang);
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  524|      0|			rootParent->options ^= kXMP_PropHasLang;
  525|      0|		} else if ( rootNode->name == "rdf:type" ) {
  ------------------
  |  Branch (525:15): [True: 0, False: 0]
  ------------------
  526|      0|			XMP_Assert ( rootParent->options & kXMP_PropHasType);
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  527|      0|			rootParent->options ^= kXMP_PropHasType;
  528|      0|		}
  529|       |
  530|      0|	}
  531|       |
  532|     18|	delete rootNode;
  533|       |
  534|     18|}	// DeleteSubtree

_ZN13XMP_AutoMutexC2Ev:
  222|   328k|	XMP_AutoMutex() : mutex(&sXMPCoreLock) { XMP_EnterCriticalRegion ( *mutex ); ReportLock(); };
  ------------------
  |  |  168|   328k|	#define ReportLock()			++sLockCount
  ------------------
_ZN13XMP_AutoMutexD2Ev:
  223|   328k|	~XMP_AutoMutex() { if ( mutex != 0 ) { ReportUnlock(); XMP_ExitCriticalRegion ( *mutex ); mutex = 0; } };
  ------------------
  |  |  169|   127k|	#define ReportUnlock()			--sLockCount
  ------------------
  |  Branch (223:26): [True: 127k, False: 201k]
  ------------------
_ZN13XMP_AutoMutex8KeepLockEv:
  224|   201k|	void KeepLock() { ReportKeepLock(); mutex = 0; };
_ZN13XPathStepInfoC2EPKcj:
  389|   388k|	XPathStepInfo ( XMP_StringPtr _step, XMP_OptionBits _options ) : step(_step), options(_options) {};
_ZN13XPathStepInfoC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEj:
  390|   417k|	XPathStepInfo ( XMP_VarString _step, XMP_OptionBits _options ) : step(_step), options(_options) {};
_ZN8XMP_NodeC2EPS_PKcj:
  434|   115k|		: options(_options), name(_name), parent(_parent)
  435|   115k|	{
  436|       |		#if XMP_DebugBuild
  437|       |			XMP_Assert ( (name.find ( ':' ) != XMP_VarString::npos) || (name == kXMP_ArrayItemName) ||
  438|       |			             (options & kXMP_SchemaNode) || (parent == 0) );
  439|       |			// *** _namePtr  = name.c_str();
  440|       |			// *** _valuePtr = value.c_str();
  441|       |		#endif
  442|   115k|	};
_ZN8XMP_NodeC2EPS_PKcS2_j:
  456|  78.4k|		: options(_options), name(_name), value(_value), parent(_parent)
  457|  78.4k|	{
  458|       |		#if XMP_DebugBuild
  459|       |			XMP_Assert ( (name.find ( ':' ) != XMP_VarString::npos) || (name == kXMP_ArrayItemName) ||
  460|       |			             (options & kXMP_SchemaNode) || (parent == 0) );
  461|       |			// *** _namePtr  = name.c_str();
  462|       |			// *** _valuePtr = value.c_str();
  463|       |		#endif
  464|  78.4k|	};
_ZN8XMP_NodeC2EPS_RKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_j:
  467|  34.9k|		: options(_options), name(_name), value(_value), parent(_parent)
  468|  34.9k|	{
  469|       |		#if XMP_DebugBuild
  470|       |			XMP_Assert ( (name.find ( ':' ) != XMP_VarString::npos) || (name == kXMP_ArrayItemName) ||
  471|       |			             (options & kXMP_SchemaNode) || (parent == 0) );
  472|       |			// *** _namePtr  = name.c_str();
  473|       |			// *** _valuePtr = value.c_str();
  474|       |		#endif
  475|  34.9k|	};
_ZN8XMP_Node14RemoveChildrenEv:
  478|   240k|	{
  479|   397k|		for ( size_t i = 0, vLim = children.size(); i < vLim; ++i ) {
  ------------------
  |  Branch (479:47): [True: 156k, False: 240k]
  ------------------
  480|   156k|			if ( children[i] != 0 ) delete children[i];
  ------------------
  |  Branch (480:9): [True: 156k, False: 46]
  ------------------
  481|   156k|		}
  482|   240k|		children.clear();
  483|   240k|	}
_ZN8XMP_Node16RemoveQualifiersEv:
  486|   234k|	{
  487|   300k|		for ( size_t i = 0, vLim = qualifiers.size(); i < vLim; ++i ) {
  ------------------
  |  Branch (487:49): [True: 66.8k, False: 234k]
  ------------------
  488|  66.8k|			if ( qualifiers[i] != 0 ) delete qualifiers[i];
  ------------------
  |  Branch (488:9): [True: 66.8k, False: 0]
  ------------------
  489|  66.8k|		}
  490|   234k|		qualifiers.clear();
  491|   234k|	}
_ZN8XMP_Node9ClearNodeEv:
  494|  4.70k|	{
  495|  4.70k|		options = 0;
  496|  4.70k|		name.erase();
  497|  4.70k|		value.erase();
  498|  4.70k|		this->RemoveChildren();
  499|  4.70k|		this->RemoveQualifiers();
  500|  4.70k|	}
_ZN8XMP_NodeD2Ev:
  502|   229k|	virtual ~XMP_Node() { RemoveChildren(); RemoveQualifiers(); };

_ZN11XMPIterator10InitializeEv:
  376|      1|{
  377|      1|	sDummySchema = new XMP_Node ( 0, "dummy:schema/", kXMP_SchemaNode);
  378|      1|	return true;
  379|       |	
  380|      1|}	// Initialize
_ZN11XMPIterator9TerminateEv:
  388|      1|{
  389|      1|	delete ( sDummySchema );
  390|      1|	sDummySchema = 0;
  391|      1|	return;
  392|       |	
  393|      1|}	// Terminate
_ZN11XMPIteratorC2ERK7XMPMetaPKcS4_j:
  427|  4.28k|						   XMP_OptionBits  options ) : clientRefs(0), info(IterInfo(options,&xmpObj))
  428|  4.28k|{
  429|  4.28k|	if ( (options & kXMP_IterClassMask) != kXMP_IterProperties ) {
  ------------------
  |  Branch (429:7): [True: 0, False: 4.28k]
  ------------------
  430|      0|		XMP_Throw ( "Unsupported iteration kind", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  431|      0|	}
  432|       |	
  433|       |	// *** Lock the XMPMeta object if we ever stop using a full DLL lock.
  434|       |
  435|  4.28k|	if ( *propName != 0 ) {
  ------------------
  |  Branch (435:7): [True: 1.50k, False: 2.77k]
  ------------------
  436|       |
  437|       |		// An iterator rooted at a specific node.
  438|       |
  439|       |		#if TraceIterators
  440|       |			printf ( "\nNew XMP property iterator for \"%s\", options = %X\n    Schema = %s, root = %s\n",
  441|       |			         xmpObj.tree.name.c_str(), options, schemaNS, propName );
  442|       |		#endif
  443|       |		
  444|  1.50k|		XMP_ExpandedXPath propPath;
  445|  1.50k|		ExpandXPath ( schemaNS, propName, &propPath );
  446|  1.50k|		XMP_Node * propNode = FindConstNode ( &xmpObj.tree, propPath );	// If not found get empty iteration.
  ------------------
  |  |  301|  1.50k|#define FindConstNode(t,p)		FindNode ( const_cast<XMP_Node*>(t), p, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|  1.50k|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
  447|       |		
  448|  1.50k|		if ( propNode != 0 ) {
  ------------------
  |  Branch (448:8): [True: 1.50k, False: 0]
  ------------------
  449|       |
  450|  1.50k|			XMP_VarString rootName ( propPath[1].step );	// The schema is [0].
  451|  1.58k|			for ( size_t i = 2; i < propPath.size(); ++i ) {
  ------------------
  |  Branch (451:24): [True: 84, False: 1.50k]
  ------------------
  452|     84|				XMP_OptionBits stepKind = GetStepKind ( propPath[i].options );
  ------------------
  |  |  408|     84|#define GetStepKind(f)	((f) & kXMP_StepKindMask)
  ------------------
  453|     84|				if ( stepKind <= kXMP_QualifierStep ) rootName += '/';
  ------------------
  |  Branch (453:10): [True: 70, False: 14]
  ------------------
  454|     84|				rootName += propPath[i].step;
  455|     84|			}
  456|       |
  457|  1.50k|			propName = rootName.c_str();
  458|  1.50k|			size_t leafOffset = rootName.size();
  459|  25.3k|			while ( (leafOffset > 0) && (propName[leafOffset] != '/') && (propName[leafOffset] != '[') ) --leafOffset;
  ------------------
  |  Branch (459:12): [True: 23.8k, False: 1.46k]
  |  Branch (459:32): [True: 23.8k, False: 42]
  |  Branch (459:65): [True: 23.8k, False: 0]
  ------------------
  460|  1.50k|			if ( propName[leafOffset] == '/' ) ++leafOffset;
  ------------------
  |  Branch (460:9): [True: 42, False: 1.46k]
  ------------------
  461|       |
  462|  1.50k|			info.tree.children.push_back ( IterNode ( propNode->options, propName, leafOffset ) );
  463|  1.50k|			SetCurrSchema ( info, propPath[kSchemaStep].step.c_str() );
  464|  1.50k|			if ( info.options & kXMP_IterJustChildren ) {
  ------------------
  |  Branch (464:9): [True: 0, False: 1.50k]
  ------------------
  465|      0|				AddNodeOffspring ( info, info.tree.children.back(), propNode );
  466|      0|			}
  467|       |
  468|  1.50k|		}
  469|       |	
  470|  2.77k|	} else if ( *schemaNS != 0 ) {
  ------------------
  |  Branch (470:14): [True: 0, False: 2.77k]
  ------------------
  471|       |
  472|       |		// An iterator for all properties in one schema.
  473|       |		
  474|       |		#if TraceIterators
  475|       |			printf ( "\nNew XMP schema iterator for \"%s\", options = %X\n    Schema = %s\n",
  476|       |			         xmpObj.tree.name.c_str(), options, schemaNS );
  477|       |		#endif
  478|       |		
  479|      0|		info.tree.children.push_back ( IterNode ( kXMP_SchemaNode, schemaNS, 0 ) );
  480|      0|		IterNode & iterSchema = info.tree.children.back();
  481|       |		
  482|      0|		XMP_Node * xmpSchema = FindConstSchema ( &xmpObj.tree, schemaNS );
  ------------------
  |  |  298|      0|#define FindConstSchema(t,u)	FindSchemaNode ( const_cast<XMP_Node*>(t), u, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|      0|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
  483|      0|		if ( xmpSchema != 0 ) AddSchemaProps ( info, iterSchema, xmpSchema );
  ------------------
  |  Branch (483:8): [True: 0, False: 0]
  ------------------
  484|       |		
  485|      0|		if ( info.options & kXMP_IterIncludeAliases ) AddSchemaAliases ( info, iterSchema, schemaNS );
  ------------------
  |  Branch (485:8): [True: 0, False: 0]
  ------------------
  486|       |		
  487|      0|		if ( iterSchema.children.empty() ) {
  ------------------
  |  Branch (487:8): [True: 0, False: 0]
  ------------------
  488|      0|			info.tree.children.pop_back();	// No properties, remove the schema node.
  489|      0|		} else {
  490|      0|			SetCurrSchema ( info, schemaNS );
  491|      0|		}
  492|       |	
  493|  2.77k|	} else {
  494|       |
  495|       |		// An iterator for all properties in all schema. First add schema that exist (have children),
  496|       |		// adding aliases from them if appropriate. Then add schema that have no actual properties
  497|       |		// but do have aliases to existing properties, if we're including aliases in the iteration.
  498|       |		
  499|       |		#if TraceIterators
  500|       |			printf ( "\nNew XMP tree iterator for \"%s\", options = %X\n",
  501|       |			         xmpObj.tree.name.c_str(), options );
  502|       |		#endif
  503|       |		
  504|       |		// First pick up the schema that exist.
  505|       |		
  506|  8.98k|		for ( size_t schemaNum = 0, schemaLim = xmpObj.tree.children.size(); schemaNum != schemaLim; ++schemaNum ) {
  ------------------
  |  Branch (506:72): [True: 6.21k, False: 2.77k]
  ------------------
  507|       |
  508|  6.21k|			const XMP_Node * xmpSchema = xmpObj.tree.children[schemaNum];
  509|  6.21k|			info.tree.children.push_back ( IterNode ( kXMP_SchemaNode, xmpSchema->name, 0 ) );
  510|  6.21k|			IterNode & iterSchema = info.tree.children.back();
  511|       |
  512|  6.21k|			if ( ! (info.options & kXMP_IterJustChildren) ) {
  ------------------
  |  Branch (512:9): [True: 6.21k, False: 0]
  ------------------
  513|  6.21k|				AddSchemaProps ( info, iterSchema, xmpSchema );
  514|  6.21k|				if ( info.options & kXMP_IterIncludeAliases ) AddSchemaAliases ( info, iterSchema, xmpSchema->name.c_str() );
  ------------------
  |  Branch (514:10): [True: 0, False: 6.21k]
  ------------------
  515|  6.21k|				if ( iterSchema.children.empty() ) info.tree.children.pop_back();	// No properties, remove the schema node.
  ------------------
  |  Branch (515:10): [True: 0, False: 6.21k]
  ------------------
  516|  6.21k|			}
  517|       |
  518|  6.21k|		}
  519|       |		
  520|  2.77k|		if ( info.options & kXMP_IterIncludeAliases ) {
  ------------------
  |  Branch (520:8): [True: 0, False: 2.77k]
  ------------------
  521|       |
  522|       |			// Add the schema that only have aliases. The most convenient, and safest way, is to go
  523|       |			// through the registered namespaces, see if it exists, and let AddSchemaAliases do its
  524|       |			// thing if not. Don't combine with the above loop, it is nicer to have the "real" stuff
  525|       |			// be in storage order (not subject to the namespace map order).
  526|       |			
  527|       |			// ! We don't do the kXMP_IterJustChildren handing in the same way here as above. The
  528|       |			// ! existing schema (presumably) have actual children. We need to call AddSchemaAliases
  529|       |			// ! here to determine if the namespace has any aliases to existing properties. We then
  530|       |			// ! strip the children if necessary.
  531|       |
  532|      0|			XMP_cStringMapPos currNS = sNamespaceURIToPrefixMap->begin();
  533|      0|			XMP_cStringMapPos endNS  = sNamespaceURIToPrefixMap->end();
  534|      0|			for ( ; currNS != endNS; ++currNS ) {
  ------------------
  |  Branch (534:12): [True: 0, False: 0]
  ------------------
  535|      0|				XMP_StringPtr schemaName = currNS->first.c_str();
  536|      0|				if ( FindConstSchema ( &xmpObj.tree, schemaName ) != 0 ) continue;
  ------------------
  |  |  298|      0|#define FindConstSchema(t,u)	FindSchemaNode ( const_cast<XMP_Node*>(t), u, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|      0|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
  |  Branch (536:10): [True: 0, False: 0]
  ------------------
  537|      0|				info.tree.children.push_back ( IterNode ( kXMP_SchemaNode, schemaName, 0 ) );
  538|      0|				IterNode & iterSchema = info.tree.children.back();
  539|      0|				AddSchemaAliases ( info, iterSchema, schemaName );
  540|      0|				if ( iterSchema.children.empty() ) {
  ------------------
  |  Branch (540:10): [True: 0, False: 0]
  ------------------
  541|      0|					info.tree.children.pop_back();	// No aliases, remove the schema node.
  542|      0|				} else if ( info.options & kXMP_IterJustChildren ) {
  ------------------
  |  Branch (542:17): [True: 0, False: 0]
  ------------------
  543|      0|					iterSchema.children.clear();	// Get rid of the children.
  544|      0|				}
  545|      0|			}
  546|       |
  547|      0|		}
  548|       |
  549|  2.77k|	}
  550|       |	
  551|       |	// Set the current iteration position to the first node to be visited.
  552|       |	
  553|  4.28k|	info.currPos = info.tree.children.begin();
  554|  4.28k|	info.endPos  = info.tree.children.end();
  555|       |	
  556|  4.28k|	if ( (info.options & kXMP_IterJustChildren) && (info.currPos != info.endPos) && (*schemaNS != 0) ) {
  ------------------
  |  Branch (556:7): [True: 0, False: 4.28k]
  |  Branch (556:49): [True: 0, False: 0]
  |  Branch (556:82): [True: 0, False: 0]
  ------------------
  557|      0|		info.currPos->visitStage = kIter_VisitSelf;
  558|      0|	}
  559|       |
  560|       |	#if TraceIterators
  561|       |		if ( info.currPos == info.endPos ) {
  562|       |			printf ( "    ** Empty iteration **\n" );
  563|       |		} else {
  564|       |			printf ( "    Initial node %s, stage = %s, iterator @ %.8X\n",
  565|       |			         info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage], this );
  566|       |		}
  567|       |	#endif
  568|       |	
  569|  4.28k|}	// XMPIterator for XMPMeta objects
_ZN11XMPIteratorD2Ev:
  591|  4.28k|{
  592|  4.28k|	XMP_Assert ( this->clientRefs <= 0 );
  ------------------
  |  |  142|  4.28k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  593|       |	// Let everything else default.
  594|       |	
  595|  4.28k|}	// ~XMPIterator
_ZN11XMPIterator4NextEPPKcPjS2_S3_S2_S3_S3_:
  617|   148k|{
  618|       |	// *** Lock the XMPMeta object if we ever stop using a full DLL lock.
  619|       |	
  620|       |	// ! NOTE: Supporting aliases throws in some nastiness with schemas. There might not be any XMP
  621|       |	// ! node for the schema, but we still have to visit it because of possible aliases.
  622|       |	
  623|   148k|	if ( info.currPos == info.endPos ) return false;	// Happens at the start of an empty iteration.
  ------------------
  |  Branch (623:7): [True: 466, False: 148k]
  ------------------
  624|       |	
  625|       |	#if TraceIterators
  626|       |		printf ( "Next iteration from %s, stage = %s, iterator @ %.8X\n",
  627|       |			     info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage], this );
  628|       |	#endif
  629|       |	
  630|   148k|	const XMP_Node * xmpNode = GetNextXMPNode ( info );
  631|   148k|	if ( xmpNode == 0 ) return false;
  ------------------
  |  Branch (631:7): [True: 3.51k, False: 144k]
  ------------------
  632|   144k|	bool isSchemaNode = XMP_NodeIsSchema ( info.currPos->options );
  633|       |	
  634|   144k|	if ( info.options & kXMP_IterJustLeafNodes ) {
  ------------------
  |  Branch (634:7): [True: 0, False: 144k]
  ------------------
  635|      0|		while ( isSchemaNode || (! xmpNode->children.empty()) ) {
  ------------------
  |  Branch (635:11): [True: 0, False: 0]
  |  Branch (635:27): [True: 0, False: 0]
  ------------------
  636|      0|			info.currPos->visitStage = kIter_VisitQualifiers;	// Skip to this node's children.
  637|      0|			xmpNode = GetNextXMPNode ( info );
  638|      0|			if ( xmpNode == 0 ) return false;
  ------------------
  |  Branch (638:9): [True: 0, False: 0]
  ------------------
  639|      0|			isSchemaNode = XMP_NodeIsSchema ( info.currPos->options );
  640|      0|		}
  641|      0|	}
  642|       |	
  643|   144k|	*schemaNS = info.currSchema.c_str();
  644|   144k|	*nsSize   = info.currSchema.size();
  645|       |
  646|   144k|	*propOptions = info.currPos->options;
  647|       |
  648|   144k|	*propPath  = "";
  649|   144k|	*pathSize  = 0;
  650|   144k|	*propValue = "";
  651|   144k|	*valueSize = 0;
  652|       |	
  653|   144k|	if ( ! (*propOptions & kXMP_SchemaNode) ) {
  ------------------
  |  Branch (653:7): [True: 138k, False: 6.18k]
  ------------------
  654|       |
  655|   138k|		*propPath = info.currPos->fullPath.c_str();
  656|   138k|		*pathSize = info.currPos->fullPath.size();
  657|   138k|		if ( info.options & kXMP_IterJustLeafName ) {
  ------------------
  |  Branch (657:8): [True: 0, False: 138k]
  ------------------
  658|      0|			*propPath += info.currPos->leafOffset;
  659|      0|			*pathSize -= info.currPos->leafOffset;
  660|      0|		}
  661|       |		
  662|   138k|		if ( ! (*propOptions & kXMP_PropCompositeMask) ) {
  ------------------
  |  Branch (662:8): [True: 129k, False: 9.33k]
  ------------------
  663|   129k|			*propValue = xmpNode->value.c_str();
  664|   129k|			*valueSize = xmpNode->value.size();
  665|   129k|		}
  666|       |
  667|   138k|	}
  668|       |	
  669|       |	#if TraceIterators
  670|       |		printf ( "    Next node %s, stage = %s\n",
  671|       |			     info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage] );
  672|       |	#endif
  673|       |	
  674|   144k|	return true;
  675|       |
  676|   144k|}	// Next
_ZN11XMPIterator10UnlockIterEj:
  729|   144k|{
  730|   144k|	UNUSED(options);
  731|       |
  732|   144k|	XMPMeta::Unlock ( 0 );
  733|       |	
  734|   144k|}	// UnlockIter
XMPIterator.cpp:_ZL13SetCurrSchemaR8IterInfoPKc:
  181|  1.50k|{
  182|       |
  183|  1.50k|	info.currSchema = schemaName;
  184|       |	#if 0	// *** XMP_DebugBuild
  185|       |		info._schemaPtr = info.currSchema.c_str();
  186|       |	#endif
  187|       |
  188|  1.50k|}	// SetCurrSchema
XMPIterator.cpp:_ZL16AddNodeOffspringR8IterInfoR8IterNodePK8XMP_Node:
  114|   138k|{
  115|   138k|	XMP_VarString currPath ( iterParent.fullPath );
  116|   138k|	size_t        leafOffset = iterParent.fullPath.size();
  117|       |	
  118|   138k|	if ( (! xmpParent->qualifiers.empty()) && (! (info.options & kXMP_IterOmitQualifiers)) ) {
  ------------------
  |  Branch (118:7): [True: 10.0k, False: 128k]
  |  Branch (118:44): [True: 10.0k, False: 0]
  ------------------
  119|       |
  120|       |		#if TraceIterators
  121|       |			printf ( "    Adding qualifiers of %s\n", currPath.c_str() );
  122|       |		#endif
  123|       |
  124|  10.0k|		currPath += "/?";	// All qualifiers are named and use paths like "Prop/?Qual".
  125|  10.0k|		leafOffset += 2;
  126|       |		
  127|  45.3k|		for ( size_t qualNum = 0, qualLim = xmpParent->qualifiers.size(); qualNum != qualLim; ++qualNum ) {
  ------------------
  |  Branch (127:69): [True: 35.3k, False: 10.0k]
  ------------------
  128|  35.3k|			const XMP_Node * xmpQual = xmpParent->qualifiers[qualNum];
  129|  35.3k|			currPath += xmpQual->name;
  130|  35.3k|			iterParent.qualifiers.push_back ( IterNode ( xmpQual->options, currPath, leafOffset ) );
  131|  35.3k|			currPath.erase ( leafOffset );
  132|       |			#if TraceIterators
  133|       |				printf ( "        %s\n", xmpQual->name.c_str() );
  134|       |			#endif
  135|  35.3k|		}
  136|       |		
  137|  10.0k|		leafOffset -= 2;
  138|  10.0k|		currPath.erase ( leafOffset );
  139|       |
  140|  10.0k|	}
  141|       |
  142|   138k|	if ( ! xmpParent->children.empty() ) {
  ------------------
  |  Branch (142:7): [True: 9.29k, False: 129k]
  ------------------
  143|       |	
  144|       |		#if TraceIterators
  145|       |			printf ( "    Adding children of %s\n", currPath.c_str() );
  146|       |		#endif
  147|       |
  148|  9.29k|		XMP_Assert ( xmpParent->options & kXMP_PropCompositeMask );
  ------------------
  |  |  142|  9.29k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  149|       |		
  150|  9.29k|		if ( xmpParent->options & kXMP_PropValueIsStruct ) {
  ------------------
  |  Branch (150:8): [True: 5.57k, False: 3.71k]
  ------------------
  151|  5.57k|			currPath += '/';
  152|  5.57k|			leafOffset += 1;
  153|  5.57k|		}
  154|       |		
  155|   108k|		for ( size_t childNum = 0, childLim = xmpParent->children.size(); childNum != childLim; ++childNum ) {
  ------------------
  |  Branch (155:69): [True: 99.1k, False: 9.29k]
  ------------------
  156|  99.1k|			const XMP_Node * xmpChild = xmpParent->children[childNum];
  157|  99.1k|			if ( ! (xmpParent->options & kXMP_PropValueIsArray) ) {
  ------------------
  |  Branch (157:9): [True: 18.8k, False: 80.2k]
  ------------------
  158|  18.8k|				currPath += xmpChild->name;
  159|  80.2k|			} else {
  160|  80.2k|				char buffer [32];	// AUDIT: Using sizeof(buffer) below for snprintf length is safe.
  161|  80.2k|				snprintf ( buffer, sizeof(buffer), "[%lu]", static_cast<unsigned long>(childNum+1) );	// ! XPath indices are one-based.
  162|  80.2k|				currPath += buffer;
  163|  80.2k|			}
  164|  99.1k|			iterParent.children.push_back ( IterNode ( xmpChild->options, currPath, leafOffset ) );
  165|  99.1k|			currPath.erase ( leafOffset );
  166|       |			#if TraceIterators
  167|       |				printf ( "        %s\n", (iterParent.children.back().fullPath.c_str() + leafOffset) );
  168|       |			#endif
  169|  99.1k|		}
  170|       |	
  171|  9.29k|	}
  172|       |
  173|   138k|}	// AddNodeOffspring
XMPIterator.cpp:_ZL14AddSchemaPropsR8IterInfoR8IterNodePK8XMP_Node:
   48|  6.21k|{
   49|  6.21k|	UNUSED(info);
   50|       |	#if TraceIterators
   51|       |		printf ( "    Adding properties of %s\n", xmpSchema->name.c_str() );
   52|       |	#endif
   53|       |
   54|  18.7k|	for ( size_t propNum = 0, propLim = xmpSchema->children.size(); propNum != propLim; ++propNum ) {
  ------------------
  |  Branch (54:66): [True: 12.5k, False: 6.21k]
  ------------------
   55|  12.5k|		const XMP_Node * xmpProp = xmpSchema->children[propNum];
   56|       |		// *** set the has-aliases bit when appropriate
   57|  12.5k|		iterSchema.children.push_back ( IterNode ( xmpProp->options, xmpProp->name, 0 ) );
   58|       |		#if TraceIterators
   59|       |			printf ( "        %s\n", xmpProp->name.c_str() );
   60|       |		#endif
   61|  12.5k|	}
   62|       |
   63|  6.21k|}	// AddSchemaProps
XMPIterator.cpp:_ZL14GetNextXMPNodeR8IterInfo:
  308|   148k|{
  309|   148k|	const XMP_Node * xmpNode = 0;
  310|       |
  311|       |	// ----------------------------------------------------------------------------------------------
  312|       |	// On entry currPos points to an iteration node whose state is either before-visit or visit-self.
  313|       |	// If it is before-visit then we will return that node's value part now. If it is visit-self it
  314|       |	// means the previous iteration returned the value portion of that node, so we can advance to the
  315|       |	// next node in the iteration tree. Then we find the corresponding XMP node, allowing for the XMP
  316|       |	// tree to have been modified since that part of the iteration tree was constructed.
  317|       |	
  318|       |	// ! NOTE: Supporting aliases throws in some nastiness with schemas. There might not be any XMP
  319|       |	// ! node for the schema, but we still have to visit it because of possible aliases. The static
  320|       |	// ! sDummySchema is returned if there is no real schema node.
  321|       |
  322|   148k|	if ( info.currPos->visitStage != kIter_BeforeVisit ) AdvanceIterPos ( info );
  ------------------
  |  Branch (322:7): [True: 144k, False: 3.81k]
  ------------------
  323|       |	
  324|   148k|	bool isSchemaNode = false;
  325|   148k|	XMP_ExpandedXPath expPath;	// Keep outside the loop to avoid constant construct/destruct.
  326|       |	
  327|   148k|	while ( info.currPos != info.endPos ) {
  ------------------
  |  Branch (327:10): [True: 144k, False: 3.57k]
  ------------------
  328|       |
  329|   144k|		isSchemaNode = XMP_NodeIsSchema ( info.currPos->options );
  330|   144k|		if ( isSchemaNode ) {
  ------------------
  |  Branch (330:8): [True: 6.13k, False: 138k]
  ------------------
  331|  6.13k|			SetCurrSchema ( info, info.currPos->fullPath );
  332|  6.13k|			xmpNode = FindConstSchema ( &info.xmpObj->tree, info.currPos->fullPath.c_str() );
  ------------------
  |  |  298|  6.13k|#define FindConstSchema(t,u)	FindSchemaNode ( const_cast<XMP_Node*>(t), u, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|  6.13k|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
  333|  6.13k|			if ( xmpNode == 0 ) xmpNode = sDummySchema;
  ------------------
  |  Branch (333:9): [True: 0, False: 6.13k]
  ------------------
  334|   138k|		} else {
  335|   138k|			ExpandXPath ( info.currSchema.c_str(), info.currPos->fullPath.c_str(), &expPath );
  336|   138k|			xmpNode = FindConstNode ( &info.xmpObj->tree, expPath );
  ------------------
  |  |  301|   138k|#define FindConstNode(t,p)		FindNode ( const_cast<XMP_Node*>(t), p, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|   138k|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
  337|   138k|		}
  338|   144k|		if ( xmpNode != 0 ) break;	// Exit the loop, we found a live XMP node.
  ------------------
  |  Branch (338:8): [True: 144k, False: 58]
  ------------------
  339|       |
  340|     58|		info.currPos->visitStage = kIter_VisitChildren;	// Make AdvanceIterPos move to the next sibling.
  341|     58|		info.currPos->children.clear();
  342|     58|		info.currPos->qualifiers.clear();
  343|     58|		AdvanceIterPos ( info );
  344|       |
  345|     58|	}
  346|       |
  347|   148k|	if ( info.currPos == info.endPos ) return 0;
  ------------------
  |  Branch (347:7): [True: 3.51k, False: 144k]
  ------------------
  348|       |	
  349|       |	// -------------------------------------------------------------------------------------------
  350|       |	// Now we've got the iteration node and corresponding XMP node. Add the iteration children for
  351|       |	// structs and arrays. The children of schema were added when the iterator was constructed.
  352|       |
  353|   144k|	XMP_Assert ( info.currPos->visitStage == kIter_BeforeVisit );
  ------------------
  |  |  142|   144k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  354|       |
  355|   144k|	if ( info.currPos->visitStage == kIter_BeforeVisit ) {
  ------------------
  |  Branch (355:7): [True: 144k, False: 58]
  ------------------
  356|   144k|		if ( (! isSchemaNode) && (! (info.options & kXMP_IterJustChildren)) ) {
  ------------------
  |  Branch (356:8): [True: 138k, False: 6.13k]
  |  Branch (356:28): [True: 138k, False: 0]
  ------------------
  357|   138k|			AddNodeOffspring ( info, *info.currPos, xmpNode );
  358|   138k|		}
  359|   144k|		info.currPos->visitStage = kIter_VisitSelf;
  360|   144k|	}
  361|       |	
  362|   144k|	return xmpNode;
  363|       |
  364|   148k|}	// GetNextXMPNode
XMPIterator.cpp:_ZL13SetCurrSchemaR8IterInfoRNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  192|  9.95k|{
  193|       |
  194|  9.95k|	info.currSchema = schemaName;
  195|       |	#if 0	// *** XMP_DebugBuild
  196|       |		info._schemaPtr = info.currSchema.c_str();
  197|       |	#endif
  198|       |
  199|  9.95k|}	// SetCurrSchema
XMPIterator.cpp:_ZL14AdvanceIterPosR8IterInfo:
  212|   144k|{
  213|       |	// -------------------------------------------------------------------------------------------
  214|       |	// Keep looking until we find a node to visit or the end of everything. The first time through
  215|       |	// the current node will exist, we just visited it. But we have to keep looking if the current
  216|       |	// node was the last of its siblings or is an empty schema.
  217|       |	
  218|       |	// ! It is possible that info.currPos == info.endPos on entry. Don't dereference info.currPos yet!
  219|       |
  220|   313k|	while ( true ) {
  ------------------
  |  Branch (220:10): [True: 313k, Folded]
  ------------------
  221|       |	
  222|   313k|		if ( info.currPos == info.endPos ) {
  ------------------
  |  Branch (222:8): [True: 28.5k, False: 285k]
  ------------------
  223|       |		
  224|       |			// ------------------------------------------------------------------------------------
  225|       |			// At the end of a set of siblings, move up to an ancestor. We've either just finished
  226|       |			// the qualifiers and will move to the children, or have just finished the children and
  227|       |			// will move on to the next sibling.
  228|       |			
  229|  28.5k|			if ( info.ancestors.empty() ) break;	// We're at the end of the schema list.
  ------------------
  |  Branch (229:9): [True: 3.51k, False: 24.9k]
  ------------------
  230|       |
  231|  24.9k|			IterPosPair & parent = info.ancestors.back();
  232|  24.9k|			info.currPos = parent.first;
  233|  24.9k|			info.endPos  = parent.second;
  234|  24.9k|			info.ancestors.pop_back();
  235|       |			
  236|       |			#if TraceIterators
  237|       |				printf ( "    Moved up to %s, stage = %s\n",
  238|       |				         info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage] );
  239|       |			#endif
  240|       |		
  241|   285k|		} else {
  242|       |			
  243|       |			// -------------------------------------------------------------------------------------------
  244|       |			// Decide what to do with this iteration node based on its state. Don't use a switch statement,
  245|       |			// some of the cases want to break from the loop. A break in a switch just exits the case.
  246|       |			
  247|       |			#if TraceIterators
  248|       |				printf ( "    Moving from %s, stage = %s\n",
  249|       |				         info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage] );
  250|       |			#endif
  251|       |			
  252|   285k|			if ( info.currPos->visitStage == kIter_BeforeVisit ) {		// Visit this node now.
  ------------------
  |  Branch (252:9): [True: 115k, False: 169k]
  ------------------
  253|   115k|				if ( info.currPos->options & kXMP_SchemaNode ) SetCurrSchema ( info, info.currPos->fullPath );
  ------------------
  |  Branch (253:10): [True: 3.82k, False: 111k]
  ------------------
  254|   115k|				break;
  255|   115k|			}
  256|       |
  257|   169k|			if ( info.currPos->visitStage == kIter_VisitSelf ) {		// Just finished visiting the value portion.
  ------------------
  |  Branch (257:9): [True: 144k, False: 24.9k]
  ------------------
  258|   144k|				info.currPos->visitStage = kIter_VisitQualifiers;		// Start visiting the qualifiers.
  259|   144k|				if ( ! info.currPos->qualifiers.empty() ) {
  ------------------
  |  Branch (259:10): [True: 9.97k, False: 134k]
  ------------------
  260|  9.97k|					info.ancestors.push_back ( IterPosPair ( info.currPos, info.endPos ) );
  261|  9.97k|					info.endPos  = info.currPos->qualifiers.end();		// ! Set the parent's endPos before changing currPos!
  262|  9.97k|					info.currPos = info.currPos->qualifiers.begin();
  263|  9.97k|					break;
  264|  9.97k|				}
  265|   144k|			}
  266|       |
  267|   159k|			if ( info.currPos->visitStage == kIter_VisitQualifiers ) {	// Just finished visiting the qualifiers.
  ------------------
  |  Branch (267:9): [True: 144k, False: 15.0k]
  ------------------
  268|   144k|				info.currPos->qualifiers.clear();
  269|   144k|				info.currPos->visitStage = kIter_VisitChildren;			// Start visiting the children.
  270|   144k|				if ( ! info.currPos->children.empty() ) {
  ------------------
  |  Branch (270:10): [True: 15.3k, False: 129k]
  ------------------
  271|  15.3k|					info.ancestors.push_back ( IterPosPair ( info.currPos, info.endPos ) );
  272|  15.3k|					info.endPos  = info.currPos->children.end();		// ! Set the parent's endPos before changing currPos!
  273|  15.3k|					info.currPos = info.currPos->children.begin();
  274|  15.3k|					break;
  275|  15.3k|				}
  276|   144k|			}
  277|       |
  278|   144k|			if ( info.currPos->visitStage == kIter_VisitChildren ) {	// Just finished visiting the children.
  ------------------
  |  Branch (278:9): [True: 144k, False: 0]
  ------------------
  279|   144k|				info.currPos->children.clear();
  280|   144k|				++info.currPos;											// Move to the next sibling.
  281|   144k|				continue;
  282|   144k|			}
  283|       |			
  284|       |			#if TraceIterators
  285|       |				if ( info.currPos != info.endPos ) {
  286|       |					printf ( "    Moved to %s, stage = %s\n",
  287|       |					         info.currPos->fullPath.c_str(), sStageNames[info.currPos->visitStage] );
  288|       |				}
  289|       |			#endif
  290|       |			
  291|   144k|		}
  292|       |
  293|   313k|	}	// Loop to find the next node.
  294|       |	
  295|   144k|	XMP_Assert ( (info.currPos == info.endPos) || (info.currPos->visitStage == kIter_BeforeVisit) );
  ------------------
  |  |  142|   144k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  296|       |
  297|   144k|}	// AdvanceIterPos

_ZN8IterNodeC2Ev:
   43|  4.28k|	IterNode() : options(0), leafOffset(0), visitStage(kIter_BeforeVisit)
   44|  4.28k|	{
   45|       |		#if 0	// *** XMP_DebugBuild
   46|       |			_pathPtr = _leafPtr = 0;
   47|       |		#endif
   48|  4.28k|	};
_ZN8IterNodeC2EjRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEm:
   51|   154k|			 : options(_options), fullPath(_fullPath), leafOffset(_leafOffset), visitStage(kIter_BeforeVisit)
   52|   154k|	{
   53|       |		#if 0	// *** XMP_DebugBuild
   54|       |			_pathPtr = fullPath.c_str();
   55|       |			_leafPtr = _pathPtr + leafOffset;
   56|       |		#endif
   57|   154k|	};
_ZN8IterInfoC2EjPK7XMPMeta:
   80|  4.28k|	IterInfo ( XMP_OptionBits _options, const XMPMeta * _xmpObj ) : options(_options), xmpObj(_xmpObj)
   81|  4.28k|	{
   82|       |		#if 0	// *** XMP_DebugBuild
   83|       |			_schemaPtr = 0;
   84|       |		#endif
   85|  4.28k|	};

_ZN7XMPMeta11SetPropertyEPKcS1_S1_j:
  454|  94.5k|{
  455|  94.5k|	XMP_Assert ( (schemaNS != 0) && (propName != 0) );	// Enforced by wrapper.
  ------------------
  |  |  142|  94.5k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  456|       |
  457|  94.5k|	options = VerifySetOptions ( options, propValue );
  458|       |
  459|  94.5k|	XMP_ExpandedXPath expPath;
  460|  94.5k|	ExpandXPath ( schemaNS, propName, &expPath );
  461|       |
  462|  94.5k|	XMP_Node * propNode = FindNode ( &tree, expPath, kXMP_CreateNodes, options );
  ------------------
  |  |  295|  94.5k|#define kXMP_CreateNodes	true
  ------------------
  463|  94.5k|	if ( propNode == 0 ) XMP_Throw ( "Specified property does not exist", kXMPErr_BadXPath );
  ------------------
  |  |  199|      4|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (463:7): [True: 4, False: 94.5k]
  ------------------
  464|       |	
  465|  94.5k|	SetNode ( propNode, propValue, options );
  466|       |	
  467|  94.5k|}	// SetProperty
_ZN7XMPMeta15AppendArrayItemEPKcS1_jS1_j:
  503|  2.33k|{
  504|  2.33k|	XMP_Assert ( (schemaNS != 0) && (arrayName != 0) );	// Enforced by wrapper.
  ------------------
  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  505|       |
  506|  2.33k|	arrayOptions = VerifySetOptions ( arrayOptions, 0 );
  507|  2.33k|	if ( (arrayOptions & ~kXMP_PropArrayFormMask) != 0 ) {
  ------------------
  |  Branch (507:7): [True: 0, False: 2.33k]
  ------------------
  508|      0|		XMP_Throw ( "Only array form flags allowed for arrayOptions", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  509|      0|	}
  510|       |	
  511|       |	// Locate or create the array. If it already exists, make sure the array form from the options
  512|       |	// parameter is compatible with the current state.
  513|       |	
  514|  2.33k|	XMP_ExpandedXPath arrayPath;
  515|  2.33k|	ExpandXPath ( schemaNS, arrayName, &arrayPath );
  516|  2.33k|	XMP_Node * arrayNode = FindNode ( &tree, arrayPath, kXMP_ExistingOnly );	// Just lookup, don't try to create.
  ------------------
  |  |  296|  2.33k|#define kXMP_ExistingOnly	false
  ------------------
  517|       |	
  518|  2.33k|	if ( arrayNode != 0 ) {
  ------------------
  |  Branch (518:7): [True: 1.78k, False: 551]
  ------------------
  519|       |		// The array exists, make sure the form is compatible. Zero arrayForm means take what exists.
  520|  1.78k|		if ( ! (arrayNode->options & kXMP_PropValueIsArray) ) {
  ------------------
  |  Branch (520:8): [True: 0, False: 1.78k]
  ------------------
  521|      0|			XMP_Throw ( "The named property is not an array", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  522|      0|		}
  523|       |		#if 0
  524|       |			// *** Disable for now. Need to do some general rethinking of semantic checks.
  525|       |			if ( (arrayOptions != 0) && (arrayOptions != (arrayNode->options & kXMP_PropArrayFormMask)) ) {
  526|       |				XMP_Throw ( "Mismatch of existing and specified array form", kXMPErr_BadOptions );
  527|       |			}
  528|       |		#endif
  529|  1.78k|	} else {
  530|       |		// The array does not exist, try to create it.
  531|    551|		if ( arrayOptions == 0 ) XMP_Throw ( "Explicit arrayOptions required to create new array", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (531:8): [True: 0, False: 551]
  ------------------
  532|    551|		arrayNode = FindNode ( &tree, arrayPath, kXMP_CreateNodes, arrayOptions );
  ------------------
  |  |  295|    551|#define kXMP_CreateNodes	true
  ------------------
  533|    551|		if ( arrayNode == 0 ) XMP_Throw ( "Failure creating array node", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (533:8): [True: 0, False: 551]
  ------------------
  534|    551|	}
  535|       |	
  536|  2.33k|	DoSetArrayItem ( arrayNode, kXMP_ArrayLastItem, itemValue, (options | kXMP_InsertAfterItem) );
  537|       |	
  538|  2.33k|}	// AppendArrayItem
_ZN7XMPMeta12SetQualifierEPKcS1_S1_S1_S1_j:
  575|  2.33k|{
  576|  2.33k|	XMP_Assert ( (schemaNS != 0) && (propName != 0) && (qualNS != 0) && (qualName != 0) );	// Enforced by wrapper.
  ------------------
  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  577|       |
  578|  2.33k|	XMP_StringPtr	qualPath;
  579|  2.33k|	XMP_StringLen	pathLen;
  580|       |
  581|  2.33k|	XMP_ExpandedXPath expPath;
  582|  2.33k|	ExpandXPath ( schemaNS, propName, &expPath );
  583|  2.33k|	XMP_Node * propNode = FindNode ( &tree, expPath, kXMP_ExistingOnly );
  ------------------
  |  |  296|  2.33k|#define kXMP_ExistingOnly	false
  ------------------
  584|  2.33k|	if ( propNode == 0 ) XMP_Throw ( "Specified property does not exist", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (584:7): [True: 0, False: 2.33k]
  ------------------
  585|       |
  586|  2.33k|	XMPUtils::ComposeQualifierPath ( schemaNS, propName, qualNS, qualName, &qualPath, &pathLen );
  587|  2.33k|	SetProperty ( schemaNS, qualPath, qualValue, options );
  588|       |
  589|  2.33k|}	// SetQualifier
XMPMeta-GetSet.cpp:_ZL7SetNodeP8XMP_NodePKcj:
  117|  96.8k|{
  118|  96.8k|	if ( options & kXMP_DeleteExisting ) {
  ------------------
  |  Branch (118:7): [True: 0, False: 96.8k]
  ------------------
  119|      0|		XMP_ClearOption ( options, kXMP_DeleteExisting );
  120|      0|		node->options = options;
  121|      0|		node->value.erase();
  122|      0|		node->RemoveChildren();
  123|      0|		node->RemoveQualifiers();
  124|      0|	}
  125|       |	
  126|  96.8k|	node->options |= options;	// Keep options set by FindNode when creating a new node.
  127|       |
  128|  96.8k|	if ( value != 0 ) {
  ------------------
  |  Branch (128:7): [True: 89.9k, False: 6.88k]
  ------------------
  129|       |	
  130|       |		// This is setting the value of a leaf node.
  131|  89.9k|		if ( node->options & kXMP_PropCompositeMask ) XMP_Throw ( "Composite nodes can't have values", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (131:8): [True: 0, False: 89.9k]
  ------------------
  132|  89.9k|		XMP_Assert ( node->children.empty() );
  ------------------
  |  |  142|  89.9k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  133|  89.9k|		SetNodeValue ( node, value );
  134|       |	
  135|  89.9k|	} else {
  136|       |	
  137|       |		// This is setting up an array or struct.
  138|  6.88k|		if ( ! node->value.empty() ) XMP_Throw ( "Composite nodes can't have values", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (138:8): [True: 0, False: 6.88k]
  ------------------
  139|  6.88k|		if ( node->options & kXMP_PropCompositeMask ) {	// Can't change an array to a struct, or vice versa.
  ------------------
  |  Branch (139:8): [True: 5.74k, False: 1.14k]
  ------------------
  140|  5.74k|			if ( (options & kXMP_PropCompositeMask) != (node->options & kXMP_PropCompositeMask) ) {
  ------------------
  |  Branch (140:9): [True: 1, False: 5.74k]
  ------------------
  141|      1|				XMP_Throw ( "Requested and existing composite form mismatch", kXMPErr_BadXPath );
  ------------------
  |  |  199|      1|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  142|      0|			}
  143|  5.74k|		}
  144|  6.88k|		node->RemoveChildren();
  145|       |	
  146|  6.88k|	}
  147|       |	
  148|  96.8k|}	// SetNode
XMPMeta-GetSet.cpp:_ZL14DoSetArrayItemP8XMP_NodeiPKcj:
  160|  2.33k|{
  161|  2.33k|	XMP_OptionBits itemLoc = options & kXMP_PropArrayLocationMask;
  162|  2.33k|	XMP_Index      arraySize = arrayNode->children.size();
  163|       |	
  164|  2.33k|	options &= ~kXMP_PropArrayLocationMask;
  165|  2.33k|	options = VerifySetOptions ( options, itemValue );
  166|       |	
  167|       |	// Now locate or create the item node and set the value. Note the index parameter is one-based!
  168|       |	// The index can be in the range [0..size+1] or "last", normalize it and check the insert flags.
  169|       |	// The order of the normalization checks is important. If the array is empty we end up with an
  170|       |	// index and location to set item size+1.
  171|       |	
  172|  2.33k|	XMP_Node * itemNode = 0;
  173|       |	
  174|  2.33k|	if ( itemIndex == kXMP_ArrayLastItem ) itemIndex = arraySize;
  ------------------
  |  Branch (174:7): [True: 2.33k, False: 0]
  ------------------
  175|  2.33k|	if ( (itemIndex == 0) && (itemLoc == kXMP_InsertAfterItem) ) {
  ------------------
  |  Branch (175:7): [True: 551, False: 1.78k]
  |  Branch (175:27): [True: 551, False: 0]
  ------------------
  176|    551|		itemIndex = 1;
  177|    551|		itemLoc = kXMP_InsertBeforeItem;
  178|    551|	}
  179|  2.33k|	if ( (itemIndex == arraySize) && (itemLoc == kXMP_InsertAfterItem) ) {
  ------------------
  |  Branch (179:7): [True: 1.78k, False: 551]
  |  Branch (179:35): [True: 1.78k, False: 0]
  ------------------
  180|  1.78k|		itemIndex += 1;
  181|  1.78k|		itemLoc = 0;
  182|  1.78k|	}
  183|  2.33k|	if ( (itemIndex == arraySize+1) && (itemLoc == kXMP_InsertBeforeItem) ) itemLoc = 0;
  ------------------
  |  Branch (183:7): [True: 2.33k, False: 0]
  |  Branch (183:37): [True: 551, False: 1.78k]
  ------------------
  184|       |	
  185|  2.33k|	if ( itemIndex == arraySize+1 ) {
  ------------------
  |  Branch (185:7): [True: 2.33k, False: 0]
  ------------------
  186|       |
  187|  2.33k|		if ( itemLoc != 0 ) XMP_Throw ( "Can't insert before or after implicit new item", kXMPErr_BadIndex );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (187:8): [True: 0, False: 2.33k]
  ------------------
  188|  2.33k|		itemNode = new XMP_Node ( arrayNode, kXMP_ArrayItemName, 0 );
  ------------------
  |  |  293|  2.33k|#define kXMP_ArrayItemName	"[]"
  ------------------
  189|  2.33k|		arrayNode->children.push_back ( itemNode );
  190|       |
  191|  2.33k|	} else {
  192|       |
  193|      0|		if ( (itemIndex < 1) || (itemIndex > arraySize) ) XMP_Throw ( "Array index out of bounds", kXMPErr_BadIndex );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (193:8): [True: 0, False: 0]
  |  Branch (193:27): [True: 0, False: 0]
  ------------------
  194|      0|		--itemIndex;	// ! Convert the index to a C zero-based value!
  195|      0|		if ( itemLoc == 0 ) {
  ------------------
  |  Branch (195:8): [True: 0, False: 0]
  ------------------
  196|      0|			itemNode = arrayNode->children[itemIndex];
  197|      0|		} else {
  198|      0|			XMP_NodePtrPos itemPos = arrayNode->children.begin() + itemIndex;
  199|      0|			if ( itemLoc == kXMP_InsertAfterItem ) ++itemPos;
  ------------------
  |  Branch (199:9): [True: 0, False: 0]
  ------------------
  200|      0|			itemNode = new XMP_Node ( arrayNode, kXMP_ArrayItemName, 0 );
  ------------------
  |  |  293|      0|#define kXMP_ArrayItemName	"[]"
  ------------------
  201|      0|			itemPos = arrayNode->children.insert ( itemPos, itemNode );
  202|      0|		}
  203|       |
  204|      0|	}
  205|       |	
  206|  2.33k|	SetNode ( itemNode, itemValue, options );
  207|       |	
  208|  2.33k|}	// DoSetArrayItem
XMPMeta-GetSet.cpp:_ZL12SetNodeValueP8XMP_NodePKc:
   76|  89.9k|{
   77|       |
   78|       |	#if XMP_DebugBuild	// ! Hack to force an assert.
   79|       |		if ( (node->name == "xmp:TestAssertNotify") && XMP_LitMatch ( value, "DoIt!" ) ) {
   80|       |			XMP_Assert ( node->name != "xmp:TestAssertNotify" );
   81|       |		}
   82|       |	#endif
   83|       |	
   84|  89.9k|	node->value = value;
   85|       |	
   86|  89.9k|	XMP_Uns8* chPtr = (XMP_Uns8*) node->value.c_str();	// Check for valid UTF-8, replace ASCII controls with a space.
   87|   186k|	while ( *chPtr != 0 ) {
  ------------------
  |  Branch (87:10): [True: 96.1k, False: 89.9k]
  ------------------
   88|  11.4M|		while ( (*chPtr != 0) && (*chPtr < 0x80) ) {
  ------------------
  |  Branch (88:11): [True: 11.3M, False: 89.7k]
  |  Branch (88:28): [True: 11.3M, False: 6.41k]
  ------------------
   89|  11.3M|			if ( *chPtr < 0x20 ) {
  ------------------
  |  Branch (89:9): [True: 41.2k, False: 11.3M]
  ------------------
   90|  41.2k|				if ( (*chPtr != kTab) && (*chPtr != kLF) && (*chPtr != kCR) ) *chPtr = 0x20;
  ------------------
  |  |  100|  41.2k|#define kTab ((char)0x09)
  ------------------
              				if ( (*chPtr != kTab) && (*chPtr != kLF) && (*chPtr != kCR) ) *chPtr = 0x20;
  ------------------
  |  |  101|  39.7k|#define kLF ((char)0x0A)
  ------------------
              				if ( (*chPtr != kTab) && (*chPtr != kLF) && (*chPtr != kCR) ) *chPtr = 0x20;
  ------------------
  |  |  102|    984|#define kCR ((char)0x0D)
  ------------------
  |  Branch (90:10): [True: 39.7k, False: 1.45k]
  |  Branch (90:30): [True: 984, False: 38.7k]
  |  Branch (90:49): [True: 717, False: 267]
  ------------------
   91|  11.3M|			} else if (*chPtr == 0x7F ) {
  ------------------
  |  Branch (91:15): [True: 299, False: 11.3M]
  ------------------
   92|    299|				*chPtr = 0x20;
   93|    299|			}
   94|  11.3M|			++chPtr;
   95|  11.3M|		}
   96|  96.1k|		XMP_Assert ( (*chPtr == 0) || (*chPtr >= 0x80) );
  ------------------
  |  |  142|  96.1k|	#define XMP_Assert(c)	((void) 0)
  ------------------
   97|  96.1k|		if ( *chPtr != 0 ) (void) GetCodePoint ( (const XMP_Uns8 **) &chPtr );	// Throws for bad UTF-8.
  ------------------
  |  Branch (97:8): [True: 6.41k, False: 89.7k]
  ------------------
   98|  96.1k|	}
   99|       |
  100|  89.9k|	if ( XMP_PropIsQualifier(node->options) && (node->name == "xml:lang") ) NormalizeLangValue ( &node->value );
  ------------------
  |  Branch (100:7): [True: 31.3k, False: 58.5k]
  |  Branch (100:45): [True: 5.31k, False: 26.0k]
  ------------------
  101|       |
  102|       |	#if 0	// *** XMP_DebugBuild
  103|       |		node->_valuePtr = node->value.c_str();
  104|       |	#endif
  105|       |	
  106|  89.9k|}	// SetNodeValue

_ZN7XMPMeta15ParseFromBufferEPKcjj:
 1096|  3.74k|{
 1097|  3.74k|	if ( (buffer == 0) && (xmpSize != 0) ) XMP_Throw ( "Null parse buffer", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1097:7): [True: 0, False: 3.74k]
  |  Branch (1097:24): [True: 0, False: 0]
  ------------------
 1098|  3.74k|	if ( xmpSize == kXMP_UseNullTermination ) xmpSize = strlen ( buffer );
  ------------------
  |  Branch (1098:7): [True: 0, False: 3.74k]
  ------------------
 1099|       |	
 1100|  3.74k|	const bool lastClientCall = ((options & kXMP_ParseMoreBuffers) == 0);	// *** Could use FlagIsSet & FlagIsClear macros.
 1101|       |	
 1102|  3.74k|	this->tree.ClearNode();	// Make sure the target XMP object is totally empty.
 1103|       |
 1104|  3.74k|	if ( this->xmlParser == 0 ) {
  ------------------
  |  Branch (1104:7): [True: 3.74k, False: 0]
  ------------------
 1105|  3.74k|		if ( (xmpSize == 0) && lastClientCall ) return;	// Tolerate empty parse. Expat complains if there are no XML elements.
  ------------------
  |  Branch (1105:8): [True: 0, False: 3.74k]
  |  Branch (1105:26): [True: 0, False: 0]
  ------------------
 1106|  3.74k|		this->xmlParser = XMP_NewExpatAdapter();
 1107|  3.74k|	}
 1108|       |	
 1109|  3.74k|	XMLParserAdapter& parser = *this->xmlParser;
 1110|       |	
 1111|       |	#if 0	// XMP_DebugBuild
 1112|       |		if ( parser.parseLog != 0 ) {
 1113|       |			char message [200];	// AUDIT: Using sizeof(message) below for snprintf length is safe.
 1114|       |			snprintf ( message, sizeof(message), "<!-- ParseFromBuffer, length = %d, options = %X%s -->",	// AUDIT: See above.
 1115|       |					   xmpSize, options, (lastClientCall ? " (last)" : "") );
 1116|       |			fwrite ( message, 1, strlen(message), parser.parseLog );
 1117|       |			fflush ( parser.parseLog );
 1118|       |		}
 1119|       |	#endif
 1120|       |		
 1121|  3.74k|	try {	// Cleanup the tree and xmlParser if anything fails.
 1122|       |	
 1123|       |		// Determine the character encoding before doing any real parsing. This is needed to do the
 1124|       |		// 8-bit special processing.
 1125|       |		
 1126|  3.74k|		if ( parser.charEncoding == XMP_OptionBits(-1) ) {
  ------------------
  |  Branch (1126:8): [True: 3.74k, False: 0]
  ------------------
 1127|       |
 1128|  3.74k|			if ( (parser.pendingCount == 0) && (xmpSize >= kXMLPendingInputMax) ) {
  ------------------
  |  Branch (1128:9): [True: 3.74k, False: 0]
  |  Branch (1128:39): [True: 3.69k, False: 43]
  ------------------
 1129|       |
 1130|       |				// This ought to be the common case, the first buffer is big enough.
 1131|  3.69k|				parser.charEncoding = DetermineInputEncoding ( (XMP_Uns8*)buffer, xmpSize );
 1132|       |
 1133|  3.69k|			} else {
 1134|       |			
 1135|       |				// Try to fill the pendingInput buffer before calling DetermineInputEncoding.
 1136|       |
 1137|     43|				size_t pendingOverlap = kXMLPendingInputMax - parser.pendingCount;
 1138|     43|				if ( pendingOverlap > xmpSize ) pendingOverlap = xmpSize;
  ------------------
  |  Branch (1138:10): [True: 43, False: 0]
  ------------------
 1139|       |
 1140|     43|				memcpy ( &parser.pendingInput[parser.pendingCount], buffer, pendingOverlap );	// AUDIT: Count is safe.
 1141|     43|				buffer += pendingOverlap;
 1142|     43|				xmpSize -= pendingOverlap;
 1143|     43|				parser.pendingCount += pendingOverlap;
 1144|       |
 1145|     43|				if ( (! lastClientCall) && (parser.pendingCount < kXMLPendingInputMax) ) return;
  ------------------
  |  Branch (1145:10): [True: 0, False: 43]
  |  Branch (1145:32): [True: 0, False: 0]
  ------------------
 1146|     43|				parser.charEncoding = DetermineInputEncoding ( parser.pendingInput, parser.pendingCount );
 1147|       |				
 1148|       |				#if Trace_ParsingHackery
 1149|       |					fprintf ( stderr, "XMP Character encoding is %d\n", parser.charEncoding );
 1150|       |				#endif
 1151|       |			
 1152|     43|			}
 1153|       |
 1154|  3.74k|		}
 1155|       |		
 1156|       |		// We have the character encoding. Process UTF-16 and UTF-32 as is. UTF-8 needs special
 1157|       |		// handling to take care of things like ISO Latin-1 or unescaped ASCII controls.
 1158|       |
 1159|  3.74k|		XMP_Assert ( parser.charEncoding != XMP_OptionBits(-1) );
  ------------------
  |  |  142|  3.74k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1160|       |
 1161|  3.74k|		if ( parser.charEncoding != kXMP_EncodeUTF8 ) {
  ------------------
  |  Branch (1161:8): [True: 0, False: 3.74k]
  ------------------
 1162|       |		
 1163|      0|			if ( parser.pendingCount > 0 ) {
  ------------------
  |  Branch (1163:9): [True: 0, False: 0]
  ------------------
 1164|       |				// Might have pendingInput from the above portion to determine the character encoding.
 1165|      0|				parser.ParseBuffer ( parser.pendingInput, parser.pendingCount, false );
 1166|      0|			}
 1167|      0|			parser.ParseBuffer ( buffer, xmpSize, lastClientCall );
 1168|       |			
 1169|  3.74k|		} else {
 1170|       |
 1171|       |			#if Trace_ParsingHackery
 1172|       |				fprintf ( stderr, "Parsing %d bytes @ %.8X, %s, %d pending, context: %.8s\n",
 1173|       |						  xmpSize, buffer, (lastClientCall ? "last" : "not last"), parser.pendingCount, buffer );
 1174|       |			#endif
 1175|       |
 1176|       |			// The UTF-8 processing is a bit complex due to the need to tolerate ISO Latin-1 input.
 1177|       |			// This is done by scanning the input for byte sequences that are not valid UTF-8,
 1178|       |			// assuming they are Latin-1 characters in the range 0x80..0xFF. This requires saving a
 1179|       |			// pending input buffer to handle partial UTF-8 sequences at the end of a buffer.
 1180|       |			
 1181|  3.78k|			while ( parser.pendingCount > 0 ) {
  ------------------
  |  Branch (1181:12): [True: 43, False: 3.74k]
  ------------------
 1182|       |			
 1183|       |				// We've got some leftover input, process it first then continue with the current
 1184|       |				// buffer. Try to fill the pendingInput buffer before parsing further. We use a loop
 1185|       |				// for weird edge cases like a 2 byte input buffer, using 1 byte for pendingInput,
 1186|       |				// then having a partial UTF-8 end and need to absorb more.
 1187|       |				
 1188|     43|				size_t pendingOverlap = kXMLPendingInputMax - parser.pendingCount;
 1189|     43|				if ( pendingOverlap > xmpSize ) pendingOverlap = xmpSize;
  ------------------
  |  Branch (1189:10): [True: 43, False: 0]
  ------------------
 1190|       |				
 1191|     43|				memcpy ( &parser.pendingInput[parser.pendingCount], buffer, pendingOverlap );	// AUDIT: Count is safe.
 1192|     43|				parser.pendingCount += pendingOverlap;
 1193|     43|				buffer += pendingOverlap;
 1194|     43|				xmpSize -= pendingOverlap;
 1195|       |
 1196|     43|				if ( (! lastClientCall) && (parser.pendingCount < kXMLPendingInputMax) ) return;
  ------------------
  |  Branch (1196:10): [True: 0, False: 43]
  |  Branch (1196:32): [True: 0, False: 0]
  ------------------
 1197|     43|				size_t bytesDone = ProcessUTF8Portion ( &parser, parser.pendingInput, parser.pendingCount, lastClientCall );
 1198|     43|				size_t bytesLeft = parser.pendingCount - bytesDone;
 1199|       |
 1200|       |				#if Trace_ParsingHackery
 1201|       |					fprintf ( stderr, "   ProcessUTF8Portion handled %d pending bytes\n", bytesDone );
 1202|       |				#endif
 1203|       |				
 1204|     43|				if ( bytesDone == parser.pendingCount ) {
  ------------------
  |  Branch (1204:10): [True: 43, False: 0]
  ------------------
 1205|       |
 1206|       |					// Done with all of the pending input, move on to the current buffer.
 1207|     43|					parser.pendingCount = 0;
 1208|       |
 1209|     43|				} else if ( bytesLeft <= pendingOverlap ) {
  ------------------
  |  Branch (1209:17): [True: 0, False: 0]
  ------------------
 1210|       |
 1211|       |					// The leftover pending input all came from the current buffer. Exit this loop.
 1212|      0|					buffer -= bytesLeft;
 1213|      0|					xmpSize += bytesLeft;
 1214|      0|					parser.pendingCount = 0;
 1215|       |
 1216|      0|				} else if ( xmpSize > 0 ) {
  ------------------
  |  Branch (1216:17): [True: 0, False: 0]
  ------------------
 1217|       |
 1218|       |					// Pull more of the current buffer into the pending input and try again.
 1219|       |					// Backup by this pass's overlap so the loop entry code runs OK.
 1220|      0|					parser.pendingCount -= pendingOverlap;
 1221|      0|					buffer -= pendingOverlap;
 1222|      0|					xmpSize += pendingOverlap;
 1223|       |
 1224|      0|				} else {
 1225|       |
 1226|       |					// There is no more of the current buffer. Wait for more. Partial sequences at
 1227|       |					// the end of the last buffer should be treated as Latin-1 by ProcessUTF8Portion.
 1228|      0|					XMP_Assert ( ! lastClientCall );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1229|      0|					parser.pendingCount = bytesLeft;
 1230|      0|					memcpy ( &parser.pendingInput[0], &parser.pendingInput[bytesDone], bytesLeft );	// AUDIT: Count is safe.
 1231|      0|					return;
 1232|       |
 1233|      0|				}
 1234|       |			
 1235|     43|			}
 1236|       |			
 1237|       |			// Done with the pending input, process the current buffer.
 1238|       |
 1239|  3.74k|			size_t bytesDone = ProcessUTF8Portion ( &parser, (XMP_Uns8*)buffer, xmpSize, lastClientCall );
 1240|       |
 1241|       |			#if Trace_ParsingHackery
 1242|       |				fprintf ( stderr, "   ProcessUTF8Portion handled %d additional bytes\n", bytesDone );
 1243|       |			#endif
 1244|       |			
 1245|  3.74k|			if ( bytesDone < xmpSize ) {
  ------------------
  |  Branch (1245:9): [True: 0, False: 3.74k]
  ------------------
 1246|       |
 1247|      0|				XMP_Assert ( ! lastClientCall );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1248|      0|				size_t bytesLeft = xmpSize - bytesDone;
 1249|      0|				if ( bytesLeft > kXMLPendingInputMax ) XMP_Throw ( "Parser bytesLeft too large", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1249:10): [True: 0, False: 0]
  ------------------
 1250|       |
 1251|      0|				memcpy ( parser.pendingInput, &buffer[bytesDone], bytesLeft );	// AUDIT: Count is safe.
 1252|      0|				parser.pendingCount = bytesLeft;
 1253|      0|				return;	// Wait for the next buffer.
 1254|       |
 1255|      0|			}
 1256|       |
 1257|  3.74k|		}
 1258|       |		
 1259|  3.74k|		if ( lastClientCall ) {
  ------------------
  |  Branch (1259:8): [True: 3.69k, False: 43]
  ------------------
 1260|       |		
 1261|       |			#if XMP_DebugBuild && DumpXMLParseTree
 1262|       |				if ( parser.parseLog == 0 ) parser.parseLog = stdout;
 1263|       |				DumpXMLTree ( parser.parseLog, parser.tree, 0 );
 1264|       |			#endif
 1265|       |
 1266|  3.69k|			const XML_Node * xmlRoot = FindRootNode ( this, *this->xmlParser, options );
 1267|       |
 1268|  3.69k|			if ( xmlRoot != 0 ) {
  ------------------
  |  Branch (1268:9): [True: 3.35k, False: 341]
  ------------------
 1269|       |
 1270|  3.35k|				ProcessRDF ( &this->tree, *xmlRoot, options );
 1271|  3.35k|				NormalizeDCArrays ( &this->tree );
 1272|  3.35k|				if ( this->tree.options & kXMP_PropHasAliases ) MoveExplicitAliases ( &this->tree, options );
  ------------------
  |  Branch (1272:10): [True: 0, False: 3.35k]
  ------------------
 1273|  3.35k|				TouchUpDataModel ( this );
 1274|       |				
 1275|       |				// Delete empty schema nodes. Do this last, other cleanup can make empty schema.
 1276|  3.35k|				size_t schemaNum = 0;
 1277|  9.56k|				while ( schemaNum < this->tree.children.size() ) {
  ------------------
  |  Branch (1277:13): [True: 6.21k, False: 3.35k]
  ------------------
 1278|  6.21k|					XMP_Node * currSchema = this->tree.children[schemaNum];
 1279|  6.21k|					if ( currSchema->children.size() > 0 ) {
  ------------------
  |  Branch (1279:11): [True: 6.21k, False: 0]
  ------------------
 1280|  6.21k|						++schemaNum;
 1281|  6.21k|					} else {
 1282|      0|						delete this->tree.children[schemaNum];	// ! Delete the schema node itself.
 1283|      0|						this->tree.children.erase ( this->tree.children.begin() + schemaNum );
 1284|      0|					}
 1285|  6.21k|				}
 1286|       |				
 1287|  3.35k|			}
 1288|       |
 1289|  3.69k|			delete this->xmlParser;
 1290|  3.69k|			this->xmlParser = 0;
 1291|       |
 1292|  3.69k|		}
 1293|       |		
 1294|  3.74k|	} catch ( ... ) {
 1295|       |
 1296|    963|		delete this->xmlParser;
 1297|    963|		this->xmlParser = 0;
 1298|    963|		prevTkVer = 0;
 1299|    963|		this->tree.ClearNode();
 1300|    963|		throw;
 1301|       |
 1302|    963|	}
 1303|       |	
 1304|  3.74k|}	// ParseFromBuffer
XMPMeta-Parse.cpp:_ZL22DetermineInputEncodingPKhm:
  810|  3.74k|{
  811|  3.74k|	if ( length < 2 ) return kXMP_EncodeUTF8;
  ------------------
  |  Branch (811:7): [True: 0, False: 3.74k]
  ------------------
  812|       |	
  813|  3.74k|	XMP_Uns8 * uniChar = (XMP_Uns8*)buffer;	// ! Make sure comparisons are unsigned.
  814|       |	
  815|  3.74k|	if ( uniChar[0] == 0 ) {
  ------------------
  |  Branch (815:7): [True: 0, False: 3.74k]
  ------------------
  816|       |	
  817|       |		// These cases are:
  818|       |		//   00 nn -- -- - Big endian UTF-16
  819|       |		//   00 00 00 nn - Big endian UTF-32
  820|       |		//   00 00 FE FF - Big endian UTF 32
  821|       |
  822|      0|		if ( (length < 4) || (uniChar[1] != 0) ) return kXMP_EncodeUTF16Big;
  ------------------
  |  Branch (822:8): [True: 0, False: 0]
  |  Branch (822:24): [True: 0, False: 0]
  ------------------
  823|      0|		return kXMP_EncodeUTF32Big;
  824|       |		
  825|  3.74k|	} else if ( uniChar[0] < 0x80 ) {
  ------------------
  |  Branch (825:14): [True: 3.72k, False: 20]
  ------------------
  826|       |	
  827|       |		// These cases are:
  828|       |		//   nn mm -- -- - UTF-8, includes EF BB BF case
  829|       |		//   nn 00 00 00 - Little endian UTF-32
  830|       |		//   nn 00 -- -- - Little endian UTF-16
  831|       |
  832|  3.72k|		if ( uniChar[1] != 0 )  return kXMP_EncodeUTF8;
  ------------------
  |  Branch (832:8): [True: 3.72k, False: 0]
  ------------------
  833|      0|		if ( (length < 4) || (uniChar[2] != 0) ) return kXMP_EncodeUTF16Little;
  ------------------
  |  Branch (833:8): [True: 0, False: 0]
  |  Branch (833:24): [True: 0, False: 0]
  ------------------
  834|      0|		return kXMP_EncodeUTF32Little;
  835|       |
  836|     20|	} else {
  837|       |	
  838|       |		// These cases are:
  839|       |		//   EF BB BF -- - UTF-8
  840|       |		//   FE FF -- -- - Big endian UTF-16
  841|       |		//   FF FE 00 00 - Little endian UTF-32
  842|       |		//   FF FE -- -- - Little endian UTF-16
  843|       |
  844|     20|		if ( uniChar[0] == 0xEF ) return kXMP_EncodeUTF8;
  ------------------
  |  Branch (844:8): [True: 20, False: 0]
  ------------------
  845|      0|		if ( uniChar[0] == 0xFE ) return kXMP_EncodeUTF16Big;
  ------------------
  |  Branch (845:8): [True: 0, False: 0]
  ------------------
  846|      0|		if ( (length < 4) || (uniChar[2] != 0) ) return kXMP_EncodeUTF16Little;
  ------------------
  |  Branch (846:8): [True: 0, False: 0]
  |  Branch (846:24): [True: 0, False: 0]
  ------------------
  847|      0|		return kXMP_EncodeUTF32Little;
  848|       |
  849|      0|	}
  850|       |		
  851|  3.74k|}	// DetermineInputEncoding
XMPMeta-Parse.cpp:_ZL18ProcessUTF8PortionP16XMLParserAdapterPKhmb:
  976|  3.78k|{
  977|  3.78k|	const XMP_Uns8 * bufEnd = buffer + length;
  978|       |	
  979|  3.78k|	const XMP_Uns8 * spanEnd;
  980|       |
  981|       |	// `buffer` is copied into this std::string. If `buffer` only
  982|       |	// contains valid UTF-8 and no escape characters, then the copy
  983|       |	// will be identical to the original, but invalid characters are
  984|       |	// replaced - usually with a space character.  This std::string was
  985|       |	// added as a performance fix for:
  986|       |	// https://github.com/Exiv2/exiv2/security/advisories/GHSA-w8mv-g8qq-36mj
  987|       |	// Previously, the code was repeatedly calling
  988|       |	// `xmlParser->ParseBuffer()`, which turned out to have quadratic
  989|       |	// complexity, because expat kept reparsing the entire string from
  990|       |	// the beginning.
  991|  3.78k|	std::string copy;
  992|       |		
  993|  58.8M|	for ( spanEnd = buffer; spanEnd < bufEnd; ++spanEnd ) {
  ------------------
  |  Branch (993:26): [True: 58.8M, False: 3.78k]
  ------------------
  994|       |
  995|  58.8M|		if ( (0x20 <= *spanEnd) && (*spanEnd <= 0x7E) && (*spanEnd != '&') ) {
  ------------------
  |  Branch (995:8): [True: 58.6M, False: 218k]
  |  Branch (995:30): [True: 58.5M, False: 44.9k]
  |  Branch (995:52): [True: 58.1M, False: 389k]
  ------------------
  996|  58.1M|			copy.push_back(*spanEnd);
  997|  58.1M|			continue;	// A regular ASCII character.
  998|  58.1M|		}
  999|       |
 1000|   652k|		if ( *spanEnd >= 0x80 ) {
  ------------------
  |  Branch (1000:8): [True: 26.8k, False: 625k]
  ------------------
 1001|       |		
 1002|       |			// See if this is a multi-byte UTF-8 sequence, or a Latin-1 character to replace.
 1003|       |
 1004|  26.8k|			int uniLen = CountUTF8 ( spanEnd, bufEnd );
 1005|       |
 1006|  26.8k|			if ( uniLen > 0 ) {
  ------------------
  |  Branch (1006:9): [True: 26.8k, False: 0]
  ------------------
 1007|       |
 1008|       |				// A valid UTF-8 character, keep it as-is.
 1009|  26.8k|				copy.append((const char*)spanEnd, uniLen);
 1010|  26.8k|				spanEnd += uniLen - 1;	// ! The loop increment will put back the +1.
 1011|       |
 1012|  26.8k|			} else if ( (uniLen < 0) && (! last) ) {
  ------------------
  |  Branch (1012:16): [True: 0, False: 0]
  |  Branch (1012:32): [True: 0, False: 0]
  ------------------
 1013|       |
 1014|       |				// Have a partial UTF-8 character at the end of the buffer and more input coming.
 1015|      0|				xmlParser->ParseBuffer ( copy.c_str(), copy.size(), false );
 1016|      0|				return (spanEnd - buffer);
 1017|       |
 1018|      0|			} else {
 1019|       |
 1020|       |				// Not a valid UTF-8 sequence. Replace the first byte with the Latin-1 equivalent.
 1021|      0|				const char * replacement = kReplaceLatin1 [ *spanEnd - 0x80 ];
 1022|      0|				copy.append ( replacement );
 1023|       |
 1024|      0|			}
 1025|       |		
 1026|   625k|		} else if ( (*spanEnd < 0x20) || (*spanEnd == 0x7F) ) {
  ------------------
  |  Branch (1026:15): [True: 218k, False: 407k]
  |  Branch (1026:36): [True: 18.0k, False: 389k]
  ------------------
 1027|       |
 1028|       |			// Replace ASCII controls other than tab, LF, and CR with a space.
 1029|       |
 1030|   236k|			if ( (*spanEnd == kTab) || (*spanEnd == kLF) || (*spanEnd == kCR) ) {
  ------------------
  |  |  100|   236k|#define kTab ((char)0x09)
  ------------------
              			if ( (*spanEnd == kTab) || (*spanEnd == kLF) || (*spanEnd == kCR) ) {
  ------------------
  |  |  101|   231k|#define kLF ((char)0x0A)
  ------------------
              			if ( (*spanEnd == kTab) || (*spanEnd == kLF) || (*spanEnd == kCR) ) {
  ------------------
  |  |  102|  23.2k|#define kCR ((char)0x0D)
  ------------------
  |  Branch (1030:9): [True: 5.02k, False: 231k]
  |  Branch (1030:31): [True: 208k, False: 23.2k]
  |  Branch (1030:52): [True: 5.18k, False: 18.0k]
  ------------------
 1031|   218k|				copy.push_back(*spanEnd);
 1032|   218k|				continue;
 1033|   218k|			}
 1034|       |
 1035|  18.0k|			copy.push_back(' ');
 1036|       |		
 1037|   389k|		} else {
 1038|       |		
 1039|       |			// See if this is a numeric escape sequence for a prohibited ASCII control.
 1040|       |			
 1041|   389k|			XMP_Assert ( *spanEnd == '&' );
  ------------------
  |  |  142|   389k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1042|   389k|			int escLen = CountControlEscape ( spanEnd, bufEnd );
 1043|       |			
 1044|   389k|			if ( escLen < 0 ) {
  ------------------
  |  Branch (1044:9): [True: 14, False: 389k]
  ------------------
 1045|       |
 1046|       |				// Have a partial numeric escape in this buffer, wait for more input.
 1047|     14|				if ( last ) {
  ------------------
  |  Branch (1047:10): [True: 14, False: 0]
  ------------------
 1048|     14|					copy.push_back('&');
 1049|     14|					continue;	// No more buffers, not an escape, absorb as normal input.
 1050|     14|				}
 1051|      0|				xmlParser->ParseBuffer ( copy.c_str(), copy.size(), false );
 1052|      0|				return (spanEnd - buffer);
 1053|       |
 1054|   389k|			} else if ( escLen > 0 ) {
  ------------------
  |  Branch (1054:16): [True: 14.7k, False: 374k]
  ------------------
 1055|       |
 1056|       |				// Have a complete numeric escape to replace.
 1057|  14.7k|				copy.push_back(' ');
 1058|  14.7k|				spanEnd = spanEnd + escLen - 1;	// ! The loop continuation will increment spanEnd!
 1059|       |
 1060|   374k|			} else {
 1061|   374k|				copy.push_back('&');
 1062|   374k|			}
 1063|       |
 1064|   389k|		}
 1065|       |		
 1066|   652k|	}
 1067|       |	
 1068|  3.78k|	XMP_Assert ( spanEnd == bufEnd );
  ------------------
  |  |  142|  3.78k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1069|  3.78k|	copy.push_back(' ');
 1070|  3.78k|	xmlParser->ParseBuffer ( copy.c_str(), copy.size(), true );
 1071|  3.78k|	return length;
 1072|       |
 1073|  3.78k|}	// ProcessUTF8Portion
XMPMeta-Parse.cpp:_ZL9CountUTF8PKhS0_:
  867|  26.8k|{
  868|  26.8k|	XMP_Assert ( charStart < bufEnd );		// Catch this in debug builds.
  ------------------
  |  |  142|  26.8k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  869|  26.8k|	if ( charStart >= bufEnd ) return 0;	// Don't run-on in release builds.
  ------------------
  |  Branch (869:7): [True: 0, False: 26.8k]
  ------------------
  870|  26.8k|	if ( (*charStart & 0xC0) != 0xC0 ) return 0;	// Must have at least 2 high bits set.
  ------------------
  |  Branch (870:7): [True: 0, False: 26.8k]
  ------------------
  871|       |	
  872|  26.8k|	int byteCount = 2;
  873|  26.8k|	XMP_Uns8 firstByte = *charStart;
  874|  30.8k|	for ( firstByte = firstByte << 2; (firstByte & 0x80) != 0; firstByte = firstByte << 1 ) ++byteCount;
  ------------------
  |  Branch (874:36): [True: 3.97k, False: 26.8k]
  ------------------
  875|       |	
  876|  26.8k|	if ( (charStart + byteCount) > bufEnd ) return -byteCount;
  ------------------
  |  Branch (876:7): [True: 0, False: 26.8k]
  ------------------
  877|       |
  878|  57.7k|	for ( int i = 1; i < byteCount; ++i ) {
  ------------------
  |  Branch (878:19): [True: 30.8k, False: 26.8k]
  ------------------
  879|  30.8k|		if ( (charStart[i] & 0xC0) != 0x80 ) return 0;
  ------------------
  |  Branch (879:8): [True: 0, False: 30.8k]
  ------------------
  880|  30.8k|	}
  881|       |	
  882|  26.8k|	return byteCount;
  883|       |	
  884|  26.8k|}	// CountUTF8
XMPMeta-Parse.cpp:_ZL18CountControlEscapePKhS0_:
  897|   389k|{
  898|   389k|	XMP_Assert ( escStart < bufEnd );	// Catch this in debug builds.
  ------------------
  |  |  142|   389k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  899|   389k|	if ( escStart >= bufEnd ) return 0;	// Don't run-on in release builds.
  ------------------
  |  Branch (899:7): [True: 0, False: 389k]
  ------------------
  900|   389k|	XMP_Assert ( *escStart == '&' );
  ------------------
  |  |  142|   389k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  901|       |	
  902|   389k|	size_t tailLen = bufEnd - escStart;
  903|   389k|	if ( tailLen < 5 ) return -1;	// Don't need a more thorough check, we'll catch it on the next pass.
  ------------------
  |  Branch (903:7): [True: 14, False: 389k]
  ------------------
  904|       |	
  905|   389k|	if ( strncmp ( (char*)escStart, "&#x", 3 ) != 0 ) return 0;
  ------------------
  |  Branch (905:7): [True: 177k, False: 211k]
  ------------------
  906|       |	
  907|   211k|	XMP_Uns8 escValue = 0;
  908|   211k|	const XMP_Uns8 * escPos = escStart + 3;
  909|       |	
  910|   211k|	if ( ('0' <= *escPos) && (*escPos <= '9') ) {
  ------------------
  |  Branch (910:7): [True: 202k, False: 8.72k]
  |  Branch (910:27): [True: 166k, False: 36.2k]
  ------------------
  911|   166k|		escValue = *escPos - '0';
  912|   166k|		++escPos;
  913|   166k|	} else if ( ('A' <= *escPos) && (*escPos <= 'F') ) {
  ------------------
  |  Branch (913:14): [True: 34.6k, False: 10.2k]
  |  Branch (913:34): [True: 19.4k, False: 15.1k]
  ------------------
  914|  19.4k|		escValue = *escPos - 'A' + 10;
  915|  19.4k|		++escPos;
  916|  25.4k|	} else if ( ('a' <= *escPos) && (*escPos <= 'f') ) {
  ------------------
  |  Branch (916:14): [True: 12.8k, False: 12.5k]
  |  Branch (916:34): [True: 5.50k, False: 7.36k]
  ------------------
  917|  5.50k|		escValue = *escPos - 'a' + 10;
  918|  5.50k|		++escPos;
  919|  5.50k|	}
  920|       |	
  921|   211k|	if ( ('0' <= *escPos) && (*escPos <= '9') ) {
  ------------------
  |  Branch (921:7): [True: 172k, False: 38.9k]
  |  Branch (921:27): [True: 58.1k, False: 114k]
  ------------------
  922|  58.1k|		escValue = (escValue << 4) + (*escPos - '0');
  923|  58.1k|		++escPos;
  924|   153k|	} else if ( ('A' <= *escPos) && (*escPos <= 'F') ) {
  ------------------
  |  Branch (924:14): [True: 33.9k, False: 119k]
  |  Branch (924:34): [True: 10.3k, False: 23.6k]
  ------------------
  925|  10.3k|		escValue = (escValue << 4) + (*escPos - 'A' + 10);
  926|  10.3k|		++escPos;
  927|   143k|	} else if ( ('a' <= *escPos) && (*escPos <= 'f') ) {
  ------------------
  |  Branch (927:14): [True: 18.8k, False: 124k]
  |  Branch (927:34): [True: 1.28k, False: 17.5k]
  ------------------
  928|  1.28k|		escValue = (escValue << 4) + (*escPos - 'a' + 10);
  929|  1.28k|		++escPos;
  930|  1.28k|	}
  931|       |	
  932|   211k|	if ( escPos == bufEnd ) return -1;	// Partial escape.
  ------------------
  |  Branch (932:7): [True: 0, False: 211k]
  ------------------
  933|   211k|	if ( *escPos != ';' ) return 0;
  ------------------
  |  Branch (933:7): [True: 130k, False: 80.6k]
  ------------------
  934|       |	
  935|  80.6k|	size_t escLen = escPos - escStart + 1;
  936|  80.6k|	if ( escLen < 5 ) return 0;	// ! Catch "&#x;".
  ------------------
  |  Branch (936:7): [True: 1.42k, False: 79.2k]
  ------------------
  937|       |	
  938|  79.2k|	if ( (escValue == kTab) || (escValue == kLF) || (escValue == kCR) ) return 0;	// An allowed escape.
  ------------------
  |  |  100|  79.2k|#define kTab ((char)0x09)
  ------------------
              	if ( (escValue == kTab) || (escValue == kLF) || (escValue == kCR) ) return 0;	// An allowed escape.
  ------------------
  |  |  101|  15.5k|#define kLF ((char)0x0A)
  ------------------
              	if ( (escValue == kTab) || (escValue == kLF) || (escValue == kCR) ) return 0;	// An allowed escape.
  ------------------
  |  |  102|  15.1k|#define kCR ((char)0x0D)
  ------------------
  |  Branch (938:7): [True: 63.7k, False: 15.5k]
  |  Branch (938:29): [True: 392, False: 15.1k]
  |  Branch (938:50): [True: 361, False: 14.7k]
  ------------------
  939|       |	
  940|  14.7k|	return escLen;	// Found a full "prohibited" numeric escape.
  941|       |	
  942|  79.2k|}	// CountControlEscape
XMPMeta-Parse.cpp:_ZL12FindRootNodeP7XMPMetaRK16XMLParserAdapterj:
  151|  3.69k|{
  152|  3.69k|	const XML_Node * rootNode = xmlParser.rootNode;
  153|       |	
  154|  3.69k|	if ( xmlParser.rootCount > 1 ) rootNode = PickBestRoot ( xmlParser.tree, options );
  ------------------
  |  Branch (154:7): [True: 90, False: 3.60k]
  ------------------
  155|  3.69k|	if ( rootNode == 0 ) return 0;
  ------------------
  |  Branch (155:7): [True: 341, False: 3.35k]
  ------------------
  156|       |	
  157|       |	// We have a root node. Try to extract previous toolkit version number.
  158|       |	
  159|  3.35k|	XMP_StringPtr verStr = "";
  160|       |	
  161|  3.35k|		XMP_Assert ( rootNode->name == "rdf:RDF" );
  ------------------
  |  |  142|  3.35k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  162|       |	
  163|  3.35k|		if ( (options & kXMP_RequireXMPMeta) &&
  ------------------
  |  Branch (163:8): [True: 0, False: 3.35k]
  ------------------
  164|      0|		     ((rootNode->parent == 0) ||
  ------------------
  |  Branch (164:9): [True: 0, False: 0]
  ------------------
  165|      0|		      ((rootNode->parent->name != "x:xmpmeta") && (rootNode->parent->name != "x:xapmeta"))) ) return 0;
  ------------------
  |  Branch (165:10): [True: 0, False: 0]
  |  Branch (165:53): [True: 0, False: 0]
  ------------------
  166|       |
  167|  3.60k|		for ( size_t attrNum = 0, attrLim = rootNode->parent->attrs.size(); attrNum < attrLim; ++attrNum ) {
  ------------------
  |  Branch (167:71): [True: 845, False: 2.76k]
  ------------------
  168|    845|			const XML_Node * currAttr =rootNode->parent->attrs[attrNum];
  169|    845|			if ( (currAttr->name == "x:xmptk") || (currAttr->name == "x:xaptk") ) {
  ------------------
  |  Branch (169:9): [True: 557, False: 288]
  |  Branch (169:42): [True: 36, False: 252]
  ------------------
  170|    593|				verStr = currAttr->value.c_str();
  171|    593|				break;
  172|    593|			}
  173|    845|		}
  174|       |		
  175|       |	// Decode the version number into MMmmuubbb digits. If any part is too big, peg it at 99 or 999.
  176|       |	
  177|  3.35k|	unsigned long part;
  178|  21.0k|	while ( (*verStr != 0) && ((*verStr < '0') || (*verStr > '9')) ) ++verStr;
  ------------------
  |  Branch (178:10): [True: 18.2k, False: 2.80k]
  |  Branch (178:29): [True: 1.69k, False: 16.5k]
  |  Branch (178:48): [True: 16.0k, False: 554]
  ------------------
  179|       |	
  180|  3.35k|	part = 0;
  181|  5.50k|	while ( (*verStr != 0) && ('0' <= *verStr) && (*verStr <= '9') ) {
  ------------------
  |  Branch (181:10): [True: 2.69k, False: 2.81k]
  |  Branch (181:28): [True: 2.23k, False: 456]
  |  Branch (181:48): [True: 2.14k, False: 88]
  ------------------
  182|  2.14k|		part = (part * 10) + (*verStr - '0');
  183|  2.14k|		++verStr;
  184|  2.14k|	}
  185|  3.35k|	if ( part > 99 ) part = 99;
  ------------------
  |  Branch (185:7): [True: 51, False: 3.30k]
  ------------------
  186|  3.35k|	thiz->prevTkVer = part * 100*100*1000;
  187|       |	
  188|  3.35k|	part = 0;
  189|  3.35k|	if ( *verStr == '.' ) ++verStr;
  ------------------
  |  Branch (189:7): [True: 319, False: 3.03k]
  ------------------
  190|  4.44k|	while ( (*verStr != 0) && ('0' <= *verStr) && (*verStr <= '9') ) {
  ------------------
  |  Branch (190:10): [True: 1.63k, False: 2.81k]
  |  Branch (190:28): [True: 1.18k, False: 448]
  |  Branch (190:48): [True: 1.08k, False: 94]
  ------------------
  191|  1.08k|		part = (part * 10) + (*verStr - '0');
  192|  1.08k|		++verStr;
  193|  1.08k|	}
  194|  3.35k|	if ( part > 99 ) part = 99;
  ------------------
  |  Branch (194:7): [True: 46, False: 3.31k]
  ------------------
  195|  3.35k|	thiz->prevTkVer += part * 100*1000;
  196|       |	
  197|  3.35k|	part = 0;
  198|  3.35k|	if ( *verStr == '.' ) ++verStr;
  ------------------
  |  Branch (198:7): [True: 46, False: 3.31k]
  ------------------
  199|  4.47k|	while ( (*verStr != 0) && ('0' <= *verStr) && (*verStr <= '9') ) {
  ------------------
  |  Branch (199:10): [True: 1.65k, False: 2.82k]
  |  Branch (199:28): [True: 1.22k, False: 429]
  |  Branch (199:48): [True: 1.12k, False: 104]
  ------------------
  200|  1.12k|		part = (part * 10) + (*verStr - '0');
  201|  1.12k|		++verStr;
  202|  1.12k|	}
  203|  3.35k|	if ( part > 99 ) part = 99;
  ------------------
  |  Branch (203:7): [True: 28, False: 3.32k]
  ------------------
  204|  3.35k|	thiz->prevTkVer += part * 1000;
  205|       |	
  206|  3.35k|	part = 0;
  207|  3.35k|	if ( *verStr == '-' ) ++verStr;
  ------------------
  |  Branch (207:7): [True: 227, False: 3.12k]
  ------------------
  208|  3.75k|	while ( (*verStr != 0) && ('0' <= *verStr) && (*verStr <= '9') ) {
  ------------------
  |  Branch (208:10): [True: 924, False: 2.82k]
  |  Branch (208:28): [True: 698, False: 226]
  |  Branch (208:48): [True: 395, False: 303]
  ------------------
  209|    395|		part = (part * 10) + (*verStr - '0');
  210|    395|		++verStr;
  211|    395|	}
  212|  3.35k|	if ( part > 999 ) part = 999;
  ------------------
  |  Branch (212:7): [True: 17, False: 3.33k]
  ------------------
  213|  3.35k|	thiz->prevTkVer += part;
  214|       |	
  215|  3.35k|	return rootNode;
  216|       |	
  217|  3.35k|}	// FindRootNode
XMPMeta-Parse.cpp:_ZL12PickBestRootRK8XML_Nodej:
  111|  2.96k|{
  112|       |
  113|       |	// Look among this parent's content for x:xmpmeta. The recursion for x:xmpmeta is broader than
  114|       |	// the strictly defined choice, but gives us smaller code.
  115|  7.82k|	for ( size_t childNum = 0, childLim = xmlParent.content.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (115:66): [True: 4.96k, False: 2.86k]
  ------------------
  116|  4.96k|		const XML_Node * childNode = xmlParent.content[childNum];
  117|  4.96k|		if ( childNode->kind != kElemNode ) continue;
  ------------------
  |  Branch (117:8): [True: 3.76k, False: 1.19k]
  ------------------
  118|  1.19k|		if ( (childNode->name == "x:xmpmeta") || (childNode->name == "x:xapmeta") ) return PickBestRoot ( *childNode, 0 );
  ------------------
  |  Branch (118:8): [True: 99, False: 1.09k]
  |  Branch (118:44): [True: 1, False: 1.09k]
  ------------------
  119|  1.19k|	}
  120|       |	// Look among this parent's content for a bare rdf:RDF if that is allowed.
  121|  2.86k|	if ( ! (options & kXMP_RequireXMPMeta) ) {
  ------------------
  |  Branch (121:7): [True: 2.86k, False: 0]
  ------------------
  122|  7.36k|		for ( size_t childNum = 0, childLim = xmlParent.content.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (122:67): [True: 4.58k, False: 2.78k]
  ------------------
  123|  4.58k|			const XML_Node * childNode = xmlParent.content[childNum];
  124|  4.58k|			if ( childNode->kind != kElemNode ) continue;
  ------------------
  |  Branch (124:9): [True: 3.50k, False: 1.08k]
  ------------------
  125|  1.08k|			if ( childNode->name == "rdf:RDF" ) return childNode;
  ------------------
  |  Branch (125:9): [True: 83, False: 997]
  ------------------
  126|  1.08k|		}
  127|  2.86k|	}
  128|       |	
  129|       |	// Recurse into the content.
  130|  5.55k|	for ( size_t childNum = 0, childLim = xmlParent.content.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (130:66): [True: 2.77k, False: 2.77k]
  ------------------
  131|  2.77k|		const XML_Node * foundRoot = PickBestRoot ( *xmlParent.content[childNum], options );
  132|  2.77k|		if ( foundRoot != 0 ) return foundRoot;
  ------------------
  |  Branch (132:8): [True: 9, False: 2.76k]
  ------------------
  133|  2.77k|	}
  134|       |	
  135|  2.77k|	return 0;
  136|       |
  137|  2.78k|}	// PickBestRoot
XMPMeta-Parse.cpp:_ZL17NormalizeDCArraysP8XMP_Node:
  231|  2.43k|{
  232|  2.43k|	XMP_Node * dcSchema = FindSchemaNode ( xmpTree, kXMP_NS_DC, kXMP_ExistingOnly );
  ------------------
  |  |  296|  2.43k|#define kXMP_ExistingOnly	false
  ------------------
  233|  2.43k|	if ( dcSchema == 0 ) return;
  ------------------
  |  Branch (233:7): [True: 2.11k, False: 317]
  ------------------
  234|       |	
  235|  1.31k|	for ( size_t propNum = 0, propLimit = dcSchema->children.size(); propNum < propLimit; ++propNum ) {
  ------------------
  |  Branch (235:67): [True: 1.00k, False: 317]
  ------------------
  236|  1.00k|		XMP_Node *     currProp  = dcSchema->children[propNum];
  237|  1.00k|		XMP_OptionBits arrayForm = 0;
  238|       |		
  239|  1.00k|		if ( ! XMP_PropIsSimple ( currProp->options ) ) continue;	// Nothing to do if not simple.
  ------------------
  |  Branch (239:8): [True: 238, False: 763]
  ------------------
  240|       |		
  241|    763|		if ( (currProp->name == "dc:creator" )     ||	// See if it is supposed to be an array.
  ------------------
  |  Branch (241:8): [True: 18, False: 745]
  ------------------
  242|    745|		     (currProp->name == "dc:date" ) ) {			// *** Think about an array of char* and a loop.
  ------------------
  |  Branch (242:8): [True: 0, False: 745]
  ------------------
  243|     18|			arrayForm = kXMP_PropArrayIsOrdered;
  244|    745|		} else if (
  245|    745|		     (currProp->name == "dc:description" ) ||
  ------------------
  |  Branch (245:8): [True: 3, False: 742]
  ------------------
  246|    742|		     (currProp->name == "dc:rights" )      ||
  ------------------
  |  Branch (246:8): [True: 85, False: 657]
  ------------------
  247|    657|		     (currProp->name == "dc:title" ) ) {
  ------------------
  |  Branch (247:8): [True: 23, False: 634]
  ------------------
  248|    111|			arrayForm = kXMP_PropArrayIsAltText;
  249|    634|		} else if (
  250|    634|		     (currProp->name == "dc:contributor" ) ||
  ------------------
  |  Branch (250:8): [True: 14, False: 620]
  ------------------
  251|    620|		     (currProp->name == "dc:language" )    ||
  ------------------
  |  Branch (251:8): [True: 17, False: 603]
  ------------------
  252|    603|		     (currProp->name == "dc:publisher" )   ||
  ------------------
  |  Branch (252:8): [True: 3, False: 600]
  ------------------
  253|    600|		     (currProp->name == "dc:relation" )    ||
  ------------------
  |  Branch (253:8): [True: 68, False: 532]
  ------------------
  254|    532|		     (currProp->name == "dc:subject" )     ||
  ------------------
  |  Branch (254:8): [True: 39, False: 493]
  ------------------
  255|    493|		     (currProp->name == "dc:type" ) ) {
  ------------------
  |  Branch (255:8): [True: 1, False: 492]
  ------------------
  256|    142|			arrayForm = kXMP_PropValueIsArray;
  257|    142|		}
  258|    763|		if ( arrayForm == 0 ) continue;	// Nothing to do if it isn't supposed to be an array.
  ------------------
  |  Branch (258:8): [True: 492, False: 271]
  ------------------
  259|       |		
  260|    271|		arrayForm = VerifySetOptions ( arrayForm, 0 );	// Set the implicit array bits.
  261|    271|		XMP_Node * newArray = new XMP_Node ( dcSchema, currProp->name.c_str(), arrayForm );
  262|    271|		dcSchema->children[propNum] = newArray;
  263|    271|		newArray->children.push_back ( currProp );
  264|    271|		currProp->parent = newArray;
  265|    271|		currProp->name = kXMP_ArrayItemName;
  ------------------
  |  |  293|    271|#define kXMP_ArrayItemName	"[]"
  ------------------
  266|       |		
  267|    271|		if ( XMP_ArrayIsAltText ( arrayForm ) && (! (currProp->options & kXMP_PropHasLang)) ) {
  ------------------
  |  Branch (267:8): [True: 111, False: 160]
  |  Branch (267:44): [True: 88, False: 23]
  ------------------
  268|     88|			XMP_Node * newLang = new XMP_Node ( currProp, "xml:lang", "x-default", kXMP_PropIsQualifier );
  269|     88|			currProp->options |= (kXMP_PropHasQualifiers | kXMP_PropHasLang);
  270|     88|			if ( currProp->qualifiers.empty() ) {	// *** Need a util?
  ------------------
  |  Branch (270:9): [True: 88, False: 0]
  ------------------
  271|     88|				currProp->qualifiers.push_back ( newLang );
  272|     88|			} else {
  273|      0|				currProp->qualifiers.insert ( currProp->qualifiers.begin(), newLang );
  274|      0|			}
  275|     88|		}
  276|       |
  277|    271|	}
  278|       |	
  279|    317|}	// NormalizeDCArrays
XMPMeta-Parse.cpp:_ZL16TouchUpDataModelP7XMPMeta:
  665|  2.43k|{
  666|  2.43k|	XMP_Node & tree = xmp->tree;
  667|       |	
  668|       |	// Do special case touch ups for certain schema.
  669|       |
  670|  2.43k|	XMP_Node * currSchema = 0;
  671|       |
  672|  2.43k|	currSchema = FindSchemaNode ( &tree, kXMP_NS_EXIF, kXMP_ExistingOnly );
  ------------------
  |  |  296|  2.43k|#define kXMP_ExistingOnly	false
  ------------------
  673|  2.43k|	if ( currSchema != 0 ) {
  ------------------
  |  Branch (673:7): [True: 5, False: 2.43k]
  ------------------
  674|       |
  675|       |		// Do a special case fix for exif:GPSTimeStamp.
  676|      5|		XMP_Node * gpsDateTime = FindChildNode ( currSchema, "exif:GPSTimeStamp", kXMP_ExistingOnly );
  ------------------
  |  |  296|      5|#define kXMP_ExistingOnly	false
  ------------------
  677|      5|		if ( gpsDateTime != 0 ) FixGPSTimeStamp ( currSchema, gpsDateTime );
  ------------------
  |  Branch (677:8): [True: 0, False: 5]
  ------------------
  678|       |	
  679|       |		// *** Should probably have RepairAltText change simple values to LangAlt with 'x-default' item.
  680|       |		// *** For now just do this for exif:UserComment, the one case we know about, late in cycle fix.
  681|      5|		XMP_Node * userComment = FindChildNode ( currSchema, "exif:UserComment", kXMP_ExistingOnly );
  ------------------
  |  |  296|      5|#define kXMP_ExistingOnly	false
  ------------------
  682|      5|		if ( (userComment != 0) && XMP_PropIsSimple ( userComment->options ) ) {
  ------------------
  |  Branch (682:8): [True: 0, False: 5]
  |  Branch (682:30): [True: 0, False: 0]
  ------------------
  683|      0|			XMP_Node * newChild = new XMP_Node ( userComment, kXMP_ArrayItemName,
  ------------------
  |  |  293|      0|#define kXMP_ArrayItemName	"[]"
  ------------------
  684|      0|												 userComment->value.c_str(), userComment->options );
  685|      0|			newChild->qualifiers.swap ( userComment->qualifiers );
  686|      0|			if ( ! XMP_PropHasLang ( newChild->options ) ) {
  ------------------
  |  Branch (686:9): [True: 0, False: 0]
  ------------------
  687|      0|				XMP_Node * langQual = new XMP_Node ( newChild, "xml:lang", "x-default", kXMP_PropIsQualifier );
  688|      0|				newChild->qualifiers.insert ( newChild->qualifiers.begin(), langQual );
  689|      0|				newChild->options |= (kXMP_PropHasQualifiers | kXMP_PropHasLang);
  690|      0|			}
  691|      0|			userComment->value.erase();
  692|      0|			userComment->options = kXMP_PropArrayFormMask;	// ! Happens to have all the right bits.
  693|      0|			userComment->children.push_back ( newChild );
  694|      0|		}
  695|       |
  696|      5|	}
  697|       |
  698|  2.43k|	currSchema = FindSchemaNode ( &tree, kXMP_NS_DM, kXMP_ExistingOnly );
  ------------------
  |  |  296|  2.43k|#define kXMP_ExistingOnly	false
  ------------------
  699|  2.43k|	if ( currSchema != 0 ) {
  ------------------
  |  Branch (699:7): [True: 0, False: 2.43k]
  ------------------
  700|       |		// Do a special case migration of xmpDM:copyright to dc:rights['x-default']. Do this before
  701|       |		// the dc: touch up since it can affect the dc: schema.
  702|      0|		XMP_Node * dmCopyright = FindChildNode ( currSchema, "xmpDM:copyright", kXMP_ExistingOnly );
  ------------------
  |  |  296|      0|#define kXMP_ExistingOnly	false
  ------------------
  703|      0|		if ( dmCopyright != 0 ) MigrateAudioCopyright ( xmp, dmCopyright );
  ------------------
  |  Branch (703:8): [True: 0, False: 0]
  ------------------
  704|      0|	}
  705|       |
  706|  2.43k|	currSchema = FindSchemaNode ( &tree, kXMP_NS_DC, kXMP_ExistingOnly );
  ------------------
  |  |  296|  2.43k|#define kXMP_ExistingOnly	false
  ------------------
  707|  2.43k|	if ( currSchema != 0 ) {
  ------------------
  |  Branch (707:7): [True: 317, False: 2.11k]
  ------------------
  708|       |		// Do a special case fix for dc:subject, make sure it is an unordered array.
  709|    317|		XMP_Node * dcSubject = FindChildNode ( currSchema, "dc:subject", kXMP_ExistingOnly );
  ------------------
  |  |  296|    317|#define kXMP_ExistingOnly	false
  ------------------
  710|    317|		if ( dcSubject != 0 ) {
  ------------------
  |  Branch (710:8): [True: 39, False: 278]
  ------------------
  711|     39|                        XMP_OptionBits keepMask = static_cast<XMP_OptionBits>(~(kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText));
  712|     39|			dcSubject->options &= keepMask;	// Make sure any ordered array bits are clear.
  713|     39|		}
  714|    317|	}
  715|       |	
  716|       |	// Fix any broken AltText arrays that we know about.
  717|       |	
  718|  2.43k|	RepairAltText ( tree, kXMP_NS_DC, "dc:description" );	// ! Note inclusion of prefixes for direct node lookup!
  719|  2.43k|	RepairAltText ( tree, kXMP_NS_DC, "dc:rights" );
  720|  2.43k|	RepairAltText ( tree, kXMP_NS_DC, "dc:title" );
  721|  2.43k|	RepairAltText ( tree, kXMP_NS_XMP_Rights, "xmpRights:UsageTerms" );
  722|  2.43k|	RepairAltText ( tree, kXMP_NS_EXIF, "exif:UserComment" );
  723|       |	
  724|       |	// Tweak old XMP: Move an instance ID from rdf:about to the xmpMM:InstanceID property. An old
  725|       |	// instance ID usually looks like "uuid:bac965c4-9d87-11d9-9a30-000d936b79c4", plus InDesign
  726|       |	// 3.0 wrote them like "bac965c4-9d87-11d9-9a30-000d936b79c4". If the name looks like a UUID
  727|       |	// simply move it to xmpMM:InstanceID, don't worry about any existing xmpMM:InstanceID. Both
  728|       |	// will only be present when a newer file with the xmpMM:InstanceID property is updated by an
  729|       |	// old app that uses rdf:about.
  730|       |	
  731|  2.43k|	if ( ! tree.name.empty() ) {
  ------------------
  |  Branch (731:7): [True: 180, False: 2.25k]
  ------------------
  732|       |
  733|    180|		bool nameIsUUID = false;
  734|    180|		XMP_StringPtr nameStr = tree.name.c_str();
  735|       |
  736|    180|		if ( XMP_LitNMatch ( nameStr, "uuid:", 5 ) ) {
  ------------------
  |  |   97|    180|#define XMP_LitNMatch(s,l,n)	(std::strncmp((s),(l),(n)) == 0)
  |  |  ------------------
  |  |  |  Branch (97:30): [True: 21, False: 159]
  |  |  ------------------
  ------------------
  737|       |
  738|     21|			nameIsUUID = true;
  739|       |
  740|    159|		} else if ( tree.name.size() == 36 ) {
  ------------------
  |  Branch (740:15): [True: 69, False: 90]
  ------------------
  741|       |
  742|     69|			nameIsUUID = true;	// ! Assume true, we'll set it to false below if not.
  743|  1.49k|			for ( int i = 0;  i < 36; ++i ) {
  ------------------
  |  Branch (743:22): [True: 1.46k, False: 26]
  ------------------
  744|  1.46k|				char ch = nameStr[i];
  745|  1.46k|				if ( ch == '-' ) {
  ------------------
  |  Branch (745:10): [True: 74, False: 1.39k]
  ------------------
  746|     74|					if ( (i == 8) || (i == 13) || (i == 18) || (i == 23) ) continue;
  ------------------
  |  Branch (746:11): [True: 21, False: 53]
  |  Branch (746:23): [True: 15, False: 38]
  |  Branch (746:36): [True: 5, False: 33]
  |  Branch (746:49): [True: 20, False: 13]
  ------------------
  747|     13|					nameIsUUID = false;
  748|     13|					break;
  749|  1.39k|				} else {
  750|  1.39k|					if ( (('0' <= ch) && (ch <= '9')) || (('a' <= ch) && (ch <= 'z')) ) continue;
  ------------------
  |  Branch (750:12): [True: 1.38k, False: 3]
  |  Branch (750:27): [True: 311, False: 1.07k]
  |  Branch (750:44): [True: 1.05k, False: 29]
  |  Branch (750:59): [True: 1.04k, False: 1]
  ------------------
  751|     30|					nameIsUUID = false;
  752|     30|					break;
  753|  1.39k|				}
  754|  1.46k|			}
  755|       |
  756|     69|		}
  757|       |		
  758|    180|		if ( nameIsUUID ) {
  ------------------
  |  Branch (758:8): [True: 47, False: 133]
  ------------------
  759|       |
  760|     47|			XMP_ExpandedXPath expPath;
  761|     47|			ExpandXPath ( kXMP_NS_XMP_MM, "InstanceID", &expPath );
  762|     47|			XMP_Node * idNode = FindNode ( &tree, expPath, kXMP_CreateNodes, 0 );
  ------------------
  |  |  295|     47|#define kXMP_CreateNodes	true
  ------------------
  763|     47|			if ( idNode == 0 ) XMP_Throw ( "Failure creating xmpMM:InstanceID", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (763:9): [True: 0, False: 47]
  ------------------
  764|       |
  765|     47|			idNode->options = 0;	// Clobber any existing xmpMM:InstanceID.
  766|     47|			idNode->value = tree.name;
  767|     47|			idNode->RemoveChildren();
  768|     47|			idNode->RemoveQualifiers();
  769|       |
  770|     47|			tree.name.erase();
  771|       |
  772|     47|		}
  773|       |
  774|    180|	}
  775|       |
  776|  2.43k|}	// TouchUpDataModel
XMPMeta-Parse.cpp:_ZL13RepairAltTextR8XMP_NodePKcS2_:
  609|  12.1k|{
  610|  12.1k|	XMP_Node * schemaNode = FindSchemaNode ( &tree, schemaNS, kXMP_ExistingOnly );
  ------------------
  |  |  296|  12.1k|#define kXMP_ExistingOnly	false
  ------------------
  611|  12.1k|	if ( schemaNode == 0 ) return;
  ------------------
  |  Branch (611:7): [True: 11.1k, False: 989]
  ------------------
  612|       |	
  613|    989|	XMP_Node * arrayNode = FindChildNode ( schemaNode, arrayName, kXMP_ExistingOnly );
  ------------------
  |  |  296|    989|#define kXMP_ExistingOnly	false
  ------------------
  614|    989|	if ( (arrayNode == 0) || XMP_ArrayIsAltText ( arrayNode->options ) ) return;	// Already OK.
  ------------------
  |  Branch (614:7): [True: 774, False: 215]
  |  Branch (614:27): [True: 140, False: 75]
  ------------------
  615|       |	
  616|     75|	if ( ! XMP_PropIsArray ( arrayNode->options ) ) return;	// ! Not even an array, leave it alone.
  ------------------
  |  Branch (616:7): [True: 0, False: 75]
  ------------------
  617|       |	// *** Should probably change simple values to LangAlt with 'x-default' item.
  618|       |	
  619|     75|	arrayNode->options |= (kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText);
  620|       |	
  621|    473|	for ( int i = arrayNode->children.size()-1; i >= 0; --i ) {	// ! Need a signed index type.
  ------------------
  |  Branch (621:46): [True: 398, False: 75]
  ------------------
  622|       |
  623|    398|		XMP_Node * currChild = arrayNode->children[i];
  624|       |
  625|    398|		if ( ! XMP_PropIsSimple ( currChild->options ) ) {
  ------------------
  |  Branch (625:8): [True: 34, False: 364]
  ------------------
  626|       |
  627|       |			// Delete non-simple children.
  628|     34|			delete ( currChild );
  629|     34|			arrayNode->children.erase ( arrayNode->children.begin() + i );
  630|       |
  631|    364|		} else if ( ! XMP_PropHasLang ( currChild->options ) ) {
  ------------------
  |  Branch (631:15): [True: 326, False: 38]
  ------------------
  632|       |		
  633|    326|			if ( currChild->value.empty() ) {
  ------------------
  |  Branch (633:9): [True: 11, False: 315]
  ------------------
  634|       |
  635|       |				// Delete empty valued children that have no xml:lang.
  636|     11|				delete ( currChild );
  637|     11|				arrayNode->children.erase ( arrayNode->children.begin() + i );
  638|       |
  639|    315|			} else {
  640|       |
  641|       |				// Add an xml:lang qualifier with the value "x-repair".
  642|    315|				XMP_Node * repairLang = new XMP_Node ( currChild, "xml:lang", "x-repair", kXMP_PropIsQualifier );
  643|    315|				if ( currChild->qualifiers.empty() ) {
  ------------------
  |  Branch (643:10): [True: 302, False: 13]
  ------------------
  644|    302|					currChild->qualifiers.push_back ( repairLang );
  645|    302|				} else {
  646|     13|					currChild->qualifiers.insert ( currChild->qualifiers.begin(), repairLang );
  647|     13|				}
  648|    315|				currChild->options |= (kXMP_PropHasQualifiers | kXMP_PropHasLang);
  649|       |
  650|    315|			}
  651|       |
  652|    326|		}
  653|       |
  654|    398|	}
  655|       |
  656|     75|}	// RepairAltText

_ZNK7XMPMeta17SerializeToBufferEPPKcPjjjS1_S1_i:
 1170|  1.69k|{
 1171|  1.69k|	XMP_Assert ( (rdfString != 0) && (rdfSize != 0) && (newline != 0) && (indentStr != 0) );
  ------------------
  |  |  142|  1.69k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1172|       |
 1173|       |	// Fix up some default parameters.
 1174|       |	
 1175|  1.69k|	enum { kDefaultPad = 2048 };
 1176|  1.69k|	size_t unicodeUnitSize = 1;
 1177|  1.69k|	XMP_OptionBits charEncoding = options & kXMP_EncodingMask;
 1178|       |
 1179|  1.69k|	if ( charEncoding != kXMP_EncodeUTF8 ) {
  ------------------
  |  Branch (1179:7): [True: 0, False: 1.69k]
  ------------------
 1180|      0|		if ( options & _XMP_UTF16_Bit ) {
  ------------------
  |  Branch (1180:8): [True: 0, False: 0]
  ------------------
 1181|      0|			if ( options & _XMP_UTF32_Bit ) XMP_Throw ( "Can't use both _XMP_UTF16_Bit and _XMP_UTF32_Bit", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1181:9): [True: 0, False: 0]
  ------------------
 1182|      0|			unicodeUnitSize = 2;
 1183|      0|		} else if ( options & _XMP_UTF32_Bit ) {
  ------------------
  |  Branch (1183:15): [True: 0, False: 0]
  ------------------
 1184|      0|			unicodeUnitSize = 4;
 1185|      0|		} else {
 1186|      0|			XMP_Throw ( "Can't use _XMP_LittleEndian_Bit by itself", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1187|      0|		}
 1188|      0|	}
 1189|       |	
 1190|  1.69k|	if ( options & kXMP_OmitAllFormatting ) {
  ------------------
  |  Branch (1190:7): [True: 7, False: 1.68k]
  ------------------
 1191|      7|		newline = " ";	// ! Yes, a space for "newline". This ensures token separation.
 1192|      7|		indentStr = "";
 1193|  1.68k|	} else {
 1194|  1.68k|		if ( *newline == 0 ) newline = "\xA";	// Linefeed
  ------------------
  |  Branch (1194:8): [True: 1.68k, False: 0]
  ------------------
 1195|  1.68k|		if ( *indentStr == 0 ) {
  ------------------
  |  Branch (1195:8): [True: 1.68k, False: 0]
  ------------------
 1196|  1.68k|			indentStr = " ";
 1197|  1.68k|			if ( ! (options & kXMP_UseCompactFormat) ) indentStr  = "   ";
  ------------------
  |  Branch (1197:9): [True: 0, False: 1.68k]
  ------------------
 1198|  1.68k|		}
 1199|  1.68k|	}
 1200|       |	
 1201|  1.69k|	if ( options & kXMP_ExactPacketLength ) {
  ------------------
  |  Branch (1201:7): [True: 0, False: 1.69k]
  ------------------
 1202|      0|		if ( options & (kXMP_OmitPacketWrapper | kXMP_IncludeThumbnailPad) ) {
  ------------------
  |  Branch (1202:8): [True: 0, False: 0]
  ------------------
 1203|      0|			XMP_Throw ( "Inconsistent options for exact size serialize", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1204|      0|		}
 1205|      0|		if ( (padding & (unicodeUnitSize-1)) != 0 ) {
  ------------------
  |  Branch (1205:8): [True: 0, False: 0]
  ------------------
 1206|      0|			XMP_Throw ( "Exact size must be a multiple of the Unicode element", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1207|      0|		}
 1208|  1.69k|	} else if ( options & kXMP_ReadOnlyPacket ) {
  ------------------
  |  Branch (1208:14): [True: 0, False: 1.69k]
  ------------------
 1209|      0|		if ( options & (kXMP_OmitPacketWrapper | kXMP_IncludeThumbnailPad) ) {
  ------------------
  |  Branch (1209:8): [True: 0, False: 0]
  ------------------
 1210|      0|			XMP_Throw ( "Inconsistent options for read-only packet", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1211|      0|		}
 1212|      0|		padding = 0;
 1213|  1.69k|	} else if ( options & kXMP_OmitPacketWrapper ) {
  ------------------
  |  Branch (1213:14): [True: 909, False: 787]
  ------------------
 1214|    909|		if ( options & kXMP_IncludeThumbnailPad ) {
  ------------------
  |  Branch (1214:8): [True: 0, False: 909]
  ------------------
 1215|      0|			XMP_Throw ( "Inconsistent options for non-packet serialize", kXMPErr_BadOptions );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1216|      0|		}
 1217|    909|		padding = 0;
 1218|    909|	} else {
 1219|    787|		if ( padding == 0 ) padding = kDefaultPad * unicodeUnitSize;
  ------------------
  |  Branch (1219:8): [True: 787, False: 0]
  ------------------
 1220|    787|		if ( options & kXMP_IncludeThumbnailPad ) {
  ------------------
  |  Branch (1220:8): [True: 0, False: 787]
  ------------------
 1221|      0|			if ( ! this->DoesPropertyExist ( kXMP_NS_XMP, "Thumbnails" ) ) padding += (10000 * unicodeUnitSize);	// *** Need a better estimate.
  ------------------
  |  Branch (1221:9): [True: 0, False: 0]
  ------------------
 1222|      0|		}
 1223|    787|	}
 1224|       |
 1225|       |	// Serialize as UTF-8, then convert to UTF-16 or UTF-32 if necessary, and assemble with the padding and tail.
 1226|       |	
 1227|  1.69k|	std::string tailStr;
 1228|       |
 1229|  1.69k|	SerializeAsRDF ( *this, *sOutputStr, tailStr, options, newline, indentStr, baseIndent );
 1230|  1.69k|	if ( charEncoding == kXMP_EncodeUTF8 ) {
  ------------------
  |  Branch (1230:7): [True: 1.69k, False: 0]
  ------------------
 1231|       |
 1232|  1.69k|		if ( options & kXMP_ExactPacketLength ) {
  ------------------
  |  Branch (1232:8): [True: 0, False: 1.69k]
  ------------------
 1233|      0|			size_t minSize = sOutputStr->size() + tailStr.size();
 1234|      0|			if ( minSize > padding ) XMP_Throw ( "Can't fit into specified packet size", kXMPErr_BadSerialize );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1234:9): [True: 0, False: 0]
  ------------------
 1235|      0|			padding -= minSize;	// Now the actual amount of padding to add.
 1236|      0|		}
 1237|       |		
 1238|  1.69k|		size_t newlineLen = strlen ( newline );
 1239|       |	
 1240|  1.69k|		if ( padding < newlineLen ) {
  ------------------
  |  Branch (1240:8): [True: 909, False: 787]
  ------------------
 1241|    909|			sOutputStr->append ( padding, ' ' );
 1242|    909|		} else {
 1243|    787|			padding -= newlineLen;	// Write this newline last.
 1244|  16.5k|			while ( padding >= (100 + newlineLen) ) {
  ------------------
  |  Branch (1244:12): [True: 15.7k, False: 787]
  ------------------
 1245|  15.7k|				sOutputStr->append ( 100, ' ' );
 1246|  15.7k|				*sOutputStr += newline;
 1247|  15.7k|				padding -= (100 + newlineLen);
 1248|  15.7k|			}
 1249|    787|			sOutputStr->append ( padding, ' ' );
 1250|    787|			*sOutputStr += newline;
 1251|    787|		}
 1252|       |
 1253|  1.69k|		*sOutputStr += tailStr;
 1254|       |	
 1255|  1.69k|	} else {
 1256|       |	
 1257|       |		// Need to convert the encoding. Swap the UTF-8 into a local string and convert back. Assemble everything.
 1258|       |		
 1259|      0|		XMP_VarString utf8Str, newlineStr;
 1260|      0|		bool bigEndian = ((charEncoding & _XMP_LittleEndian_Bit) == 0);
 1261|       |		
 1262|      0|		if ( charEncoding & _XMP_UTF16_Bit ) {
  ------------------
  |  Branch (1262:8): [True: 0, False: 0]
  ------------------
 1263|       |
 1264|      0|			std::string padStr ( "  " );  padStr[0] = 0;	// Assume big endian.
 1265|       |			
 1266|      0|			utf8Str.swap ( *sOutputStr );
 1267|      0|			ToUTF16 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), sOutputStr, bigEndian );
 1268|      0|			utf8Str.swap ( tailStr );
 1269|      0|			ToUTF16 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), &tailStr, bigEndian );
 1270|       |
 1271|      0|			if ( options & kXMP_ExactPacketLength ) {
  ------------------
  |  Branch (1271:9): [True: 0, False: 0]
  ------------------
 1272|      0|				size_t minSize = sOutputStr->size() + tailStr.size();
 1273|      0|				if ( minSize > padding ) XMP_Throw ( "Can't fit into specified packet size", kXMPErr_BadSerialize );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1273:10): [True: 0, False: 0]
  ------------------
 1274|      0|				padding -= minSize;	// Now the actual amount of padding to add (in bytes).
 1275|      0|			}
 1276|       |
 1277|      0|			utf8Str.assign ( newline );
 1278|      0|			ToUTF16 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), &newlineStr, bigEndian );
 1279|      0|			size_t newlineLen = newlineStr.size();
 1280|       |	
 1281|      0|			if ( padding < newlineLen ) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 0]
  ------------------
 1282|      0|				for ( int i = padding/2; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1282:30): [True: 0, False: 0]
  ------------------
 1283|      0|			} else {
 1284|      0|				padding -= newlineLen;	// Write this newline last.
 1285|      0|				while ( padding >= (200 + newlineLen) ) {
  ------------------
  |  Branch (1285:13): [True: 0, False: 0]
  ------------------
 1286|      0|					for ( int i = 100; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1286:25): [True: 0, False: 0]
  ------------------
 1287|      0|					*sOutputStr += newlineStr;
 1288|      0|					padding -= (200 + newlineLen);
 1289|      0|				}
 1290|      0|				for ( int i = padding/2; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1290:30): [True: 0, False: 0]
  ------------------
 1291|      0|				*sOutputStr += newlineStr;
 1292|      0|			}
 1293|       |
 1294|      0|			*sOutputStr += tailStr;
 1295|       |
 1296|      0|		} else {
 1297|       |
 1298|      0|			std::string padStr ( "    " );  padStr[0] = padStr[1] = padStr[2] = 0;	// Assume big endian.
 1299|       |//			UTF8_to_UTF32_Proc Converter = UTF8_to_UTF32BE;
 1300|       |
 1301|      0|			if ( charEncoding & _XMP_LittleEndian_Bit ) {
  ------------------
  |  Branch (1301:9): [True: 0, False: 0]
  ------------------
 1302|      0|				padStr[0] = ' '; padStr[1] = padStr[2] = padStr[3] = 0;
 1303|       |//				Converter = UTF8_to_UTF32LE;
 1304|      0|			}
 1305|       |			
 1306|      0|			utf8Str.swap ( *sOutputStr );
 1307|      0|			ToUTF32 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), sOutputStr, bigEndian );
 1308|      0|			utf8Str.swap ( tailStr );
 1309|      0|			ToUTF32 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), &tailStr, bigEndian );
 1310|       |
 1311|      0|			if ( options & kXMP_ExactPacketLength ) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 0]
  ------------------
 1312|      0|				size_t minSize = sOutputStr->size() + tailStr.size();
 1313|      0|				if ( minSize > padding ) XMP_Throw ( "Can't fit into specified packet size", kXMPErr_BadSerialize );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1313:10): [True: 0, False: 0]
  ------------------
 1314|      0|				padding -= minSize;	// Now the actual amount of padding to add (in bytes).
 1315|      0|			}
 1316|       |
 1317|      0|			utf8Str.assign ( newline );
 1318|      0|			ToUTF32 ( (UTF8Unit*)utf8Str.c_str(), utf8Str.size(), &newlineStr, bigEndian );
 1319|      0|			size_t newlineLen = newlineStr.size();
 1320|       |	
 1321|      0|			if ( padding < newlineLen ) {
  ------------------
  |  Branch (1321:9): [True: 0, False: 0]
  ------------------
 1322|      0|				for ( int i = padding/4; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1322:30): [True: 0, False: 0]
  ------------------
 1323|      0|			} else {
 1324|      0|				padding -= newlineLen;	// Write this newline last.
 1325|      0|				while ( padding >= (400 + newlineLen) ) {
  ------------------
  |  Branch (1325:13): [True: 0, False: 0]
  ------------------
 1326|      0|					for ( int i = 100; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1326:25): [True: 0, False: 0]
  ------------------
 1327|      0|					*sOutputStr += newlineStr;
 1328|      0|					padding -= (400 + newlineLen);
 1329|      0|				}
 1330|      0|				for ( int i = padding/4; i > 0; --i ) *sOutputStr += padStr;
  ------------------
  |  Branch (1330:30): [True: 0, False: 0]
  ------------------
 1331|      0|				*sOutputStr += newlineStr;
 1332|      0|			}
 1333|       |
 1334|      0|			*sOutputStr += tailStr;
 1335|       |
 1336|      0|		}
 1337|       |	
 1338|      0|	}
 1339|       |
 1340|       |	// Return the finished string.
 1341|       |	
 1342|  1.69k|	*rdfString = sOutputStr->c_str();
 1343|  1.69k|	*rdfSize   = sOutputStr->size();
 1344|       |
 1345|  1.69k|}	// SerializeToBuffer
XMPMeta-Serialize.cpp:_ZL14SerializeAsRDFRK7XMPMetaRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_jPKcSB_i:
 1063|  1.69k|{
 1064|  1.69k|	const size_t treeNameLen = xmpObj.tree.name.size();
 1065|  1.69k|	const size_t indentLen   = strlen ( indentStr );
 1066|       |
 1067|       |	// First estimate the worst case space and reserve room in the output string. This optimization
 1068|       |	// avoids reallocating and copying the output as it grows. The initial count does not look at
 1069|       |	// the values of properties, so it does not account for character entities, e.g. &#xA; for newline.
 1070|       |	// Since there can be a lot of these in things like the base 64 encoding of a large thumbnail,
 1071|       |	// inflate the count by 1/4 (easy to do) to accommodate.
 1072|       |	
 1073|       |	// *** Need to include estimate for alias comments.
 1074|       |	
 1075|  1.69k|	size_t outputLen = 2 * (strlen(kPacketHeader) + strlen(kRDF_XMPMetaStart) + strlen(kRDF_RDFStart) + 3*baseIndent*indentLen);
 1076|       |	
 1077|  5.75k|	for ( size_t schemaNum = 0, schemaLim = xmpObj.tree.children.size(); schemaNum < schemaLim; ++schemaNum ) {
  ------------------
  |  Branch (1077:71): [True: 4.05k, False: 1.69k]
  ------------------
 1078|  4.05k|		const XMP_Node * currSchema = xmpObj.tree.children[schemaNum];
 1079|  4.05k|		outputLen += 2*(baseIndent+2)*indentLen + strlen(kRDF_SchemaStart) + treeNameLen + strlen(kRDF_SchemaEnd) + 2;
 1080|  4.05k|		outputLen += EstimateRDFSize ( currSchema, baseIndent+2, indentLen );
 1081|  4.05k|	}
 1082|       |	
 1083|  1.69k|	outputLen += (outputLen >> 2);	// Inflate by 1/4, an empirical fudge factor.
 1084|       |	
 1085|       |	// Now generate the RDF into the head string as UTF-8.
 1086|       |	
 1087|  1.69k|	XMP_Index level;
 1088|       |	
 1089|  1.69k|	headStr.erase();
 1090|  1.69k|	headStr.reserve ( outputLen );
 1091|       |	
 1092|       |	// Write the packet header PI.
 1093|  1.69k|	if ( ! (options & kXMP_OmitPacketWrapper) ) {
  ------------------
  |  Branch (1093:7): [True: 787, False: 909]
  ------------------
 1094|    787|		for ( level = baseIndent; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1094:29): [True: 0, False: 787]
  ------------------
 1095|    787|		headStr += kPacketHeader;
 1096|    787|		headStr += newline;
 1097|    787|	}
 1098|       |
 1099|       |	// Write the xmpmeta element's start tag.
 1100|  1.69k|	if ( ! (options & kXMP_OmitXMPMetaElement) ) {
  ------------------
  |  Branch (1100:7): [True: 1.69k, False: 0]
  ------------------
 1101|  1.69k|		for ( level = baseIndent; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1101:29): [True: 0, False: 1.69k]
  ------------------
 1102|  1.69k|		headStr += kRDF_XMPMetaStart;
 1103|  1.69k|		headStr += kXMPCore_VersionMessage "\">";
  ------------------
  |  |  134|  1.69k|	#define kXMPCore_VersionMessage	kXMPCoreName " " XMP_API_VERSION_STRING
  |  |  ------------------
  |  |  |  |  133|  1.69k|	#define kXMPCoreName "XMP Core"
  |  |  ------------------
  ------------------
 1104|  1.69k|		headStr += newline;
 1105|  1.69k|	}
 1106|       |
 1107|       |	// Write the rdf:RDF start tag.
 1108|  3.39k|	for ( level = baseIndent+1; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1108:30): [True: 1.69k, False: 1.69k]
  ------------------
 1109|  1.69k|	headStr += kRDF_RDFStart;
 1110|  1.69k|	headStr += newline;
 1111|       |	
 1112|       |	// Write all of the properties.
 1113|  1.69k|	if ( options & kXMP_UseCompactFormat ) {
  ------------------
  |  Branch (1113:7): [True: 1.69k, False: 0]
  ------------------
 1114|  1.69k|		SerializeCompactRDFSchemas ( xmpObj.tree, headStr, newline, indentStr, baseIndent );
 1115|  1.69k|	} else {
 1116|      0|		if ( xmpObj.tree.children.size() > 0 ) {
  ------------------
  |  Branch (1116:8): [True: 0, False: 0]
  ------------------
 1117|      0|			for ( size_t schemaNum = 0, schemaLim = xmpObj.tree.children.size(); schemaNum < schemaLim; ++schemaNum ) {
  ------------------
  |  Branch (1117:73): [True: 0, False: 0]
  ------------------
 1118|      0|				const XMP_Node * currSchema = xmpObj.tree.children[schemaNum];
 1119|      0|				SerializePrettyRDFSchema ( xmpObj.tree.name, currSchema, headStr, options, newline, indentStr, baseIndent );
 1120|      0|			}
 1121|      0|		} else {
 1122|      0|			for ( XMP_Index level = baseIndent+2; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1122:42): [True: 0, False: 0]
  ------------------
 1123|      0|			headStr += kRDF_SchemaStart;	// Special case an empty XMP object.
 1124|      0|			headStr += '"';
 1125|      0|			headStr += xmpObj.tree.name;
 1126|      0|			headStr += "\"/>";
 1127|      0|			headStr += newline;
 1128|      0|		}
 1129|      0|	}
 1130|       |
 1131|       |	// Write the rdf:RDF end tag.
 1132|  3.39k|	for ( level = baseIndent+1; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1132:30): [True: 1.69k, False: 1.69k]
  ------------------
 1133|  1.69k|	headStr += kRDF_RDFEnd;
 1134|  1.69k|	headStr += newline;
 1135|       |
 1136|       |	// Write the xmpmeta end tag.
 1137|  1.69k|	if ( ! (options & kXMP_OmitXMPMetaElement) ) {
  ------------------
  |  Branch (1137:7): [True: 1.69k, False: 0]
  ------------------
 1138|  1.69k|		for ( level = baseIndent; level > 0; --level ) headStr += indentStr;
  ------------------
  |  Branch (1138:29): [True: 0, False: 1.69k]
  ------------------
 1139|  1.69k|		headStr += kRDF_XMPMetaEnd;
 1140|  1.69k|		headStr += newline;
 1141|  1.69k|	}
 1142|       |	
 1143|       |	// Write the packet trailer PI into the tail string as UTF-8.
 1144|  1.69k|	tailStr.erase();
 1145|  1.69k|	if ( ! (options & kXMP_OmitPacketWrapper) ) {
  ------------------
  |  Branch (1145:7): [True: 787, False: 909]
  ------------------
 1146|    787|		tailStr.reserve ( strlen(kPacketTrailer) + (strlen(indentStr) * baseIndent) );
 1147|    787|		for ( level = baseIndent; level > 0; --level ) tailStr += indentStr;
  ------------------
  |  Branch (1147:29): [True: 0, False: 787]
  ------------------
 1148|    787|		tailStr += kPacketTrailer;
 1149|    787|		if ( options & kXMP_ReadOnlyPacket ) tailStr[tailStr.size()-4] = 'r';
  ------------------
  |  Branch (1149:8): [True: 0, False: 787]
  ------------------
 1150|    787|	}
 1151|       |	
 1152|       |	// ! This assert is just a performance check, to see if the reserve was enough.
 1153|       |	// *** XMP_Assert ( headStr.size() <= outputLen );
 1154|       |	// *** Don't use an assert. Think of some way to track this without risk of aborting the client.
 1155|       |	
 1156|  1.69k|}	// SerializeAsRDF
XMPMeta-Serialize.cpp:_ZL15EstimateRDFSizePK8XMP_Nodeim:
   83|  70.1k|{
   84|  70.1k|	size_t outputLen = 2 * (indent*indentLen + currNode->name.size() + 4);	// The property element tags.
   85|       |	
   86|  70.1k|	if ( ! currNode->qualifiers.empty() ) {
  ------------------
  |  Branch (86:7): [True: 5.65k, False: 64.5k]
  ------------------
   87|       |		// This node has qualifiers, assume it is written using rdf:value and estimate the qualifiers.
   88|       |
   89|  5.65k|		indent += 2;	// Everything else is indented inside the rdf:Description element.
   90|  5.65k|		outputLen += 2 * ((indent-1)*indentLen + strlen(kRDF_StructStart) + 2);	// The rdf:Description tags.
   91|  5.65k|		outputLen += 2 * (indent*indentLen + strlen(kRDF_ValueStart) + 2);		// The rdf:value tags.
   92|       |
   93|  19.3k|		for ( size_t qualNum = 0, qualLim = currNode->qualifiers.size(); qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (93:68): [True: 13.6k, False: 5.65k]
  ------------------
   94|  13.6k|			const XMP_Node * currQual = currNode->qualifiers[qualNum];
   95|  13.6k|			outputLen += EstimateRDFSize ( currQual, indent, indentLen );
   96|  13.6k|		}
   97|       |
   98|  5.65k|	}
   99|       |	
  100|  70.1k|	if ( currNode->options & kXMP_PropValueIsStruct ) {
  ------------------
  |  Branch (100:7): [True: 2.50k, False: 67.6k]
  ------------------
  101|  2.50k|		indent += 1;
  102|  2.50k|		outputLen += 2 * (indent*indentLen + strlen(kRDF_StructStart) + 2);	// The rdf:Description tags.
  103|  67.6k|	} else if ( currNode->options & kXMP_PropValueIsArray ) {
  ------------------
  |  Branch (103:14): [True: 1.48k, False: 66.1k]
  ------------------
  104|  1.48k|		indent += 2;
  105|  1.48k|		outputLen += 2 * ((indent-1)*indentLen + strlen(kRDF_BagStart) + 2);		// The rdf:Bag/Seq/Alt tags.
  106|  1.48k|		outputLen += 2 * currNode->children.size() * (strlen(kRDF_ItemStart) + 2);	// The rdf:li tags, indent counted in children.
  107|  66.1k|	} else if ( ! (currNode->options & kXMP_SchemaNode) ) {
  ------------------
  |  Branch (107:14): [True: 62.1k, False: 4.05k]
  ------------------
  108|  62.1k|		outputLen += currNode->value.size();	// This is a leaf value node.
  109|  62.1k|	}
  110|       |
  111|   122k|	for ( size_t childNum = 0, childLim = currNode->children.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (111:67): [True: 52.4k, False: 70.1k]
  ------------------
  112|  52.4k|		const XMP_Node * currChild = currNode->children[childNum];
  113|  52.4k|		outputLen += EstimateRDFSize ( currChild, indent+1, indentLen );
  114|  52.4k|	}
  115|       |
  116|  70.1k|	return outputLen;
  117|       |	
  118|  70.1k|}	// EstimateRDFSize
XMPMeta-Serialize.cpp:_ZL26SerializeCompactRDFSchemasRK8XMP_NodeRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcSB_i:
  978|  1.69k|{
  979|  1.69k|	XMP_Index level;
  980|  1.69k|	size_t schema, schemaLim;
  981|       |	
  982|       |	// Begin the rdf:Description start tag.
  983|  5.08k|	for ( level = baseIndent+2; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (983:30): [True: 3.39k, False: 1.69k]
  ------------------
  984|  1.69k|	outputStr += kRDF_SchemaStart;
  985|  1.69k|	outputStr += '"';
  986|  1.69k|	outputStr += xmpTree.name;
  987|  1.69k|	outputStr += '"';
  988|       |	
  989|       |	// Write all necessary xmlns attributes.
  990|       |	
  991|  1.69k|	size_t totalLen = 8;	// Start at 8 for "xml:rdf:".
  992|  1.69k|	XMP_cStringMapPos currPos = sNamespacePrefixToURIMap->begin();
  993|  1.69k|	XMP_cStringMapPos endPos  = sNamespacePrefixToURIMap->end();
  994|   441k|	for ( ; currPos != endPos; ++currPos ) totalLen += currPos->first.size();
  ------------------
  |  Branch (994:10): [True: 439k, False: 1.69k]
  ------------------
  995|       |
  996|  1.69k|	XMP_VarString usedNS;
  997|  1.69k|	usedNS.reserve ( totalLen );
  998|  1.69k|	usedNS = "xml:rdf:";
  999|       |
 1000|  5.75k|	for ( schema = 0, schemaLim = xmpTree.children.size(); schema != schemaLim; ++schema ) {
  ------------------
  |  Branch (1000:57): [True: 4.05k, False: 1.69k]
  ------------------
 1001|  4.05k|		const XMP_Node * currSchema = xmpTree.children[schema];
 1002|  4.05k|		DeclareUsedNamespaces ( currSchema, usedNS, outputStr, newline, indentStr, baseIndent+4 );
 1003|  4.05k|	}
 1004|       |	
 1005|       |	// Write the top level "attrProps" and close the rdf:Description start tag.
 1006|  1.69k|	bool allAreAttrs = true;
 1007|  5.75k|	for ( schema = 0, schemaLim = xmpTree.children.size(); schema != schemaLim; ++schema ) {
  ------------------
  |  Branch (1007:57): [True: 4.05k, False: 1.69k]
  ------------------
 1008|  4.05k|		const XMP_Node * currSchema = xmpTree.children[schema];
 1009|  4.05k|		allAreAttrs &= SerializeCompactRDFAttrProps ( currSchema, outputStr, newline, indentStr, baseIndent+3 );
 1010|  4.05k|	}
 1011|  1.69k|	if ( ! allAreAttrs ) {
  ------------------
  |  Branch (1011:7): [True: 924, False: 772]
  ------------------
 1012|    924|		outputStr += ">";
 1013|    924|		outputStr += newline;
 1014|    924|	} else {
 1015|    772|		outputStr += "/>";
 1016|    772|		outputStr += newline;
 1017|    772|		return;	// ! Done if all properties in all schema are written as attributes.
 1018|    772|	}
 1019|       |
 1020|       |	// Write the remaining properties for each schema.
 1021|  3.44k|	for ( schema = 0, schemaLim = xmpTree.children.size(); schema != schemaLim; ++schema ) {
  ------------------
  |  Branch (1021:57): [True: 2.52k, False: 924]
  ------------------
 1022|  2.52k|		const XMP_Node * currSchema = xmpTree.children[schema];
 1023|  2.52k|		SerializeCompactRDFElemProps ( currSchema, outputStr, newline, indentStr, baseIndent+3 );
 1024|  2.52k|	}
 1025|       |	
 1026|       |	// Write the rdf:Description end tag.
 1027|       |	// *** Elide the end tag if everything (all props in all schema) is an attr.
 1028|  2.77k|	for ( level = baseIndent+2; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (1028:30): [True: 1.84k, False: 924]
  ------------------
 1029|    924|	outputStr += kRDF_SchemaEnd;
 1030|    924|	outputStr += newline;
 1031|       |
 1032|    924|}	// SerializeCompactRDFSchemas
XMPMeta-Serialize.cpp:_ZL21DeclareUsedNamespacesPK8XMP_NodeRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES9_PKcSB_i:
  196|  70.1k|{
  197|       |
  198|  70.1k|	if ( currNode->options & kXMP_SchemaNode ) {
  ------------------
  |  Branch (198:7): [True: 4.05k, False: 66.1k]
  ------------------
  199|       |		// The schema node name is the URI, the value is the prefix.
  200|  4.05k|		DeclareOneNamespace ( currNode->value, currNode->name, usedNS, outputStr, newline, indentStr, indent );
  201|  66.1k|	} else if ( currNode->options & kXMP_PropValueIsStruct ) {
  ------------------
  |  Branch (201:14): [True: 2.50k, False: 63.6k]
  ------------------
  202|  10.1k|		for ( size_t fieldNum = 0, fieldLim = currNode->children.size(); fieldNum < fieldLim; ++fieldNum ) {
  ------------------
  |  Branch (202:68): [True: 7.64k, False: 2.50k]
  ------------------
  203|  7.64k|			const XMP_Node * currField = currNode->children[fieldNum];
  204|  7.64k|			DeclareElemNamespace ( currField->name, usedNS, outputStr, newline, indentStr, indent );
  205|  7.64k|		}
  206|  2.50k|	}
  207|       |
  208|   122k|	for ( size_t childNum = 0, childLim = currNode->children.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (208:67): [True: 52.4k, False: 70.1k]
  ------------------
  209|  52.4k|		const XMP_Node * currChild = currNode->children[childNum];
  210|  52.4k|		DeclareUsedNamespaces ( currChild, usedNS, outputStr, newline, indentStr, indent );
  211|  52.4k|	}
  212|       |
  213|  83.8k|	for ( size_t qualNum = 0, qualLim = currNode->qualifiers.size(); qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (213:67): [True: 13.6k, False: 70.1k]
  ------------------
  214|  13.6k|		const XMP_Node * currQual = currNode->qualifiers[qualNum];
  215|  13.6k|		DeclareElemNamespace ( currQual->name, usedNS, outputStr, newline, indentStr, indent );
  216|  13.6k|		DeclareUsedNamespaces ( currQual, usedNS, outputStr, newline, indentStr, indent );
  217|  13.6k|	}
  218|       |	
  219|  70.1k|}	// DeclareUsedNamespaces
XMPMeta-Serialize.cpp:_ZL19DeclareOneNamespaceRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEES7_RS5_S8_PKcSA_i:
  133|  25.3k|{
  134|  25.3k|	XMP_VarString boundedPrefix = ":";
  135|  25.3k|	boundedPrefix += nsPrefix;
  136|  25.3k|	size_t nsPos = usedNS.find ( boundedPrefix );
  137|       |
  138|  25.3k|	if ( nsPos == XMP_VarString::npos ) {
  ------------------
  |  Branch (138:7): [True: 3.57k, False: 21.7k]
  ------------------
  139|       |		
  140|  3.57k|		outputStr += newline;
  141|  17.8k|		for ( ; indent > 0; --indent ) outputStr += indentStr;
  ------------------
  |  Branch (141:11): [True: 14.3k, False: 3.57k]
  ------------------
  142|  3.57k|		outputStr += "xmlns:";
  143|  3.57k|		outputStr += nsPrefix;
  144|  3.57k|		if (outputStr[outputStr.size ( ) - 1] == ':')
  ------------------
  |  Branch (144:7): [True: 3.57k, False: 0]
  ------------------
  145|  3.57k|			outputStr[outputStr.size ( ) - 1] = '=';	// Change the colon to =.
  146|      0|		else
  147|      0|			outputStr += '=';
  148|  3.57k|		outputStr += '"';
  149|  3.57k|		outputStr += nsURI;
  150|  3.57k|		outputStr += '"';
  151|       |
  152|  3.57k|		usedNS += nsPrefix;
  153|       |
  154|  3.57k|	}
  155|       |
  156|  25.3k|}	// DeclareOneNamespace
XMPMeta-Serialize.cpp:_ZL20DeclareElemNamespaceRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_S8_PKcSA_i:
  170|  21.3k|{
  171|  21.3k|	size_t colonPos = elemName.find ( ':' );
  172|       |
  173|  21.3k|	if ( colonPos != XMP_VarString::npos ) {
  ------------------
  |  Branch (173:7): [True: 21.3k, False: 0]
  ------------------
  174|  21.3k|		XMP_VarString nsPrefix ( elemName.substr ( 0, colonPos+1 ) );
  175|  21.3k|		XMP_StringMapPos prefixPos = sNamespacePrefixToURIMap->find ( nsPrefix );
  176|  21.3k|		XMP_Enforce ( prefixPos != sNamespacePrefixToURIMap->end() );
  ------------------
  |  |  148|  21.3k|		if ( ! (c) ) {																				\
  |  |  ------------------
  |  |  |  Branch (148:8): [True: 0, False: 21.3k]
  |  |  ------------------
  |  |  149|      0|			const char * assert_msg = _NotifyMsg ( XMP_Enforce, (c), __FILE__, __LINE__ );			\
  |  |  ------------------
  |  |  |  |  139|      0|#define _NotifyMsg(n,c,f,l)	#n " failed: " #c " in " f " at line " _MakeStr(l)
  |  |  |  |  ------------------
  |  |  |  |  |  |  138|      0|#define _MakeStr(p)			#p
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      0|			XMP_Throw ( assert_msg , kXMPErr_EnforceFailure );										\
  |  |  ------------------
  |  |  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  |  |  ------------------
  |  |  151|      0|		}
  ------------------
  177|  21.3k|		DeclareOneNamespace ( nsPrefix, prefixPos->second, usedNS, outputStr, newline, indentStr, indent );
  178|  21.3k|	}
  179|       |
  180|  21.3k|}	// DeclareElemNamespace
XMPMeta-Serialize.cpp:_ZL28SerializeCompactRDFAttrPropsPK8XMP_NodeRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcSB_i:
  687|  6.50k|{
  688|  6.50k|	size_t prop, propLim;
  689|  6.50k|	bool allAreAttrs = true;
  690|       |
  691|  22.1k|	for ( prop = 0, propLim = parentNode->children.size(); prop != propLim; ++prop ) {
  ------------------
  |  Branch (691:57): [True: 15.6k, False: 6.50k]
  ------------------
  692|       |
  693|  15.6k|		const XMP_Node * currProp = parentNode->children[prop];
  694|  15.6k|		if ( ! CanBeRDFAttrProp ( currProp ) ) {
  ------------------
  |  Branch (694:8): [True: 2.26k, False: 13.4k]
  ------------------
  695|  2.26k|			allAreAttrs = false;
  696|  2.26k|			continue;
  697|  2.26k|		}
  698|       |		
  699|  13.4k|		outputStr += newline;
  700|  74.6k|		for ( XMP_Index level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (700:35): [True: 61.2k, False: 13.4k]
  ------------------
  701|  13.4k|		outputStr += currProp->name;
  702|  13.4k|		outputStr += "=\"";
  703|  13.4k|		AppendNodeValue ( outputStr, currProp->value, kForAttribute );
  704|  13.4k|		outputStr += '"';
  705|       |
  706|  13.4k|	}
  707|       |	
  708|  6.50k|	return allAreAttrs;
  709|       |
  710|  6.50k|}	// SerializeCompactRDFAttrProps
XMPMeta-Serialize.cpp:_ZL16CanBeRDFAttrPropPK8XMP_Node:
  346|  66.4k|{
  347|       |	
  348|  66.4k|	if ( propNode->name[0] == '[' ) return false;
  ------------------
  |  Branch (348:7): [True: 36.6k, False: 29.7k]
  ------------------
  349|  29.7k|	if ( ! propNode->qualifiers.empty() ) return false;
  ------------------
  |  Branch (349:7): [True: 186, False: 29.5k]
  ------------------
  350|  29.5k|	if ( propNode->options & kXMP_PropValueIsURI ) return false;
  ------------------
  |  Branch (350:7): [True: 0, False: 29.5k]
  ------------------
  351|  29.5k|	if ( propNode->options & kXMP_PropCompositeMask ) return false;
  ------------------
  |  Branch (351:7): [True: 4.35k, False: 25.1k]
  ------------------
  352|       |	
  353|  25.1k|	return true;
  354|       |	
  355|  29.5k|}	// CanBeRDFAttrProp
XMPMeta-Serialize.cpp:_ZL15AppendNodeValueRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERKS5_b:
  286|  62.0k|{
  287|       |
  288|  62.0k|	unsigned char * runStart = (unsigned char *) value.c_str();
  289|  62.0k|	unsigned char * runLimit  = runStart + value.size();
  290|  62.0k|	unsigned char * runEnd;
  291|  62.0k|	unsigned char   ch=0;
  292|       |	
  293|  1.15M|	while ( runStart < runLimit ) {
  ------------------
  |  Branch (293:10): [True: 1.09M, False: 62.0k]
  ------------------
  294|       |	
  295|  10.9M|		for ( runEnd = runStart; runEnd < runLimit; ++runEnd ) {
  ------------------
  |  Branch (295:28): [True: 10.9M, False: 60.3k]
  ------------------
  296|  10.9M|			ch = *runEnd;
  297|  10.9M|			if ( forAttribute && (ch == '"') ) break;
  ------------------
  |  Branch (297:9): [True: 8.42M, False: 2.50M]
  |  Branch (297:25): [True: 29.1k, False: 8.39M]
  ------------------
  298|  10.8M|			if ( (ch < 0x20) || (ch == '&') || (ch == '<') || (ch == '>') ) break;
  ------------------
  |  Branch (298:9): [True: 40.3k, False: 10.8M]
  |  Branch (298:24): [True: 314, False: 10.8M]
  |  Branch (298:39): [True: 350, False: 10.8M]
  |  Branch (298:54): [True: 961k, False: 9.89M]
  ------------------
  299|  10.8M|		}
  300|       |		
  301|  1.09M|		outputStr.append ( (char *) runStart, (runEnd - runStart) );
  302|       |		
  303|  1.09M|		if ( runEnd < runLimit ) {
  ------------------
  |  Branch (303:8): [True: 1.03M, False: 60.3k]
  ------------------
  304|       |
  305|  1.03M|			if ( ch < 0x20 ) {
  ------------------
  |  Branch (305:9): [True: 40.3k, False: 991k]
  ------------------
  306|       |			
  307|  40.3k|				XMP_Assert ( (ch == kTab) || (ch == kLF) || (ch == kCR) );
  ------------------
  |  |  142|  40.3k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  308|       |
  309|  40.3k|				char hexBuf[16];
  310|  40.3k|				memcpy ( hexBuf, "&#xn;", 5 );
  311|  40.3k|				hexBuf[3] = kHexDigits[ch&0xF];
  ------------------
  |  |   94|  40.3k|#define kHexDigits "0123456789ABCDEF"
  ------------------
  312|  40.3k|				outputStr.append ( hexBuf, 5 );
  313|       |
  314|   991k|			} else {
  315|       |
  316|   991k|				if ( ch == '"' ) {
  ------------------
  |  Branch (316:10): [True: 29.1k, False: 962k]
  ------------------
  317|  29.1k|					outputStr += "&quot;";
  318|   962k|				} else if ( ch == '<' ) {
  ------------------
  |  Branch (318:17): [True: 350, False: 962k]
  ------------------
  319|    350|					outputStr += "&lt;";
  320|   962k|				} else if ( ch == '>' ) {
  ------------------
  |  Branch (320:17): [True: 961k, False: 314]
  ------------------
  321|   961k|					outputStr += "&gt;";
  322|   961k|				} else {
  323|    314|					XMP_Assert ( ch == '&' );
  ------------------
  |  |  142|    314|	#define XMP_Assert(c)	((void) 0)
  ------------------
  324|    314|					outputStr += "&amp;";
  325|    314|				}
  326|       |
  327|   991k|			}
  328|       |
  329|  1.03M|			++runEnd;
  330|       |
  331|  1.03M|		}
  332|       |		
  333|  1.09M|		runStart = runEnd;
  334|       |	
  335|  1.09M|	}
  336|       |
  337|  62.0k|}	// AppendNodeValue
XMPMeta-Serialize.cpp:_ZL28SerializeCompactRDFElemPropsPK8XMP_NodeRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcSB_i:
  758|  4.02k|{
  759|  4.02k|	XMP_Index level;
  760|       |
  761|  47.2k|	for ( size_t prop = 0, propLim = parentNode->children.size(); prop != propLim; ++prop ) {
  ------------------
  |  Branch (761:64): [True: 43.1k, False: 4.02k]
  ------------------
  762|       |
  763|  43.1k|		const XMP_Node * propNode = parentNode->children[prop];
  764|  43.1k|		if ( CanBeRDFAttrProp ( propNode ) ) continue;
  ------------------
  |  Branch (764:8): [True: 4.22k, False: 38.9k]
  ------------------
  765|       |
  766|  38.9k|		bool emitEndTag = true;
  767|  38.9k|		bool indentEndTag = true;
  768|       |
  769|  38.9k|		XMP_OptionBits propForm = propNode->options & kXMP_PropCompositeMask;
  770|       |
  771|       |		// -----------------------------------------------------------------------------------
  772|       |		// Determine the XML element name, write the name part of the start tag. Look over the
  773|       |		// qualifiers to decide on "normal" versus "rdf:value" form. Emit the attribute
  774|       |		// qualifiers at the same time.
  775|       |		
  776|  38.9k|		XMP_StringPtr elemName = propNode->name.c_str();
  777|  38.9k|		if ( *elemName == '[' ) elemName = "rdf:li";
  ------------------
  |  Branch (777:8): [True: 36.6k, False: 2.26k]
  ------------------
  778|       |
  779|   229k|		for ( level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (779:25): [True: 190k, False: 38.9k]
  ------------------
  780|  38.9k|		outputStr += '<';
  781|  38.9k|		outputStr += elemName;
  782|       |
  783|  38.9k|		#define isCompact	false
  784|  38.9k|		bool hasGeneralQualifiers = isCompact;	// Might also become true later.
  ------------------
  |  |  783|  38.9k|		#define isCompact	false
  ------------------
  785|  38.9k|		bool hasRDFResourceQual   = false;
  786|       |
  787|  52.6k|		for ( size_t qualNum = 0, qualLim = propNode->qualifiers.size(); qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (787:68): [True: 13.6k, False: 38.9k]
  ------------------
  788|  13.6k|			const XMP_Node * currQual = propNode->qualifiers[qualNum];
  789|  13.6k|			if ( ! IsRDFAttrQualifier ( currQual->name ) ) {
  ------------------
  |  Branch (789:9): [True: 8.43k, False: 5.23k]
  ------------------
  790|  8.43k|				hasGeneralQualifiers = true;
  791|  8.43k|			} else {
  792|  5.23k|				if ( currQual->name == "rdf:resource" ) hasRDFResourceQual = true;
  ------------------
  |  Branch (792:10): [True: 0, False: 5.23k]
  ------------------
  793|  5.23k|				outputStr += ' ';
  794|  5.23k|				outputStr += currQual->name;
  795|  5.23k|				outputStr += "=\"";
  796|  5.23k|				AppendNodeValue ( outputStr, currQual->value, kForAttribute );
  797|  5.23k|				outputStr += '"';
  798|  5.23k|			}
  799|  13.6k|		}
  800|       |		
  801|       |		// --------------------------------------------------------
  802|       |		// Process the property according to the standard patterns.
  803|       |	
  804|  38.9k|		if ( hasGeneralQualifiers ) {
  ------------------
  |  Branch (804:8): [True: 436, False: 38.5k]
  ------------------
  805|       |		
  806|       |			// -------------------------------------------------------------------------------------
  807|       |			// The node has general qualifiers, ones that can't be attributes on a property element.
  808|       |			// Emit using the qualified property pseudo-struct form. The value is output by a call
  809|       |			// to SerializePrettyRDFProperty with emitAsRDFValue set.
  810|       |			
  811|       |			// *** We're losing compactness in the calls to SerializePrettyRDFProperty.
  812|       |			// *** Should refactor to have SerializeCompactRDFProperty that does one node.
  813|       |
  814|    436|			outputStr += " rdf:parseType=\"Resource\">";
  815|    436|			outputStr += newline;
  816|       |
  817|    436|			SerializePrettyRDFProperty ( propNode, outputStr, newline, indentStr, indent+1, true );
  818|       |		
  819|    436|			size_t qualNum = 0;
  820|    436|			size_t qualLim = propNode->qualifiers.size();
  821|    436|			if ( propNode->options & kXMP_PropHasLang ) ++qualNum;
  ------------------
  |  Branch (821:9): [True: 16, False: 420]
  ------------------
  822|       |			
  823|  8.87k|			for ( ; qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (823:12): [True: 8.43k, False: 436]
  ------------------
  824|  8.43k|				const XMP_Node * currQual = propNode->qualifiers[qualNum];
  825|  8.43k|				SerializePrettyRDFProperty ( currQual, outputStr, newline, indentStr, indent+1 );
  826|  8.43k|			}
  827|       |			
  828|  38.5k|		} else {
  829|       |
  830|       |			// --------------------------------------------------------------------
  831|       |			// This node has only attribute qualifiers. Emit as a property element.
  832|       |			
  833|  38.5k|			if ( propForm == 0 ) {
  ------------------
  |  Branch (833:9): [True: 34.5k, False: 3.94k]
  ------------------
  834|       |			
  835|       |				// --------------------------
  836|       |				// This is a simple property.
  837|       |				
  838|  34.5k|				if ( propNode->options & kXMP_PropValueIsURI ) {
  ------------------
  |  Branch (838:10): [True: 0, False: 34.5k]
  ------------------
  839|      0|					outputStr += " rdf:resource=\"";
  840|      0|					AppendNodeValue ( outputStr, propNode->value, kForAttribute );
  841|      0|					outputStr += "\"/>";
  842|      0|					outputStr += newline;
  843|      0|					emitEndTag = false;
  844|  34.5k|				} else if ( propNode->value.empty() ) {
  ------------------
  |  Branch (844:17): [True: 10, False: 34.5k]
  ------------------
  845|     10|					outputStr += "/>";
  846|     10|					outputStr += newline;
  847|     10|					emitEndTag = false;
  848|  34.5k|				} else {
  849|  34.5k|					outputStr += '>';
  850|  34.5k|					AppendNodeValue ( outputStr, propNode->value, kForElement );
  851|  34.5k|					indentEndTag = false;
  852|  34.5k|				}
  853|       |				
  854|  34.5k|			} else if ( propForm & kXMP_PropValueIsArray ) {
  ------------------
  |  Branch (854:16): [True: 1.48k, False: 2.46k]
  ------------------
  855|       |
  856|       |				// -----------------
  857|       |				// This is an array.
  858|       |				
  859|  1.48k|				outputStr += '>';
  860|  1.48k|				outputStr += newline;
  861|  1.48k|				EmitRDFArrayTag ( propForm, outputStr, newline, indentStr, indent+1, propNode->children.size(), kIsStartTag );
  862|       |			
  863|  1.48k|				if ( XMP_ArrayIsAltText(propNode->options) ) NormalizeLangArray ( (XMP_Node*)propNode );
  ------------------
  |  Branch (863:10): [True: 0, False: 1.48k]
  ------------------
  864|  1.48k|				SerializeCompactRDFElemProps ( propNode, outputStr, newline, indentStr, indent+2 );
  865|       |
  866|  1.48k|				EmitRDFArrayTag ( propForm, outputStr, newline, indentStr, indent+1, propNode->children.size(), kIsEndTag );
  867|       |
  868|  2.46k|			} else {
  869|       |
  870|       |				// ----------------------
  871|       |				// This must be a struct.
  872|       |				
  873|  2.46k|				XMP_Assert ( propForm & kXMP_PropValueIsStruct );
  ------------------
  |  |  142|  2.46k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  874|       |
  875|  2.46k|				bool hasAttrFields = false;
  876|  2.46k|				bool hasElemFields = false;
  877|       |			
  878|  2.46k|				size_t field, fieldLim;
  879|  10.0k|				for ( field = 0, fieldLim = propNode->children.size(); field != fieldLim; ++field ) {
  ------------------
  |  Branch (879:60): [True: 7.55k, False: 2.44k]
  ------------------
  880|  7.55k|					XMP_Node * currField = propNode->children[field];
  881|  7.55k|					if ( CanBeRDFAttrProp ( currField ) ) {
  ------------------
  |  Branch (881:11): [True: 7.53k, False: 20]
  ------------------
  882|  7.53k|						hasAttrFields = true;
  883|  7.53k|						if ( hasElemFields ) break;	// No sense looking further.
  ------------------
  |  Branch (883:12): [True: 0, False: 7.53k]
  ------------------
  884|  7.53k|					} else {
  885|     20|						hasElemFields = true;
  886|     20|						if ( hasAttrFields ) break;	// No sense looking further.
  ------------------
  |  Branch (886:12): [True: 20, False: 0]
  ------------------
  887|     20|					}
  888|  7.55k|				}
  889|       |				
  890|  2.46k|				if ( hasRDFResourceQual && hasElemFields ) {
  ------------------
  |  Branch (890:10): [True: 0, False: 2.46k]
  |  Branch (890:32): [True: 0, False: 0]
  ------------------
  891|      0|					XMP_Throw ( "Can't mix rdf:resource qualifier and element fields", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  892|      0|				}
  893|       |				
  894|  2.46k|				if ( propNode->children.size() == 0 ) {
  ------------------
  |  Branch (894:10): [True: 18, False: 2.44k]
  ------------------
  895|       |				
  896|       |					// Catch an empty struct as a special case. The case below would emit an empty
  897|       |					// XML element, which gets reparsed as a simple property with an empty value.
  898|     18|					outputStr += " rdf:parseType=\"Resource\"/>";
  899|     18|					outputStr += newline;
  900|     18|					emitEndTag = false;
  901|       |				
  902|  2.44k|				} else if ( ! hasElemFields ) {
  ------------------
  |  Branch (902:17): [True: 2.42k, False: 20]
  ------------------
  903|       |
  904|       |					// All fields can be attributes, use the emptyPropertyElt form.
  905|  2.42k|					SerializeCompactRDFAttrProps ( propNode, outputStr, newline, indentStr, indent+1 );
  906|  2.42k|					outputStr += "/>";
  907|  2.42k|					outputStr += newline;
  908|  2.42k|					emitEndTag = false;
  909|       |
  910|  2.42k|				} else if ( ! hasAttrFields ) {
  ------------------
  |  Branch (910:17): [True: 0, False: 20]
  ------------------
  911|       |				
  912|       |					// All fields must be elements, use the parseTypeResourcePropertyElt form.
  913|      0|					outputStr += " rdf:parseType=\"Resource\">";
  914|      0|					outputStr += newline;
  915|      0|					SerializeCompactRDFElemProps ( propNode, outputStr, newline, indentStr, indent+1 );
  916|       |				
  917|     20|				} else {
  918|       |				
  919|       |					// Have a mix of attributes and elements, use an inner rdf:Description.
  920|     20|					outputStr += '>';
  921|     20|					outputStr += newline;
  922|    122|					for ( level = indent+1; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (922:30): [True: 102, False: 20]
  ------------------
  923|     20|					outputStr += "<rdf:Description";
  924|     20|					SerializeCompactRDFAttrProps ( propNode, outputStr, newline, indentStr, indent+2 );
  925|     20|					outputStr += ">";
  926|     20|					outputStr += newline;
  927|     20|					SerializeCompactRDFElemProps ( propNode, outputStr, newline, indentStr, indent+1 );
  928|    122|					for ( level = indent+1; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (928:30): [True: 102, False: 20]
  ------------------
  929|     20|					outputStr += kRDF_StructEnd;
  930|     20|					outputStr += newline;
  931|       |
  932|     20|				}
  933|       |
  934|  2.46k|			}
  935|       |
  936|  38.5k|		}
  937|       |		
  938|       |		// ----------------------------------
  939|       |		// Emit the property element end tag.
  940|       |		
  941|  38.9k|		if ( emitEndTag ) {
  ------------------
  |  Branch (941:8): [True: 36.4k, False: 2.45k]
  ------------------
  942|  36.4k|			if ( indentEndTag ) for ( level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (942:9): [True: 1.94k, False: 34.5k]
  |  Branch (942:46): [True: 6.64k, False: 1.94k]
  ------------------
  943|  36.4k|			outputStr += "</";
  944|  36.4k|			outputStr += elemName;
  945|  36.4k|			outputStr += '>';
  946|  36.4k|			outputStr += newline;
  947|  36.4k|		}
  948|       |
  949|  38.9k|	}
  950|       |	
  951|  4.02k|}	// SerializeCompactRDFElemProps
XMPMeta-Serialize.cpp:_ZL18IsRDFAttrQualifierNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  366|  22.1k|{
  367|       |
  368|   106k|	for ( size_t i = 0; *sAttrQualifiers[i] != 0; ++i ) {
  ------------------
  |  Branch (368:22): [True: 89.6k, False: 16.8k]
  ------------------
  369|  89.6k|		if ( qualName == sAttrQualifiers[i] ) return true;
  ------------------
  |  Branch (369:8): [True: 5.24k, False: 84.3k]
  ------------------
  370|  89.6k|	}
  371|       |
  372|  16.8k|	return false;
  373|       |	
  374|  22.1k|}	// IsRDFAttrQualifier
XMPMeta-Serialize.cpp:_ZL26SerializePrettyRDFPropertyPK8XMP_NodeRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPKcSB_ib:
  415|  8.94k|{
  416|  8.94k|	XMP_Index level;
  417|  8.94k|	bool emitEndTag   = true;
  418|  8.94k|	bool indentEndTag = true;
  419|       |
  420|  8.94k|	XMP_OptionBits propForm = propNode->options & kXMP_PropCompositeMask;
  421|       |
  422|       |	// ------------------------------------------------------------------------------------------
  423|       |	// Determine the XML element name. Open the start tag with the name and attribute qualifiers.
  424|       |	
  425|  8.94k|	XMP_StringPtr elemName = propNode->name.c_str();
  426|  8.94k|	if ( emitAsRDFValue ) {
  ------------------
  |  Branch (426:7): [True: 438, False: 8.50k]
  ------------------
  427|    438|		elemName= "rdf:value";
  428|  8.50k|	} else if ( *elemName == '[' ) {
  ------------------
  |  Branch (428:14): [True: 4, False: 8.49k]
  ------------------
  429|      4|		elemName = "rdf:li";
  430|      4|	}
  431|       |
  432|  62.1k|	for ( level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (432:24): [True: 53.2k, False: 8.94k]
  ------------------
  433|  8.94k|	outputStr += '<';
  434|  8.94k|	outputStr += elemName;
  435|       |	
  436|  8.94k|	#define isCompact	false
  437|  8.94k|	bool hasGeneralQualifiers = isCompact;	// Might also become true later.
  ------------------
  |  |  436|  8.94k|	#define isCompact	false
  ------------------
  438|  8.94k|	bool hasRDFResourceQual   = false;
  439|       |	
  440|  17.3k|	for ( size_t qualNum = 0, qualLim = propNode->qualifiers.size(); qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (440:67): [True: 8.45k, False: 8.94k]
  ------------------
  441|  8.45k|		const XMP_Node * currQual = propNode->qualifiers[qualNum];
  442|  8.45k|		if ( ! IsRDFAttrQualifier ( currQual->name ) ) {
  ------------------
  |  Branch (442:8): [True: 8.43k, False: 16]
  ------------------
  443|  8.43k|			hasGeneralQualifiers = true;
  444|  8.43k|		} else {
  445|     16|			if ( currQual->name == "rdf:resource" ) hasRDFResourceQual = true;
  ------------------
  |  Branch (445:9): [True: 0, False: 16]
  ------------------
  446|     16|			if ( ! emitAsRDFValue ) {
  ------------------
  |  Branch (446:9): [True: 0, False: 16]
  ------------------
  447|      0|				outputStr += ' ';
  448|      0|				outputStr += currQual->name;
  449|      0|				outputStr += "=\"";
  450|      0|				AppendNodeValue ( outputStr, currQual->value, kForAttribute );
  451|      0|				outputStr += '"';
  452|      0|			}
  453|     16|		}
  454|  8.45k|	}
  455|       |	
  456|       |	// --------------------------------------------------------
  457|       |	// Process the property according to the standard patterns.
  458|       |	
  459|  8.94k|	if ( hasGeneralQualifiers && (! emitAsRDFValue) ) {
  ------------------
  |  Branch (459:7): [True: 440, False: 8.50k]
  |  Branch (459:31): [True: 2, False: 438]
  ------------------
  460|       |	
  461|       |		// -----------------------------------------------------------------------------------------
  462|       |		// This node has general, non-attribute, qualifiers. Emit using the qualified property form.
  463|       |		// ! The value is output by a recursive call ON THE SAME NODE with emitAsRDFValue set.
  464|       |
  465|      2|		if ( hasRDFResourceQual ) {
  ------------------
  |  Branch (465:8): [True: 0, False: 2]
  ------------------
  466|      0|			XMP_Throw ( "Can't mix rdf:resource and general qualifiers", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  467|      0|		}
  468|       |		
  469|      2|		outputStr += " rdf:parseType=\"Resource\">";
  470|      2|		outputStr += newline;
  471|       |
  472|      2|		SerializePrettyRDFProperty ( propNode, outputStr, newline, indentStr, indent+1, true );
  473|       |		
  474|      4|		for ( size_t qualNum = 0, qualLim = propNode->qualifiers.size(); qualNum < qualLim; ++qualNum ) {
  ------------------
  |  Branch (474:68): [True: 2, False: 2]
  ------------------
  475|      2|			const XMP_Node * currQual = propNode->qualifiers[qualNum];
  476|      2|			if ( IsRDFAttrQualifier ( currQual->name ) ) continue;
  ------------------
  |  Branch (476:9): [True: 0, False: 2]
  ------------------
  477|      2|			SerializePrettyRDFProperty ( currQual, outputStr, newline, indentStr, indent+1 );
  478|      2|		}
  479|       |		
  480|  8.93k|	} else {
  481|       |
  482|       |		// --------------------------------------------------------------------
  483|       |		// This node has no general qualifiers. Emit using an unqualified form.
  484|       |		
  485|  8.93k|		if ( propForm == 0 ) {
  ------------------
  |  Branch (485:8): [True: 8.89k, False: 40]
  ------------------
  486|       |		
  487|       |			// --------------------------
  488|       |			// This is a simple property.
  489|       |			
  490|  8.89k|			if ( propNode->options & kXMP_PropValueIsURI ) {
  ------------------
  |  Branch (490:9): [True: 0, False: 8.89k]
  ------------------
  491|      0|				outputStr += " rdf:resource=\"";
  492|      0|				AppendNodeValue ( outputStr, propNode->value, kForAttribute );
  493|      0|				outputStr += "\"/>";
  494|      0|				outputStr += newline;
  495|      0|				emitEndTag = false;
  496|  8.89k|			} else if ( propNode->value.empty() ) {
  ------------------
  |  Branch (496:16): [True: 31, False: 8.86k]
  ------------------
  497|     31|				outputStr += "/>";
  498|     31|				outputStr += newline;
  499|     31|				emitEndTag = false;
  500|  8.86k|			} else {
  501|  8.86k|				outputStr += '>';
  502|  8.86k|				AppendNodeValue ( outputStr, propNode->value, kForElement );
  503|  8.86k|				indentEndTag = false;
  504|  8.86k|			}
  505|       |			
  506|  8.89k|		} else if ( propForm & kXMP_PropValueIsArray ) {
  ------------------
  |  Branch (506:15): [True: 4, False: 36]
  ------------------
  507|       |		
  508|       |			// This is an array.
  509|      4|			outputStr += '>';
  510|      4|			outputStr += newline;
  511|      4|			EmitRDFArrayTag ( propForm, outputStr, newline, indentStr, indent+1, propNode->children.size(), kIsStartTag );
  512|      4|			if ( XMP_ArrayIsAltText(propNode->options) ) NormalizeLangArray ( (XMP_Node*)propNode );
  ------------------
  |  Branch (512:9): [True: 0, False: 4]
  ------------------
  513|      8|			for ( size_t childNum = 0, childLim = propNode->children.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (513:69): [True: 4, False: 4]
  ------------------
  514|      4|				const XMP_Node * currChild = propNode->children[childNum];
  515|      4|				SerializePrettyRDFProperty ( currChild, outputStr, newline, indentStr, indent+2 );
  516|      4|			}
  517|      4|			EmitRDFArrayTag ( propForm, outputStr, newline, indentStr, indent+1, propNode->children.size(), kIsEndTag );
  518|       |		
  519|       |		
  520|     36|		} else if ( ! hasRDFResourceQual ) {
  ------------------
  |  Branch (520:15): [True: 36, False: 0]
  ------------------
  521|       |		
  522|       |			// This is a "normal" struct, use the rdf:parseType="Resource" form.
  523|     36|			XMP_Assert ( propForm & kXMP_PropValueIsStruct );
  ------------------
  |  |  142|     36|	#define XMP_Assert(c)	((void) 0)
  ------------------
  524|     36|			if ( propNode->children.size() == 0 ) {
  ------------------
  |  Branch (524:9): [True: 5, False: 31]
  ------------------
  525|      5|				outputStr += " rdf:parseType=\"Resource\"/>";
  526|      5|				outputStr += newline;
  527|      5|				emitEndTag = false;
  528|     31|			} else {
  529|     31|				outputStr += " rdf:parseType=\"Resource\">";
  530|     31|				outputStr += newline;
  531|     93|				for ( size_t childNum = 0, childLim = propNode->children.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (531:70): [True: 62, False: 31]
  ------------------
  532|     62|					const XMP_Node * currChild = propNode->children[childNum];
  533|     62|					SerializePrettyRDFProperty ( currChild, outputStr, newline, indentStr, indent+1 );
  534|     62|				}
  535|     31|			}
  536|       |		
  537|     36|		} else {
  538|       |		
  539|       |			// This is a struct with an rdf:resource attribute, use the "empty property element" form.
  540|      0|			XMP_Assert ( propForm & kXMP_PropValueIsStruct );
  ------------------
  |  |  142|      0|	#define XMP_Assert(c)	((void) 0)
  ------------------
  541|      0|			for ( size_t childNum = 0, childLim = propNode->children.size(); childNum < childLim; ++childNum ) {
  ------------------
  |  Branch (541:69): [True: 0, False: 0]
  ------------------
  542|      0|				const XMP_Node * currChild = propNode->children[childNum];
  543|      0|				if ( ! CanBeRDFAttrProp ( currChild ) ) {
  ------------------
  |  Branch (543:10): [True: 0, False: 0]
  ------------------
  544|      0|					XMP_Throw ( "Can't mix rdf:resource and complex fields", kXMPErr_BadRDF );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  545|      0|				}
  546|      0|				outputStr += newline;
  547|      0|				for ( level = indent+1; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (547:29): [True: 0, False: 0]
  ------------------
  548|      0|				outputStr += ' ';
  549|      0|				outputStr += currChild->name;
  550|      0|				outputStr += "=\"";
  551|      0|				outputStr += currChild->value;
  552|      0|				outputStr += '"';
  553|      0|			}
  554|      0|			outputStr += "/>";
  555|      0|			outputStr += newline;
  556|      0|			emitEndTag = false;
  557|       |		
  558|      0|		}
  559|       |		
  560|  8.93k|	}
  561|       |	
  562|       |	// ----------------------------------
  563|       |	// Emit the property element end tag.
  564|       |	
  565|  8.94k|	if ( emitEndTag ) {
  ------------------
  |  Branch (565:7): [True: 8.90k, False: 36]
  ------------------
  566|  8.90k|		if ( indentEndTag ) for ( level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (566:8): [True: 37, False: 8.86k]
  |  Branch (566:45): [True: 176, False: 37]
  ------------------
  567|  8.90k|		outputStr += "</";
  568|  8.90k|		outputStr += elemName;
  569|  8.90k|		outputStr += '>';
  570|  8.90k|		outputStr += newline;
  571|  8.90k|	}
  572|       |	
  573|  8.94k|}	// SerializePrettyRDFProperty
XMPMeta-Serialize.cpp:_ZL15EmitRDFArrayTagjRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPKcS8_iib:
  240|  2.97k|{
  241|  2.97k|	if ( (! isStartTag) && (arraySize == 0) ) return;
  ------------------
  |  Branch (241:7): [True: 1.48k, False: 1.48k]
  |  Branch (241:25): [True: 25, False: 1.46k]
  ------------------
  242|       |	
  243|  14.9k|	for ( XMP_Index level = indent; level > 0; --level ) outputStr += indentStr;
  ------------------
  |  Branch (243:34): [True: 11.9k, False: 2.95k]
  ------------------
  244|  2.95k|	if ( isStartTag ) {
  ------------------
  |  Branch (244:7): [True: 1.48k, False: 1.46k]
  ------------------
  245|  1.48k|		outputStr += "<rdf:";
  246|  1.48k|	} else {
  247|  1.46k|		outputStr += "</rdf:";
  248|  1.46k|	}
  249|       |
  250|  2.95k|	if ( arrayForm & kXMP_PropArrayIsAlternate ) {
  ------------------
  |  Branch (250:7): [True: 1.20k, False: 1.74k]
  ------------------
  251|  1.20k|		outputStr += "Alt";
  252|  1.74k|	} else if ( arrayForm & kXMP_PropArrayIsOrdered ) {
  ------------------
  |  Branch (252:14): [True: 1.53k, False: 204]
  ------------------
  253|  1.53k|		outputStr += "Seq";
  254|  1.53k|	} else {
  255|    204|		outputStr += "Bag";
  256|    204|	}
  257|       |	
  258|  2.95k|	if ( isStartTag && (arraySize == 0) ) outputStr += '/';
  ------------------
  |  Branch (258:7): [True: 1.48k, False: 1.46k]
  |  Branch (258:21): [True: 25, False: 1.46k]
  ------------------
  259|  2.95k|	outputStr += '>';
  260|  2.95k|	outputStr += newline;
  261|       |
  262|  2.95k|}	// EmitRDFArrayTag

_ZN7XMPMetaC2Ev:
  588|  5.53k|XMPMeta::XMPMeta() : clientRefs(0), prevTkVer(0), tree(XMP_Node(0,"",0)), xmlParser(0)
  589|  5.53k|{
  590|       |	// Nothing more to do, clientRefs is incremented in wrapper.
  591|       |	#if XMP_TraceCTorDTor
  592|       |		printf ( "Default construct XMPMeta @ %.8X\n", this );
  593|       |	#endif
  594|  5.53k|}	// XMPMeta
_ZN7XMPMetaD2Ev:
  599|  5.53k|{
  600|       |	#if XMP_TraceCTorDTor
  601|       |		printf ( "Destruct XMPMeta @ %.8X\n", this );
  602|       |	#endif
  603|       |
  604|  5.53k|	XMP_Assert ( this->clientRefs <= 0 );
  ------------------
  |  |  142|  5.53k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  605|  5.53k|	if ( xmlParser != 0 ) delete ( xmlParser );
  ------------------
  |  Branch (605:7): [True: 0, False: 5.53k]
  ------------------
  606|  5.53k|	xmlParser = 0;
  607|       |
  608|  5.53k|}	// ~XMPMeta
_ZN7XMPMeta10InitializeEv:
  644|      1|{
  645|       |	// Allocate and initialize static objects.
  646|       |	
  647|      1|	++sXMP_InitCount;
  648|      1|	if ( sXMP_InitCount > 1 ) return true;
  ------------------
  |  Branch (648:7): [True: 0, False: 1]
  ------------------
  649|       |	
  650|       |	#if TraceXMPCalls
  651|       |		// xmpOut = fopen ( "xmp.out", "w" );	// Coordinate with client glue in WXMP_Common.hpp
  652|       |		fprintf ( xmpOut, "XMP initializing\n" ); fflush ( xmpOut );
  653|       |	#endif
  654|       |	
  655|      1|	sExceptionMessage = new XMP_VarString();
  656|      1|	XMP_InitMutex ( &sXMPCoreLock );
  657|      1|    sOutputNS  = new XMP_VarString;
  658|      1|    sOutputStr = new XMP_VarString;
  659|       |
  660|      1|	xdefaultName = new XMP_VarString ( "x-default" );
  661|       |	
  662|      1|	sNamespaceURIToPrefixMap	= new XMP_StringMap;
  663|      1|	sNamespacePrefixToURIMap	= new XMP_StringMap;
  664|      1|	sRegisteredAliasMap			= new XMP_AliasMap;
  665|       |	
  666|      1|	InitializeUnicodeConversions();
  667|       |	
  668|       |	// Register standard namespaces and aliases.
  669|      1|	RegisterNamespace ( kXMP_NS_XML, "xml" );
  670|      1|	RegisterNamespace ( kXMP_NS_RDF, "rdf" );
  671|      1|	RegisterNamespace ( kXMP_NS_DC, "dc" );
  672|       |
  673|      1|	RegisterNamespace ( kXMP_NS_XMP, "xmp" );
  674|      1|	RegisterNamespace ( kXMP_NS_PDF, "pdf" );
  675|      1|	RegisterNamespace ( kXMP_NS_Photoshop, "photoshop" );
  676|      1|	RegisterNamespace ( kXMP_NS_PSAlbum, "album" );
  677|      1|	RegisterNamespace ( kXMP_NS_EXIF, "exif" );
  678|      1|	RegisterNamespace ( kXMP_NS_EXIF_Aux, "aux" );
  679|      1|	RegisterNamespace ( kXMP_NS_TIFF, "tiff" );
  680|      1|	RegisterNamespace ( kXMP_NS_PNG, "png" );
  681|      1|	RegisterNamespace ( kXMP_NS_JPEG, "jpeg" );
  682|      1|	RegisterNamespace ( kXMP_NS_JP2K, "jp2k" );
  683|      1|	RegisterNamespace ( kXMP_NS_CameraRaw, "crs" );
  684|      1|	RegisterNamespace ( kXMP_NS_ASF, "asf" );
  685|      1|	RegisterNamespace ( kXMP_NS_WAV, "wav" );
  686|       |
  687|      1|	RegisterNamespace ( kXMP_NS_AdobeStockPhoto, "bmsp" );
  688|      1|	RegisterNamespace ( kXMP_NS_CreatorAtom, "creatorAtom" );
  689|       |
  690|      1|	RegisterNamespace ( kXMP_NS_XMP_Rights, "xmpRights" );
  691|      1|	RegisterNamespace ( kXMP_NS_XMP_MM, "xmpMM" );
  692|      1|	RegisterNamespace ( kXMP_NS_XMP_BJ, "xmpBJ" );
  693|      1|	RegisterNamespace ( kXMP_NS_XMP_Note, "xmpNote" );
  694|       |
  695|      1|	RegisterNamespace ( kXMP_NS_DM, "xmpDM" );
  696|      1|	RegisterNamespace ( kXMP_NS_XMP_Text, "xmpT" );
  697|      1|	RegisterNamespace ( kXMP_NS_XMP_PagedFile, "xmpTPg" );
  698|      1|	RegisterNamespace ( kXMP_NS_XMP_Graphics, "xmpG" );
  699|      1|	RegisterNamespace ( kXMP_NS_XMP_Image, "xmpGImg" );
  700|       |
  701|      1|	RegisterNamespace ( kXMP_NS_XMP_Font, "stFnt" );
  702|      1|	RegisterNamespace ( kXMP_NS_XMP_Dimensions, "stDim" );
  703|      1|	RegisterNamespace ( kXMP_NS_XMP_ResourceEvent, "stEvt" );
  704|      1|	RegisterNamespace ( kXMP_NS_XMP_ResourceRef, "stRef" );
  705|      1|	RegisterNamespace ( kXMP_NS_XMP_ST_Version, "stVer" );
  706|      1|	RegisterNamespace ( kXMP_NS_XMP_ST_Job, "stJob" );
  707|      1|	RegisterNamespace ( kXMP_NS_XMP_ManifestItem, "stMfs" );
  708|       |
  709|      1|	RegisterNamespace ( kXMP_NS_XMP_IdentifierQual, "xmpidq" );
  710|       |
  711|      1|	RegisterNamespace ( kXMP_NS_IPTCCore, "Iptc4xmpCore" );
  712|      1|	RegisterNamespace ( kXMP_NS_DICOM, "DICOM" );
  713|       |
  714|      1|	RegisterNamespace ( kXMP_NS_PDFA_Schema, "pdfaSchema" );
  715|      1|	RegisterNamespace ( kXMP_NS_PDFA_Property, "pdfaProperty" );
  716|      1|	RegisterNamespace ( kXMP_NS_PDFA_Type, "pdfaType" );
  717|      1|	RegisterNamespace ( kXMP_NS_PDFA_Field, "pdfaField" );
  718|      1|	RegisterNamespace ( kXMP_NS_PDFA_ID, "pdfaid" );
  719|      1|	RegisterNamespace ( kXMP_NS_PDFA_Extension, "pdfaExtension" );
  720|       |
  721|      1|	RegisterNamespace ( kXMP_NS_PDFX, "pdfx" );
  722|      1|	RegisterNamespace ( kXMP_NS_PDFX_ID, "pdfxid" );
  723|       |	
  724|      1|	RegisterNamespace ( "adobe:ns:meta/", "x" );
  725|      1|	RegisterNamespace ( "http://ns.adobe.com/iX/1.0/", "iX" );
  726|       |
  727|       |// 06-Oct-07, ahu: Do not use aliases. They result in unexpected behaviour.
  728|       |//	XMPMeta::RegisterStandardAliases ( "" );
  729|       |	
  730|       |	// Initialize the other core classes.
  731|       |	
  732|      1|	if ( ! XMPIterator::Initialize() ) XMP_Throw ( "Failure from XMPIterator::Initialize", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (732:7): [True: 0, False: 1]
  ------------------
  733|      1|	if ( ! XMPUtils::Initialize() ) XMP_Throw ( "Failure from XMPUtils::Initialize", kXMPErr_InternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (733:7): [True: 0, False: 1]
  ------------------
  734|       |	// Do miscelaneous semantic checks of types and arithmetic.
  735|       |
  736|      1|	XMP_Assert ( sizeof(XMP_Int8) == 1 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  737|      1|	XMP_Assert ( sizeof(XMP_Int16) == 2 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  738|      1|	XMP_Assert ( sizeof(XMP_Int32) == 4 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  739|      1|	XMP_Assert ( sizeof(XMP_Int64) == 8 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  740|      1|	XMP_Assert ( sizeof(XMP_Uns8) == 1 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  741|      1|	XMP_Assert ( sizeof(XMP_Uns16) == 2 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  742|      1|	XMP_Assert ( sizeof(XMP_Uns32) == 4 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  743|      1|	XMP_Assert ( sizeof(XMP_Uns64) == 8 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  744|       |	
  745|      1|	XMP_Assert ( sizeof(XMP_OptionBits) == 4 );	// Check that option masking work on all 32 bits.
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  746|      1|	XMP_OptionBits flag = ~0;
  747|       |
  748|      1|	XMP_Assert ( flag == (XMP_OptionBits)(-1L) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  749|      1|	XMP_Assert ( (flag ^ kXMP_PropHasLang) == 0xFFFFFFBFUL );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  750|      1|	XMP_Assert ( (flag & ~kXMP_PropHasLang) == 0xFFFFFFBFUL );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  751|       |	
  752|      1|	XMP_OptionBits opt1 = 0;	// Check the general option bit macros.
  753|      1|	XMP_OptionBits opt2 = flag;
  754|      1|	XMP_SetOption ( opt1, kXMP_PropValueIsArray );
  755|      1|	XMP_ClearOption ( opt2, kXMP_PropValueIsArray );
  756|      1|	XMP_Assert ( opt1 == ~opt2 );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  757|      1|	XMP_Assert ( XMP_TestOption ( opt1, kXMP_PropValueIsArray ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  758|      1|	XMP_Assert ( ! XMP_TestOption ( opt2, kXMP_PropValueIsArray ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  759|       |	
  760|      1|	XMP_Assert ( XMP_PropIsSimple ( ~kXMP_PropCompositeMask ) );	// Check the special option bit macros.
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  761|      1|	XMP_Assert ( ! XMP_PropIsSimple ( kXMP_PropValueIsStruct ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  762|      1|	XMP_Assert ( ! XMP_PropIsSimple ( kXMP_PropValueIsArray ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  763|       |
  764|      1|	XMP_Assert ( XMP_PropIsStruct ( kXMP_PropValueIsStruct ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  765|      1|	XMP_Assert ( XMP_PropIsArray  ( kXMP_PropValueIsArray ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  766|      1|	XMP_Assert ( ! XMP_PropIsStruct ( ~kXMP_PropValueIsStruct ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  767|      1|	XMP_Assert ( ! XMP_PropIsArray  ( ~kXMP_PropValueIsArray ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  768|       |	
  769|      1|	XMP_Assert ( XMP_ArrayIsUnordered ( ~kXMP_PropArrayIsOrdered ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  770|      1|	XMP_Assert ( XMP_ArrayIsOrdered   ( kXMP_PropArrayIsOrdered ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  771|      1|	XMP_Assert ( XMP_ArrayIsAlternate ( kXMP_PropArrayIsAlternate ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  772|      1|	XMP_Assert ( XMP_ArrayIsAltText   ( kXMP_PropArrayIsAltText ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  773|      1|	XMP_Assert ( ! XMP_ArrayIsUnordered ( kXMP_PropArrayIsOrdered ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  774|      1|	XMP_Assert ( ! XMP_ArrayIsOrdered   ( ~kXMP_PropArrayIsOrdered ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  775|      1|	XMP_Assert ( ! XMP_ArrayIsAlternate ( ~kXMP_PropArrayIsAlternate ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  776|      1|	XMP_Assert ( ! XMP_ArrayIsAltText   ( ~kXMP_PropArrayIsAltText ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  777|       |	
  778|      1|	XMP_Assert ( XMP_PropHasQualifiers ( kXMP_PropHasQualifiers ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  779|      1|	XMP_Assert ( XMP_PropIsQualifier   ( kXMP_PropIsQualifier ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  780|      1|	XMP_Assert ( XMP_PropHasLang       ( kXMP_PropHasLang ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  781|      1|	XMP_Assert ( ! XMP_PropHasQualifiers ( ~kXMP_PropHasQualifiers ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  782|      1|	XMP_Assert ( ! XMP_PropIsQualifier   ( ~kXMP_PropIsQualifier ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  783|      1|	XMP_Assert ( ! XMP_PropHasLang       ( ~kXMP_PropHasLang ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  784|       |	
  785|      1|	XMP_Assert ( XMP_NodeIsSchema ( kXMP_SchemaNode ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  786|      1|	XMP_Assert ( XMP_PropIsAlias  ( kXMP_PropIsAlias ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  787|      1|	XMP_Assert ( ! XMP_NodeIsSchema ( ~kXMP_SchemaNode ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  788|      1|	XMP_Assert ( ! XMP_PropIsAlias  ( ~kXMP_PropIsAlias ) );
  ------------------
  |  |  142|      1|	#define XMP_Assert(c)	((void) 0)
  ------------------
  789|       |	
  790|       |	#if 0	// Generally off, enable to hand check generated code.
  791|       |		extern XMP_OptionBits opt3, opt4;
  792|       |		if ( XMP_TestOption ( opt3, kXMP_PropValueIsArray ) ) opt4 = opt3;
  793|       |		if ( ! XMP_TestOption ( opt3, kXMP_PropValueIsStruct ) ) opt4 = opt3;
  794|       |		static bool ok1 = XMP_TestOption ( opt4, kXMP_PropValueIsArray );
  795|       |		static bool ok2 = ! XMP_TestOption ( opt4, kXMP_PropValueIsStruct );
  796|       |	#endif
  797|       |	
  798|       |	// Make sure the embedded info strings are referenced and kept.
  799|      1|	if ( (kXMPCore_EmbeddedVersion[0] == 0) || (kXMPCore_EmbeddedCopyright[0] == 0) ) return false;
  ------------------
  |  Branch (799:7): [True: 0, False: 1]
  |  Branch (799:45): [True: 0, False: 1]
  ------------------
  800|      1|	return true;
  801|       |
  802|      1|}	// Initialize
_ZN7XMPMeta9TerminateEv:
  813|      1|{
  814|      1|	--sXMP_InitCount;
  815|      1|	if ( sXMP_InitCount > 0 ) return;
  ------------------
  |  Branch (815:7): [True: 0, False: 1]
  ------------------
  816|       |
  817|       |	#if TraceXMPCalls
  818|       |		fprintf ( xmpOut, "XMP terminating\n" ); fflush ( xmpOut );
  819|       |		// fclose ( xmpOut );	// Coordinate with fopen in XMPMeta::Initialize.
  820|       |	#endif
  821|       |	
  822|      1|	XMPIterator::Terminate();
  823|      1|	XMPUtils::Terminate();
  824|      1|	EliminateGlobal ( sNamespaceURIToPrefixMap );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  825|      1|	EliminateGlobal ( sNamespacePrefixToURIMap );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  826|      1|	EliminateGlobal ( sRegisteredAliasMap );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  827|       |    
  828|      1|    EliminateGlobal ( xdefaultName );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  829|      1|    EliminateGlobal ( sOutputNS );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  830|      1|    EliminateGlobal ( sOutputStr );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  831|      1|	EliminateGlobal ( sExceptionMessage );
  ------------------
  |  |  809|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  832|       |
  833|      1|	XMP_TermMutex ( sXMPCoreLock );
  834|       |	
  835|      1|}	// Terminate
_ZN7XMPMeta6UnlockEj:
  844|   201k|{
  845|   201k|	UNUSED(options);
  846|       |
  847|       |    #if TraceXMPLocking
  848|       |    	fprintf ( xmpOut, "  Unlocking XMP toolkit, count = %d\n", sLockCount ); fflush ( xmpOut );
  849|       |	#endif
  850|   201k|    --sLockCount;
  851|   201k|    XMP_Assert ( sLockCount == 0 );
  ------------------
  |  |  142|   201k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  852|   201k|	XMP_ExitCriticalRegion ( sXMPCoreLock );
  853|       |
  854|   201k|}	// Unlock
_ZNK7XMPMeta12UnlockObjectEj:
  863|  1.69k|{
  864|  1.69k|	UNUSED(options);
  865|       |
  866|  1.69k|	XMPMeta::Unlock ( 0 );
  867|       |
  868|  1.69k|}	// UnlockObject
_ZN7XMPMeta17RegisterNamespaceEPKcS1_:
 1041|  25.7k|{
 1042|  25.7k|	if ( (*namespaceURI == 0) || (*prefix == 0) ) {
  ------------------
  |  Branch (1042:7): [True: 0, False: 25.7k]
  |  Branch (1042:31): [True: 0, False: 25.7k]
  ------------------
 1043|      0|		XMP_Throw ( "Empty namespace URI or prefix", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1044|      0|	}
 1045|       |	
 1046|  25.7k|	XMP_VarString	nsURI ( namespaceURI );
 1047|  25.7k|	XMP_VarString	prfix ( prefix );
 1048|  25.7k|	if ( prfix[prfix.size()-1] != ':' ) prfix += ':';
  ------------------
  |  Branch (1048:7): [True: 25.7k, False: 0]
  ------------------
 1049|  25.7k|	VerifySimpleXMLName ( prefix, prefix+prfix.size()-1 );	// Exclude the colon.
 1050|       |	
 1051|       |        // Set the new namespace in both maps.
 1052|  25.7k|        (*sNamespaceURIToPrefixMap)[nsURI] = prfix;
 1053|  25.7k|        (*sNamespacePrefixToURIMap)[prfix] = nsURI;
 1054|       |	
 1055|  25.7k|}	// RegisterNamespace
_ZN7XMPMeta18GetNamespacePrefixEPKcPS1_Pj:
 1066|   208k|{
 1067|   208k|	bool	found	= false;
 1068|       |	
 1069|   208k|	XMP_Assert ( *namespaceURI != 0 ); 	// ! Enforced by wrapper.
  ------------------
  |  |  142|   208k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1070|   208k|	XMP_Assert ( (namespacePrefix != 0) && (prefixSize != 0) );	// ! Enforced by wrapper.
  ------------------
  |  |  142|   208k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1071|       |
 1072|   208k|	XMP_VarString    nsURI ( namespaceURI );
 1073|   208k|	XMP_StringMapPos uriPos	= sNamespaceURIToPrefixMap->find ( nsURI );
 1074|       |	
 1075|   208k|	if ( uriPos != sNamespaceURIToPrefixMap->end() ) {
  ------------------
  |  Branch (1075:7): [True: 208k, False: 7]
  ------------------
 1076|   208k|		*namespacePrefix = uriPos->second.c_str();
 1077|   208k|		*prefixSize = uriPos->second.size();
 1078|   208k|		found = true;
 1079|   208k|	}
 1080|       |	
 1081|   208k|	return found;
 1082|       |	
 1083|   208k|}	// GetNamespacePrefix
_ZN7XMPMeta15DeleteNamespaceEPKc:
 1126|    326|{
 1127|    326|	XMP_StringMapPos uriPos = sNamespaceURIToPrefixMap->find ( namespaceURI );
 1128|    326|	if ( uriPos == sNamespaceURIToPrefixMap->end() ) return;
  ------------------
  |  Branch (1128:7): [True: 7, False: 319]
  ------------------
 1129|       |
 1130|    319|	XMP_StringMapPos prefixPos = sNamespacePrefixToURIMap->find ( uriPos->second );
 1131|    319|	if ( prefixPos == sNamespacePrefixToURIMap->end() ) return;
  ------------------
  |  Branch (1131:7): [True: 1, False: 318]
  ------------------
 1132|       |	
 1133|    318|	sNamespaceURIToPrefixMap->erase ( uriPos );
 1134|    318|	sNamespacePrefixToURIMap->erase ( prefixPos );
 1135|       |
 1136|    318|}	// DeleteNamespace
_ZNK7XMPMeta15CountArrayItemsEPKcS1_:
 1510|  2.05k|{
 1511|  2.05k|	XMP_Assert ( (schemaNS != 0) && (arrayName != 0) );	// Enforced by wrapper.
  ------------------
  |  |  142|  2.05k|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1512|       |
 1513|  2.05k|	XMP_ExpandedXPath	expPath;
 1514|  2.05k|	ExpandXPath ( schemaNS, arrayName, &expPath );
 1515|       |	
 1516|  2.05k|	const XMP_Node * arrayNode = FindConstNode ( &tree, expPath );
  ------------------
  |  |  301|  2.05k|#define FindConstNode(t,p)		FindNode ( const_cast<XMP_Node*>(t), p, kXMP_ExistingOnly, 0 )
  |  |  ------------------
  |  |  |  |  296|  2.05k|#define kXMP_ExistingOnly	false
  |  |  ------------------
  ------------------
 1517|       |
 1518|  2.05k|	if ( arrayNode == 0 ) return 0;
  ------------------
  |  Branch (1518:7): [True: 0, False: 2.05k]
  ------------------
 1519|  2.05k|	if ( ! (arrayNode->options & kXMP_PropValueIsArray) ) XMP_Throw ( "The named property is not an array", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1519:7): [True: 0, False: 2.05k]
  ------------------
 1520|  2.05k|	return arrayNode->children.size();
 1521|       |	
 1522|  2.05k|}	// CountArrayItems

_ZN8XMPUtils10InitializeEv:
  640|      1|{
  641|      1|	sComposedPath	= new XMP_VarString();
  642|      1|	sConvertedValue = new XMP_VarString();
  643|      1|	sBase64Str		= new XMP_VarString();
  644|      1|	sCatenatedItems = new XMP_VarString();
  645|      1|	sStandardXMP    = new XMP_VarString();
  646|      1|	sExtendedXMP    = new XMP_VarString();
  647|      1|	sExtendedDigest = new XMP_VarString();
  648|       |
  649|       |	#if XMP_MacBuild && __MWERKS__
  650|       |		LookupTimeProcs();
  651|       |	#endif
  652|       |
  653|      1|	return true;
  654|       |
  655|      1|}	// Initialize
_ZN8XMPUtils9TerminateEv:
  666|      1|{
  667|      1|	EliminateGlobal ( sComposedPath );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  668|      1|	EliminateGlobal ( sConvertedValue );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  669|      1|	EliminateGlobal ( sBase64Str );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  670|      1|	EliminateGlobal ( sCatenatedItems );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  671|      1|	EliminateGlobal ( sStandardXMP );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  672|      1|	EliminateGlobal ( sExtendedXMP );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  673|      1|	EliminateGlobal ( sExtendedDigest );
  ------------------
  |  |  662|      1|#define EliminateGlobal(g) delete ( g ); g = 0
  ------------------
  674|       |
  675|      1|	return;
  676|       |
  677|      1|}	// Terminate
_ZN8XMPUtils20ComposeQualifierPathEPKcS1_S1_S1_PS1_Pj:
  790|  2.33k|{
  791|  2.33k|	XMP_Assert ( (schemaNS != 0) && (qualNS != 0) );		// Enforced by wrapper.
  ------------------
  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  792|  2.33k|	XMP_Assert ( (*propName != 0) && (*qualName != 0) );	// Enforced by wrapper.
  ------------------
  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  793|  2.33k|	XMP_Assert ( (fullPath != 0) && (pathSize != 0) );		// Enforced by wrapper.
  ------------------
  |  |  142|  2.33k|	#define XMP_Assert(c)	((void) 0)
  ------------------
  794|       |
  795|  2.33k|	XMP_ExpandedXPath expPath;	// Just for side effects to check namespace and basic path.
  796|  2.33k|	ExpandXPath ( schemaNS, propName, &expPath );
  797|       |
  798|  2.33k|	XMP_ExpandedXPath qualPath;
  799|  2.33k|	ExpandXPath ( qualNS, qualName, &qualPath );
  800|  2.33k|	if ( qualPath.size() != 2 ) XMP_Throw ( "The qualifier name must be simple", kXMPErr_BadXPath );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (800:7): [True: 0, False: 2.33k]
  ------------------
  801|       |
  802|  2.33k|	XMP_StringLen reserveLen = strlen(propName) + qualPath[kRootPropStep].step.size() + 2;
  803|       |
  804|  2.33k|	sComposedPath->erase();
  805|  2.33k|	sComposedPath->reserve ( reserveLen );
  806|  2.33k|	*sComposedPath = propName;
  807|  2.33k|	*sComposedPath += "/?";
  808|  2.33k|	*sComposedPath += qualPath[kRootPropStep].step;
  809|       |
  810|  2.33k|	*fullPath = sComposedPath->c_str();
  811|  2.33k|	*pathSize = sComposedPath->size();
  812|       |
  813|  2.33k|}	// ComposeQualifierPath
_ZN8XMPUtils13ConvertToDateEPKcP12XMP_DateTime:
 1293|    290|{
 1294|    290|	if ( (strValue == 0) || (*strValue == 0) ) XMP_Throw ( "Empty convert-from string", kXMPErr_BadValue);
  ------------------
  |  |  199|      1|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1294:7): [True: 0, False: 290]
  |  Branch (1294:26): [True: 1, False: 289]
  ------------------
 1295|       |
 1296|    289|	size_t	 pos = 0;
 1297|    289|	XMP_Int32 temp;
 1298|       |
 1299|    289|	XMP_Assert ( sizeof(*binValue) == sizeof(XMP_DateTime) );
  ------------------
  |  |  142|    289|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1300|    289|	(void) memset ( binValue, 0, sizeof(*binValue) );	// AUDIT: Safe, using sizeof destination.
 1301|       |
 1302|    289|	bool timeOnly = ( (strValue[0] == 'T') ||
  ------------------
  |  Branch (1302:20): [True: 104, False: 185]
  ------------------
 1303|    185|					  ((strlen(strValue) >= 2) && (strValue[1] == ':')) ||
  ------------------
  |  Branch (1303:9): [True: 179, False: 6]
  |  Branch (1303:36): [True: 30, False: 149]
  ------------------
 1304|    155|					  ((strlen(strValue) >= 3) && (strValue[2] == ':')) );
  ------------------
  |  Branch (1304:9): [True: 144, False: 11]
  |  Branch (1304:36): [True: 10, False: 134]
  ------------------
 1305|       |
 1306|    289|	if ( ! timeOnly ) {
  ------------------
  |  Branch (1306:7): [True: 145, False: 144]
  ------------------
 1307|       |
 1308|    145|		if ( strValue[0] == '-' ) pos = 1;
  ------------------
  |  Branch (1308:8): [True: 90, False: 55]
  ------------------
 1309|       |
 1310|    145|		temp = GatherInt ( strValue, &pos, "Invalid year in date string" ); // Extract the year.
 1311|    145|		if ( (strValue[pos] != 0) && (strValue[pos] != '-') ) XMP_Throw ( "Invalid date string, after year", kXMPErr_BadParam );
  ------------------
  |  |  199|     17|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1311:8): [True: 79, False: 66]
  |  Branch (1311:32): [True: 17, False: 62]
  ------------------
 1312|    128|		if ( strValue[0] == '-' ) temp = -temp;
  ------------------
  |  Branch (1312:8): [True: 71, False: 57]
  ------------------
 1313|    128|		binValue->year = temp;
 1314|    128|		if ( strValue[pos] == 0 ) return;
  ------------------
  |  Branch (1314:8): [True: 47, False: 81]
  ------------------
 1315|       |
 1316|     81|		++pos;
 1317|     81|		temp = GatherInt ( strValue, &pos, "Invalid month in date string" );	// Extract the month.
 1318|     81|		if ( (temp < 1) || (temp > 12) ) XMP_Throw ( "Month is out of range", kXMPErr_BadParam );
  ------------------
  |  |  199|     13|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1318:8): [True: 31, False: 50]
  |  Branch (1318:22): [True: 11, False: 39]
  ------------------
 1319|     68|		if ( (strValue[pos] != 0) && (strValue[pos] != '-') ) XMP_Throw ( "Invalid date string, after month", kXMPErr_BadParam );
  ------------------
  |  |  199|      1|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1319:8): [True: 25, False: 43]
  |  Branch (1319:32): [True: 1, False: 24]
  ------------------
 1320|     67|		binValue->month = temp;
 1321|     67|		if ( strValue[pos] == 0 ) return;
  ------------------
  |  Branch (1321:8): [True: 14, False: 53]
  ------------------
 1322|       |
 1323|     53|		++pos;
 1324|     53|		temp = GatherInt ( strValue, &pos, "Invalid day in date string" );	// Extract the day.
 1325|     53|		if ( (temp < 1) || (temp > 31) ) XMP_Throw ( "Day is out of range", kXMPErr_BadParam );
  ------------------
  |  |  199|     12|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1325:8): [True: 40, False: 13]
  |  Branch (1325:22): [True: 6, False: 7]
  ------------------
 1326|     41|		if ( (strValue[pos] != 0) && (strValue[pos] != 'T') ) XMP_Throw ( "Invalid date string, after day", kXMPErr_BadParam );
  ------------------
  |  |  199|      2|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1326:8): [True: 2, False: 39]
  |  Branch (1326:32): [True: 2, False: 0]
  ------------------
 1327|     39|		binValue->day = temp;
 1328|     39|		if ( strValue[pos] == 0 ) return;
  ------------------
  |  Branch (1328:8): [True: 5, False: 34]
  ------------------
 1329|       |
 1330|       |		// Allow year, month, and day to all be zero; implies the date portion is missing.
 1331|     34|		if ( (binValue->year != 0) || (binValue->month != 0) || (binValue->day != 0) ) {
  ------------------
  |  Branch (1331:8): [True: 34, False: 0]
  |  Branch (1331:33): [True: 0, False: 0]
  |  Branch (1331:59): [True: 0, False: 0]
  ------------------
 1332|       |			// Temporary fix for bug 1269463, silently fix out of range month or day.
 1333|       |			// if ( (binValue->month < 1) || (binValue->month > 12) ) XMP_Throw ( "Month is out of range", kXMPErr_BadParam );
 1334|       |			// if ( (binValue->day < 1) || (binValue->day > 31) ) XMP_Throw ( "Day is out of range", kXMPErr_BadParam );
 1335|      0|			if ( binValue->month < 1 ) binValue->month = 1;
  ------------------
  |  Branch (1335:9): [True: 0, False: 0]
  ------------------
 1336|      0|			if ( binValue->month > 12 ) binValue->month = 12;
  ------------------
  |  Branch (1336:9): [True: 0, False: 0]
  ------------------
 1337|      0|			if ( binValue->day < 1 ) binValue->day = 1;
  ------------------
  |  Branch (1337:9): [True: 0, False: 0]
  ------------------
 1338|      0|			if ( binValue->day > 31 ) binValue->day = 31;
  ------------------
  |  Branch (1338:9): [True: 0, False: 0]
  ------------------
 1339|      0|		}
 1340|       |
 1341|     34|	}
 1342|       |
 1343|    178|	if ( strValue[pos] == 'T' ) {
  ------------------
  |  Branch (1343:7): [True: 104, False: 74]
  ------------------
 1344|    104|		++pos;
 1345|    104|	} else if ( ! timeOnly ) {
  ------------------
  |  Branch (1345:14): [True: 0, False: 74]
  ------------------
 1346|      0|		XMP_Throw ( "Invalid date string, missing 'T' after date", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1347|      0|	}
 1348|       |
 1349|    178|	temp = GatherInt ( strValue, &pos, "Invalid hour in date string" ); // Extract the hour.
 1350|    178|	if ( strValue[pos] != ':' ) XMP_Throw ( "Invalid date string, after hour", kXMPErr_BadParam );
  ------------------
  |  |  199|      8|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1350:7): [True: 8, False: 170]
  ------------------
 1351|    170|	if ( temp < 0 || temp > 23 ) temp = 23;	// *** 1269463: XMP_Throw ( "Hour is out of range", kXMPErr_BadParam );
  ------------------
  |  Branch (1351:7): [True: 47, False: 123]
  |  Branch (1351:19): [True: 43, False: 80]
  ------------------
 1352|    170|	binValue->hour = temp;
 1353|       |	// Don't check for done, we have to work up to the time zone.
 1354|       |
 1355|    170|	++pos;
 1356|    170|	temp = GatherInt ( strValue, &pos, "Invalid minute in date string" );	// And the minute.
 1357|    170|	if ( (strValue[pos] != ':') && (strValue[pos] != 'Z') &&
  ------------------
  |  Branch (1357:7): [True: 48, False: 122]
  |  Branch (1357:33): [True: 47, False: 1]
  ------------------
 1358|    164|		 (strValue[pos] != '+') && (strValue[pos] != '-') && (strValue[pos] != 0) ) XMP_Throw ( "Invalid date string, after minute", kXMPErr_BadParam );
  ------------------
  |  |  199|      6|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1358:4): [True: 29, False: 18]
  |  Branch (1358:30): [True: 19, False: 10]
  |  Branch (1358:56): [True: 6, False: 13]
  ------------------
 1359|    164|	if ( temp < 0 || temp > 59 ) temp = 59;	// *** 1269463: XMP_Throw ( "Minute is out of range", kXMPErr_BadParam );
  ------------------
  |  Branch (1359:7): [True: 63, False: 101]
  |  Branch (1359:19): [True: 44, False: 57]
  ------------------
 1360|    164|	binValue->minute = temp;
 1361|       |	// Don't check for done, we have to work up to the time zone.
 1362|       |
 1363|    164|	if ( strValue[pos] == ':' ) {
  ------------------
  |  Branch (1363:7): [True: 59, False: 105]
  ------------------
 1364|       |
 1365|     59|		++pos;
 1366|     59|		temp = GatherInt ( strValue, &pos, "Invalid whole seconds in date string" );	// Extract the whole seconds.
 1367|     59|		if ( (strValue[pos] != '.') && (strValue[pos] != 'Z') &&
  ------------------
  |  Branch (1367:8): [True: 23, False: 36]
  |  Branch (1367:34): [True: 22, False: 1]
  ------------------
 1368|     22|			 (strValue[pos] != '+') && (strValue[pos] != '-') && (strValue[pos] != 0) ) {
  ------------------
  |  Branch (1368:5): [True: 15, False: 7]
  |  Branch (1368:31): [True: 12, False: 3]
  |  Branch (1368:57): [True: 2, False: 10]
  ------------------
 1369|      2|			XMP_Throw ( "Invalid date string, after whole seconds", kXMPErr_BadParam );
  ------------------
  |  |  199|      2|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1370|      0|		}
 1371|     57|		if ( temp < 0 || temp > 59 ) temp = 59;	// *** 1269463: XMP_Throw ( "Whole second is out of range", kXMPErr_BadParam );
  ------------------
  |  Branch (1371:8): [True: 2, False: 55]
  |  Branch (1371:20): [True: 25, False: 30]
  ------------------
 1372|     57|		binValue->second = temp;
 1373|       |		// Don't check for done, we have to work up to the time zone.
 1374|       |
 1375|     57|		if ( strValue[pos] == '.' ) {
  ------------------
  |  Branch (1375:8): [True: 34, False: 23]
  ------------------
 1376|       |
 1377|     34|			++pos;
 1378|     34|			size_t digits = pos;	// Will be the number of digits later.
 1379|       |
 1380|     34|			temp = GatherInt ( strValue, &pos, "Invalid fractional seconds in date string" );	// Extract the fractional seconds.
 1381|     34|			if ( (strValue[pos] != 'Z') && (strValue[pos] != '+') && (strValue[pos] != '-') && (strValue[pos] != 0) ) {
  ------------------
  |  Branch (1381:9): [True: 22, False: 12]
  |  Branch (1381:35): [True: 22, False: 0]
  |  Branch (1381:61): [True: 18, False: 4]
  |  Branch (1381:87): [True: 6, False: 12]
  ------------------
 1382|      6|				XMP_Throw ( "Invalid date string, after fractional second", kXMPErr_BadParam );
  ------------------
  |  |  199|      6|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1383|      0|			}
 1384|       |
 1385|     28|			digits = pos - digits;
 1386|    278|			for ( ; digits > 9; --digits ) temp = temp / 10;
  ------------------
  |  Branch (1386:12): [True: 250, False: 28]
  ------------------
 1387|     68|			for ( ; digits < 9; ++digits ) temp = temp * 10;
  ------------------
  |  Branch (1387:12): [True: 40, False: 28]
  ------------------
 1388|       |
 1389|     28|			if ( temp < 0 || temp >= 1000*1000*1000 ) XMP_Throw ( "Fractional second is out of range", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1389:9): [True: 10, False: 18]
  |  Branch (1389:21): [True: 0, False: 18]
  ------------------
 1390|     28|			binValue->nanoSecond = temp;
 1391|       |			// Don't check for done, we have to work up to the time zone.
 1392|       |
 1393|     28|		}
 1394|       |
 1395|     57|	}
 1396|       |
 1397|    156|	if ( strValue[pos] == 'Z' ) {
  ------------------
  |  Branch (1397:7): [True: 4, False: 152]
  ------------------
 1398|       |
 1399|      4|		++pos;
 1400|       |
 1401|    152|	} else if ( strValue[pos] != 0 ) {
  ------------------
  |  Branch (1401:14): [True: 42, False: 110]
  ------------------
 1402|       |
 1403|     42|		if ( strValue[pos] == '+' ) {
  ------------------
  |  Branch (1403:8): [True: 25, False: 17]
  ------------------
 1404|     25|			binValue->tzSign = kXMP_TimeEastOfUTC;
 1405|     25|		} else if ( strValue[pos] == '-' ) {
  ------------------
  |  Branch (1405:15): [True: 17, False: 0]
  ------------------
 1406|     17|			binValue->tzSign = kXMP_TimeWestOfUTC;
 1407|     17|		} else {
 1408|      0|			XMP_Throw ( "Time zone must begin with 'Z', '+', or '-'", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1409|      0|		}
 1410|       |
 1411|     42|		++pos;
 1412|     42|		temp = GatherInt ( strValue, &pos, "Invalid time zone hour in date string" );	// Extract the time zone hour.
 1413|     42|		if ( strValue[pos] != ':' ) XMP_Throw ( "Invalid date string, after time zone hour", kXMPErr_BadParam );
  ------------------
  |  |  199|     10|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1413:8): [True: 10, False: 32]
  ------------------
 1414|     32|		if ( temp < 0 || temp > 23 ) XMP_Throw ( "Time zone hour is out of range", kXMPErr_BadParam );
  ------------------
  |  |  199|      5|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1414:8): [True: 10, False: 22]
  |  Branch (1414:20): [True: 5, False: 17]
  ------------------
 1415|     27|		binValue->tzHour = temp;
 1416|       |
 1417|     27|		++pos;
 1418|     27|		temp = GatherInt ( strValue, &pos, "Invalid time zone minute in date string" ); // Extract the time zone minute.
 1419|     27|		if ( temp < 0 || temp > 59 ) XMP_Throw ( "Time zone minute is out of range", kXMPErr_BadParam );
  ------------------
  |  |  199|      5|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1419:8): [True: 14, False: 13]
  |  Branch (1419:20): [True: 5, False: 8]
  ------------------
 1420|     22|		binValue->tzMinute = temp;
 1421|       |
 1422|    110|	} else {
 1423|       |
 1424|    110|		XMPUtils::SetTimeZone( binValue );
 1425|       |
 1426|    110|	}
 1427|       |
 1428|    136|	if ( strValue[pos] != 0 ) XMP_Throw ( "Invalid date string, extra chars at end", kXMPErr_BadParam );
  ------------------
  |  |  199|      6|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1428:7): [True: 6, False: 130]
  ------------------
 1429|       |
 1430|    130|}	// ConvertToDate
_ZN8XMPUtils11SetTimeZoneEP12XMP_DateTime:
 1946|    142|{
 1947|    142|	XMP_Assert ( xmpTime != 0 );	// ! Enforced by wrapper.
  ------------------
  |  |  142|    142|	#define XMP_Assert(c)	((void) 0)
  ------------------
 1948|       |
 1949|    142|	if ( (xmpTime->tzSign != 0) || (xmpTime->tzHour != 0) || (xmpTime->tzMinute != 0) ) {
  ------------------
  |  Branch (1949:7): [True: 0, False: 142]
  |  Branch (1949:33): [True: 0, False: 142]
  |  Branch (1949:59): [True: 0, False: 142]
  ------------------
 1950|      0|		XMP_Throw ( "SetTimeZone can only be used on \"zoneless\" times", kXMPErr_BadParam );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1951|      0|	}
 1952|       |
 1953|       |	// Create ansi_tt form of the input time. Need the ansi_tm form to make the ansi_tt form.
 1954|       |
 1955|    142|	ansi_tt ttTime;
 1956|    142|	ansi_tm tmLocal, tmUTC;
 1957|       |
 1958|    142|	if ( (xmpTime->year == 0) && (xmpTime->month == 0) && (xmpTime->day == 0) ) {
  ------------------
  |  Branch (1958:7): [True: 79, False: 63]
  |  Branch (1958:31): [True: 76, False: 3]
  |  Branch (1958:56): [True: 76, False: 0]
  ------------------
 1959|     76|		ansi_tt now = ansi_time(0);
  ------------------
  |  |   69|     76|	#define ansi_time		time
  ------------------
 1960|     76|		if ( now == -1 ) XMP_Throw ( "Failure from ANSI C time function", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1960:8): [True: 0, False: 76]
  ------------------
 1961|     76|		ansi_localtime ( &now, &tmLocal );
  ------------------
  |  |   74|     76|	#define ansi_localtime	localtime_r
  ------------------
 1962|     76|	} else {
 1963|     66|		if (xmpTime->year < std::numeric_limits<decltype(tmLocal.tm_year)>::min() + 1900) {
  ------------------
  |  Branch (1963:7): [True: 4, False: 62]
  ------------------
 1964|      4|			XMP_Throw ( "Invalid year", kXMPErr_BadParam);
  ------------------
  |  |  199|      4|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1965|     62|		} else if (xmpTime->year > std::numeric_limits<decltype(tmLocal.tm_year)>::max()) {
  ------------------
  |  Branch (1965:14): [True: 0, False: 62]
  ------------------
 1966|      0|			XMP_Throw ( "Invalid year", kXMPErr_BadParam);
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
 1967|     62|		} else {
 1968|     62|			tmLocal.tm_year = xmpTime->year - 1900;
 1969|     62|		}
 1970|     62|		tmLocal.tm_mon	 = xmpTime->month - 1;
 1971|     62|		tmLocal.tm_mday	 = xmpTime->day;
 1972|     62|	}
 1973|       |
 1974|    138|	tmLocal.tm_hour = xmpTime->hour;
 1975|    138|	tmLocal.tm_min = xmpTime->minute;
 1976|    138|	tmLocal.tm_sec = xmpTime->second;
 1977|    138|	tmLocal.tm_isdst = -1;	// Don't know if daylight time is in effect.
 1978|       |
 1979|    138|	ttTime = ansi_mktime ( &tmLocal );
  ------------------
  |  |   70|    138|	#define ansi_mktime		mktime
  ------------------
 1980|    138|	if ( ttTime == -1 ) XMP_Throw ( "Failure from ANSI C mktime function", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (1980:7): [True: 0, False: 138]
  ------------------
 1981|       |
 1982|       |	// Convert back to a localized ansi_tm time and get the corresponding UTC ansi_tm time.
 1983|       |
 1984|    138|	ansi_localtime ( &ttTime, &tmLocal );
  ------------------
  |  |   74|    138|	#define ansi_localtime	localtime_r
  ------------------
 1985|    138|	ansi_gmtime ( &ttTime, &tmUTC );
  ------------------
  |  |   73|    138|	#define ansi_gmtime		gmtime_r
  ------------------
 1986|       |
 1987|       |	// Get the offset direction and amount.
 1988|       |
 1989|    138|	ansi_tm tmx = tmLocal;	// ! Note that mktime updates the ansi_tm parameter, messing up difftime!
 1990|    138|	ansi_tm tmy = tmUTC;
 1991|    138|	tmx.tm_isdst = tmy.tm_isdst = 0;
 1992|    138|	ansi_tt ttx = ansi_mktime ( &tmx );
  ------------------
  |  |   70|    138|	#define ansi_mktime		mktime
  ------------------
 1993|    138|	ansi_tt tty = ansi_mktime ( &tmy );
  ------------------
  |  |   70|    138|	#define ansi_mktime		mktime
  ------------------
 1994|    138|	double diffSecs;
 1995|       |
 1996|    138|	if ( (ttx != -1) && (tty != -1) ) {
  ------------------
  |  Branch (1996:7): [True: 138, False: 0]
  |  Branch (1996:22): [True: 138, False: 0]
  ------------------
 1997|    138|		diffSecs = ansi_difftime ( ttx, tty );
  ------------------
  |  |   71|    138|	#define ansi_difftime	difftime
  ------------------
 1998|    138|	} else {
 1999|       |		#if XMP_MacBuild
 2000|       |			// Looks like Apple's mktime is buggy - see W1140533. But the offset is visible.
 2001|       |			diffSecs = tmLocal.tm_gmtoff;
 2002|       |		#else
 2003|       |			// Win and UNIX don't have a visible offset. Make sure we know about the failure,
 2004|       |			// then try using the current date/time as a close fallback.
 2005|      0|			ttTime = ansi_time(0);
  ------------------
  |  |   69|      0|	#define ansi_time		time
  ------------------
 2006|      0|			if ( ttTime == -1 ) XMP_Throw ( "Failure from ANSI C time function", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (2006:9): [True: 0, False: 0]
  ------------------
 2007|      0|			ansi_localtime ( &ttTime, &tmx );
  ------------------
  |  |   74|      0|	#define ansi_localtime	localtime_r
  ------------------
 2008|      0|			ansi_gmtime ( &ttTime, &tmy );
  ------------------
  |  |   73|      0|	#define ansi_gmtime		gmtime_r
  ------------------
 2009|      0|			tmx.tm_isdst = tmy.tm_isdst = 0;
 2010|      0|			ttx = ansi_mktime ( &tmx );
  ------------------
  |  |   70|      0|	#define ansi_mktime		mktime
  ------------------
 2011|      0|			tty = ansi_mktime ( &tmy );
  ------------------
  |  |   70|      0|	#define ansi_mktime		mktime
  ------------------
 2012|      0|			if ( (ttx == -1) || (tty == -1) ) XMP_Throw ( "Failure from ANSI C mktime function", kXMPErr_ExternalFailure );
  ------------------
  |  |  199|      0|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (2012:9): [True: 0, False: 0]
  |  Branch (2012:24): [True: 0, False: 0]
  ------------------
 2013|      0|			diffSecs = ansi_difftime ( ttx, tty );
  ------------------
  |  |   71|      0|	#define ansi_difftime	difftime
  ------------------
 2014|      0|		#endif
 2015|      0|	}
 2016|       |
 2017|    138|	if ( diffSecs > 0.0 ) {
  ------------------
  |  Branch (2017:7): [True: 0, False: 138]
  ------------------
 2018|      0|		xmpTime->tzSign = kXMP_TimeEastOfUTC;
 2019|    138|	} else if ( diffSecs == 0.0 ) {
  ------------------
  |  Branch (2019:14): [True: 138, False: 0]
  ------------------
 2020|    138|		xmpTime->tzSign = kXMP_TimeIsUTC;
 2021|    138|	} else {
 2022|      0|		xmpTime->tzSign = kXMP_TimeWestOfUTC;
 2023|      0|		diffSecs = -diffSecs;
 2024|      0|	}
 2025|    138|	xmpTime->tzHour = XMP_Int32 ( diffSecs / 3600.0 );
 2026|    138|	xmpTime->tzMinute = XMP_Int32 ( (diffSecs / 60.0) - (xmpTime->tzHour * 60.0) );
 2027|       |
 2028|       |	// *** Save the tm_isdst flag in a qualifier?
 2029|       |
 2030|    138|	XMP_Assert ( (0 <= xmpTime->tzHour) && (xmpTime->tzHour <= 23) );
  ------------------
  |  |  142|    138|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2031|    138|	XMP_Assert ( (0 <= xmpTime->tzMinute) && (xmpTime->tzMinute <= 59) );
  ------------------
  |  |  142|    138|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2032|    138|	XMP_Assert ( (-1 <= xmpTime->tzSign) && (xmpTime->tzSign <= +1) );
  ------------------
  |  |  142|    138|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2033|    138|	XMP_Assert ( (xmpTime->tzSign == 0) ? ((xmpTime->tzHour == 0) && (xmpTime->tzMinute == 0)) :
  ------------------
  |  |  142|    138|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2034|    138|										  ((xmpTime->tzHour != 0) || (xmpTime->tzMinute != 0)) );
 2035|       |
 2036|    138|}	// SetTimeZone
_ZN8XMPUtils16ConvertToUTCTimeEP12XMP_DateTime:
 2045|    107|{
 2046|    107|	XMP_Assert ( time != 0 );	// ! Enforced by wrapper.
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2047|       |
 2048|    107|	XMP_Assert ( (0 <= time->tzHour) && (time->tzHour <= 23) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2049|    107|	XMP_Assert ( (0 <= time->tzMinute) && (time->tzMinute <= 59) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2050|    107|	XMP_Assert ( (-1 <= time->tzSign) && (time->tzSign <= +1) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2051|    107|	XMP_Assert ( (time->tzSign == 0) ? ((time->tzHour == 0) && (time->tzMinute == 0)) :
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2052|    107|									   ((time->tzHour != 0) || (time->tzMinute != 0)) );
 2053|       |
 2054|    107|	if ( time->tzSign == kXMP_TimeEastOfUTC ) {
  ------------------
  |  Branch (2054:7): [True: 5, False: 102]
  ------------------
 2055|       |		// We are before (east of) GMT, subtract the offset from the time.
 2056|      5|		time->hour -= time->tzHour;
 2057|      5|		time->minute -= time->tzMinute;
 2058|    102|	} else if ( time->tzSign == kXMP_TimeWestOfUTC ) {
  ------------------
  |  Branch (2058:14): [True: 1, False: 101]
  ------------------
 2059|       |		// We are behind (west of) GMT, add the offset to the time.
 2060|      1|		time->hour += time->tzHour;
 2061|      1|		time->minute += time->tzMinute;
 2062|      1|	}
 2063|       |
 2064|    107|	AdjustTimeOverflow ( time );
 2065|    107|	time->tzSign = time->tzHour = time->tzMinute = 0;
 2066|       |
 2067|    107|}	// ConvertToUTCTime
_ZN8XMPUtils18ConvertToLocalTimeEP12XMP_DateTime:
 2076|    107|{
 2077|    107|	XMP_Assert ( time != 0 );	// ! Enforced by wrapper.
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2078|       |
 2079|    107|	XMP_Assert ( (0 <= time->tzHour) && (time->tzHour <= 23) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2080|    107|	XMP_Assert ( (0 <= time->tzMinute) && (time->tzMinute <= 59) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2081|    107|	XMP_Assert ( (-1 <= time->tzSign) && (time->tzSign <= +1) );
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2082|    107|	XMP_Assert ( (time->tzSign == 0) ? ((time->tzHour == 0) && (time->tzMinute == 0)) :
  ------------------
  |  |  142|    107|	#define XMP_Assert(c)	((void) 0)
  ------------------
 2083|    107|									   ((time->tzHour != 0) || (time->tzMinute != 0)) );
 2084|       |
 2085|    107|	ConvertToUTCTime ( time );	// The existing time zone might not be the local one.
 2086|    107|	SetTimeZone ( time );		// Fill in the local timezone offset, then adjust the time.
 2087|       |
 2088|    107|	if ( time->tzSign > 0 ) {
  ------------------
  |  Branch (2088:7): [True: 0, False: 107]
  ------------------
 2089|       |		// We are before (east of) GMT, add the offset to the time.
 2090|      0|		time->hour += time->tzHour;
 2091|      0|		time->minute += time->tzMinute;
 2092|    107|	} else if ( time->tzSign < 0 ) {
  ------------------
  |  Branch (2092:14): [True: 0, False: 107]
  ------------------
 2093|       |		// We are behind (west of) GMT, subtract the offset from the time.
 2094|      0|		time->hour -= time->tzHour;
 2095|      0|		time->minute -= time->tzMinute;
 2096|      0|	}
 2097|       |
 2098|    107|	AdjustTimeOverflow ( time );
 2099|       |
 2100|    107|}	// ConvertToLocalTime
XMPUtils.cpp:_ZL9GatherIntPKcPmS0_:
  368|    650|{
  369|    650|	size_t	 pos   = *_pos;
  370|    650|	XMP_Int32 value = 0;
  371|       |
  372|       |	// Limits for overflow checking. Assuming that the maximum value of XMP_Int32
  373|       |	// is 2147483647, then tens_upperbound == 214748364 and ones_upperbound == 7.
  374|       |	// Most of the time, we can just check that value < tens_upperbound to confirm
  375|       |	// that the calculation won't overflow, which makes the bounds checking more
  376|       |	// efficient for the common case.
  377|    650|	const XMP_Int32 tens_upperbound = std::numeric_limits<XMP_Int32>::max() / 10;
  378|    650|	const XMP_Int32 ones_upperbound = std::numeric_limits<XMP_Int32>::max() % 10;
  379|       |
  380|  84.2k|	for ( char ch = strValue[pos]; ('0' <= ch) && (ch <= '9'); ++pos, ch = strValue[pos] ) {
  ------------------
  |  Branch (380:33): [True: 83.9k, False: 314]
  |  Branch (380:48): [True: 83.6k, False: 291]
  ------------------
  381|  83.6k|		const XMP_Int32 digit = ch - '0';
  382|  83.6k|		if (value >= tens_upperbound) {
  ------------------
  |  Branch (382:7): [True: 54, False: 83.5k]
  ------------------
  383|     54|			if (value > tens_upperbound || digit > ones_upperbound) {
  ------------------
  |  Branch (383:8): [True: 35, False: 19]
  |  Branch (383:35): [True: 10, False: 9]
  ------------------
  384|     45|				XMP_Throw ( errMsg, kXMPErr_BadParam );
  ------------------
  |  |  199|     45|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  385|      0|			}
  386|     54|		}
  387|  83.5k|		value = (value * 10) + digit;
  388|  83.5k|	}
  389|       |
  390|    605|	if ( pos == *_pos ) XMP_Throw ( errMsg, kXMPErr_BadParam );
  ------------------
  |  |  199|     44|#define XMP_Throw(msg,id)	{ AnnounceThrow ( msg ); throw XMP_Error ( id, msg ); }
  ------------------
  |  Branch (390:7): [True: 44, False: 561]
  ------------------
  391|    561|	*_pos = pos;
  392|    561|	return value;
  393|       |
  394|    605|}	// GatherInt
XMPUtils.cpp:_ZL18AdjustTimeOverflowP12XMP_DateTime:
  214|    210|{
  215|    210|	enum { kBillion = 1000*1000*1000L };
  216|       |
  217|       |	// ----------------------------------------------------------------------------------------------
  218|       |	// To be safe against pathalogical overflow we first adjust from month to second, then from
  219|       |	// nanosecond back up to month. This leaves each value closer to zero before propagating into it.
  220|       |	// For example if the hour and minute are both near max, adjusting minutes first can cause the
  221|       |	// hour to overflow.
  222|       |
  223|       |	// ! Photoshop 8 creates "time only" values with zeros for year, month, and day.
  224|       |
  225|    210|	if ( (time->year != 0) || (time->month != 0) || (time->day != 0) ) {
  ------------------
  |  Branch (225:7): [True: 121, False: 89]
  |  Branch (225:28): [True: 4, False: 85]
  |  Branch (225:50): [True: 0, False: 85]
  ------------------
  226|       |
  227|    169|		while ( time->month < 1 ) {
  ------------------
  |  Branch (227:11): [True: 44, False: 125]
  ------------------
  228|     44|			time->year -= 1;
  229|     44|			time->month += 12;
  230|     44|		}
  231|       |
  232|    125|		while ( time->month > 12 ) {
  ------------------
  |  Branch (232:11): [True: 0, False: 125]
  ------------------
  233|      0|			time->year += 1;
  234|      0|			time->month -= 12;
  235|      0|		}
  236|       |
  237|    183|		while ( time->day < 1 ) {
  ------------------
  |  Branch (237:11): [True: 58, False: 125]
  ------------------
  238|     58|			time->month -= 1;
  239|     58|			if ( time->month < 1 ) {	// ! Keep the months in range for indexing daysInMonth!
  ------------------
  |  Branch (239:9): [True: 1, False: 57]
  ------------------
  240|      1|				time->year -= 1;
  241|      1|				time->month += 12;
  242|      1|			}
  243|     58|			time->day += DaysInMonth ( time->year, time->month );	// ! Decrement month before so index here is right!
  244|     58|		}
  245|       |
  246|    129|		while ( time->day > DaysInMonth ( time->year, time->month ) ) {
  ------------------
  |  Branch (246:11): [True: 4, False: 125]
  ------------------
  247|      4|			time->day -= DaysInMonth ( time->year, time->month );	// ! Increment month after so index here is right!
  248|      4|			time->month += 1;
  249|      4|			if ( time->month > 12 ) {
  ------------------
  |  Branch (249:9): [True: 0, False: 4]
  ------------------
  250|      0|				time->year += 1;
  251|      0|				time->month -= 12;
  252|      0|			}
  253|      4|		}
  254|       |
  255|    125|	}
  256|       |
  257|    212|	while ( time->hour < 0 ) {
  ------------------
  |  Branch (257:10): [True: 2, False: 210]
  ------------------
  258|      2|		time->day -= 1;
  259|      2|		time->hour += 24;
  260|      2|	}
  261|       |
  262|    210|	while ( time->hour >= 24 ) {
  ------------------
  |  Branch (262:10): [True: 0, False: 210]
  ------------------
  263|      0|		time->day += 1;
  264|      0|		time->hour -= 24;
  265|      0|	}
  266|       |
  267|    211|	while ( time->minute < 0 ) {
  ------------------
  |  Branch (267:10): [True: 1, False: 210]
  ------------------
  268|      1|		time->hour -= 1;
  269|      1|		time->minute += 60;
  270|      1|	}
  271|       |
  272|    211|	while ( time->minute >= 60 ) {
  ------------------
  |  Branch (272:10): [True: 1, False: 210]
  ------------------
  273|      1|		time->hour += 1;
  274|      1|		time->minute -= 60;
  275|      1|	}
  276|       |
  277|    210|	while ( time->second < 0 ) {
  ------------------
  |  Branch (277:10): [True: 0, False: 210]
  ------------------
  278|      0|		time->minute -= 1;
  279|      0|		time->second += 60;
  280|      0|	}
  281|       |
  282|    210|	while ( time->second >= 60 ) {
  ------------------
  |  Branch (282:10): [True: 0, False: 210]
  ------------------
  283|      0|		time->minute += 1;
  284|      0|		time->second -= 60;
  285|      0|	}
  286|       |
  287|    210|	while ( time->nanoSecond < 0 ) {
  ------------------
  |  Branch (287:10): [True: 0, False: 210]
  ------------------
  288|      0|		time->second -= 1;
  289|      0|		time->nanoSecond += kBillion;
  290|      0|	}
  291|       |
  292|    210|	while ( time->nanoSecond >= kBillion ) {
  ------------------
  |  Branch (292:10): [True: 0, False: 210]
  ------------------
  293|      0|		time->second += 1;
  294|      0|		time->nanoSecond -= kBillion;
  295|      0|	}
  296|       |
  297|    210|	while ( time->second < 0 ) {
  ------------------
  |  Branch (297:10): [True: 0, False: 210]
  ------------------
  298|      0|		time->minute -= 1;
  299|      0|		time->second += 60;
  300|      0|	}
  301|       |
  302|    210|	while ( time->second >= 60 ) {
  ------------------
  |  Branch (302:10): [True: 0, False: 210]
  ------------------
  303|      0|		time->minute += 1;
  304|      0|		time->second -= 60;
  305|      0|	}
  306|       |
  307|    210|	while ( time->minute < 0 ) {
  ------------------
  |  Branch (307:10): [True: 0, False: 210]
  ------------------
  308|      0|		time->hour -= 1;
  309|      0|		time->minute += 60;
  310|      0|	}
  311|       |
  312|    210|	while ( time->minute >= 60 ) {
  ------------------
  |  Branch (312:10): [True: 0, False: 210]
  ------------------
  313|      0|		time->hour += 1;
  314|      0|		time->minute -= 60;
  315|      0|	}
  316|       |
  317|    210|	while ( time->hour < 0 ) {
  ------------------
  |  Branch (317:10): [True: 0, False: 210]
  ------------------
  318|      0|		time->day -= 1;
  319|      0|		time->hour += 24;
  320|      0|	}
  321|       |
  322|    211|	while ( time->hour >= 24 ) {
  ------------------
  |  Branch (322:10): [True: 1, False: 210]
  ------------------
  323|      1|		time->day += 1;
  324|      1|		time->hour -= 24;
  325|      1|	}
  326|       |
  327|    210|	if ( (time->year != 0) || (time->month != 0) || (time->day != 0) ) {
  ------------------
  |  Branch (327:7): [True: 119, False: 91]
  |  Branch (327:28): [True: 6, False: 85]
  |  Branch (327:50): [True: 3, False: 82]
  ------------------
  328|       |
  329|    131|		while ( time->month < 1 ) { // Make sure the months are OK first, for DaysInMonth.
  ------------------
  |  Branch (329:11): [True: 3, False: 128]
  ------------------
  330|      3|			time->year -= 1;
  331|      3|			time->month += 12;
  332|      3|		}
  333|       |
  334|    128|		while ( time->month > 12 ) {
  ------------------
  |  Branch (334:11): [True: 0, False: 128]
  ------------------
  335|      0|			time->year += 1;
  336|      0|			time->month -= 12;
  337|      0|		}
  338|       |
  339|    130|		while ( time->day < 1 ) {
  ------------------
  |  Branch (339:11): [True: 2, False: 128]
  ------------------
  340|      2|			time->month -= 1;
  341|      2|			if ( time->month < 1 ) {
  ------------------
  |  Branch (341:9): [True: 0, False: 2]
  ------------------
  342|      0|				time->year -= 1;
  343|      0|				time->month += 12;
  344|      0|			}
  345|      2|			time->day += DaysInMonth ( time->year, time->month );
  346|      2|		}
  347|       |
  348|    128|		while ( time->day > DaysInMonth ( time->year, time->month ) ) {
  ------------------
  |  Branch (348:11): [True: 0, False: 128]
  ------------------
  349|      0|			time->day -= DaysInMonth ( time->year, time->month );
  350|      0|			time->month += 1;
  351|      0|			if ( time->month > 12 ) {
  ------------------
  |  Branch (351:9): [True: 0, False: 0]
  ------------------
  352|      0|				time->year += 1;
  353|      0|				time->month -= 12;
  354|      0|			}
  355|      0|		}
  356|       |
  357|    128|	}
  358|       |
  359|    210|}	// AdjustTimeOverflow
XMPUtils.cpp:_ZL11DaysInMonthii:
  195|    321|{
  196|       |
  197|    321|	static short	daysInMonth[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  198|       |									   // Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  199|       |
  200|    321|	int days = daysInMonth [ month ];
  201|    321|	if ( (month == 2) && IsLeapYear ( year ) ) days += 1;
  ------------------
  |  Branch (201:7): [True: 69, False: 252]
  |  Branch (201:23): [True: 30, False: 39]
  ------------------
  202|       |
  203|    321|	return days;
  204|       |
  205|    321|}	// DaysInMonth
XMPUtils.cpp:_ZL10IsLeapYearl:
  176|     69|{
  177|       |	// This code uses the Gregorian calendar algorithm:
  178|       |	// https://en.wikipedia.org/wiki/Leap_year#Algorithm
  179|       |
  180|     69|	if ( (year % 4) != 0 ) return false;	// Not a multiple of 4.
  ------------------
  |  Branch (180:7): [True: 20, False: 49]
  ------------------
  181|     49|	if ( (year % 100) != 0 ) return true;	// A multiple of 4 but not a multiple of 100.
  ------------------
  |  Branch (181:7): [True: 20, False: 29]
  ------------------
  182|     29|	if ( (year % 400) == 0 ) return true;	// A multiple of 400.
  ------------------
  |  Branch (182:7): [True: 10, False: 19]
  ------------------
  183|       |
  184|     19|	return false;							// A multiple of 100 but not a multiple of 400.
  185|       |
  186|     29|}	// IsLeapYear

