diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index b19a79ab..70f3e453 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -266,6 +266,8 @@ namespace Exiv2 { EXIV2API uint16_t getUShort(const byte* buf, ByteOrder byteOrder); //! Read a 4 byte unsigned long value from the data buffer EXIV2API uint32_t getULong(const byte* buf, ByteOrder byteOrder); + //! Read a 8 byte unsigned long value from the data buffer + EXIV2API uint64_t getULongLong(const byte* buf, ByteOrder byteOrder); //! Read an 8 byte unsigned rational value from the data buffer EXIV2API URational getURational(const byte* buf, ByteOrder byteOrder); //! Read a 2 byte signed short value from the data buffer diff --git a/src/types.cpp b/src/types.cpp index df509703..3d539908 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -252,6 +252,22 @@ namespace Exiv2 { } } + uint64_t getULongLong(const byte* buf, ByteOrder byteOrder) + { + if (byteOrder == littleEndian) { + return (uint64_t)buf[7] << 56 | (uint64_t)buf[6] << 48 + | (uint64_t)buf[5] << 40 | (uint64_t)buf[4] << 32 + | (uint64_t)buf[3] << 24 | (uint64_t)buf[2] << 16 + | (uint64_t)buf[1] << 8 | (uint64_t)buf[0]; + } + else { + return (uint64_t)buf[0] << 56 | (uint64_t)buf[1] << 48 + | (uint64_t)buf[2] << 40 | (uint64_t)buf[3] << 32 + | (uint64_t)buf[4] << 24 | (uint64_t)buf[5] << 16 + | (uint64_t)buf[6] << 8 | (uint64_t)buf[7]; + } + } + URational getURational(const byte* buf, ByteOrder byteOrder) { uint32_t nominator = getULong(buf, byteOrder);