summaryrefslogtreecommitdiff
path: root/src/lib/frame_info.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-07-21 01:50:51 +0200
committerCarl Hetherington <cth@carlh.net>2024-07-21 18:58:43 +0200
commit5c6575633a3e9208a4759ba318c759b08904e686 (patch)
tree8632e604f255ea0abd558c247f2feba975616161 /src/lib/frame_info.cc
parentbc34a710886beb753b449ac7da842aacfff3dd2d (diff)
Represent frame info hash using raw bytes rather than ASCII-encoding.
Diffstat (limited to 'src/lib/frame_info.cc')
-rw-r--r--src/lib/frame_info.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/frame_info.cc b/src/lib/frame_info.cc
index e9478b7b1..33b895eb7 100644
--- a/src/lib/frame_info.cc
+++ b/src/lib/frame_info.cc
@@ -25,11 +25,11 @@
using std::shared_ptr;
-using std::string;
+using std::vector;
-J2KFrameInfo::J2KFrameInfo(uint64_t offset_, uint64_t size_, string hash_)
- : dcp::J2KFrameInfo(offset_, size_, hash_)
+J2KFrameInfo::J2KFrameInfo(uint64_t offset_, uint64_t size_, vector<unsigned char> hash_)
+ : dcp::J2KFrameInfo(offset_, size_, std::move(hash_))
{
}
@@ -61,10 +61,8 @@ J2KFrameInfo::read(dcp::File& file)
file.checked_read(&offset, sizeof(offset));
file.checked_read(&size, sizeof(size));
- char hash_buffer[33];
- file.checked_read(hash_buffer, 32);
- hash_buffer[32] = '\0';
- hash = hash_buffer;
+ hash.resize(16);
+ file.checked_read(hash.data(), 16);
}
@@ -93,6 +91,6 @@ J2KFrameInfo::write(shared_ptr<InfoFileHandle> info_file, Frame frame, Eyes eyes
info_file->get().seek(position(frame, eyes), SEEK_SET);
info_file->get().checked_write(&offset, sizeof(offset));
info_file->get().checked_write(&size, sizeof(size));
- info_file->get().checked_write(hash.c_str(), hash.size());
+ info_file->get().checked_write(hash.data(), hash.size());
}