mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
crucible: add missing template specializations of pwrite helper functions
I got a little too enthusiastic when redacting the code, and removed some overloaded functions bees was using. C++ silently found replacements, and the result was a bug that prevented any data from being persisted from the hash table. Fixes: https://github.com/Zygo/bees/issues/7
This commit is contained in:
parent
06e111c229
commit
dd21e6f848
@ -120,6 +120,9 @@ namespace crucible {
|
|||||||
template<> void pread_or_die<string>(int fd, string& str, off_t offset);
|
template<> void pread_or_die<string>(int fd, string& str, off_t offset);
|
||||||
template<> void pread_or_die<vector<char>>(int fd, vector<char>& str, off_t offset);
|
template<> void pread_or_die<vector<char>>(int fd, vector<char>& str, off_t offset);
|
||||||
template<> void pread_or_die<vector<uint8_t>>(int fd, vector<uint8_t>& str, off_t offset);
|
template<> void pread_or_die<vector<uint8_t>>(int fd, vector<uint8_t>& str, off_t offset);
|
||||||
|
template<> void pwrite_or_die<string>(int fd, const string& str, off_t offset);
|
||||||
|
template<> void pwrite_or_die<vector<char>>(int fd, const vector<char>& str, off_t offset);
|
||||||
|
template<> void pwrite_or_die<vector<uint8_t>>(int fd, const vector<uint8_t>& str, off_t offset);
|
||||||
|
|
||||||
// A different approach to reading a simple string
|
// A different approach to reading a simple string
|
||||||
string read_string(int fd, size_t size);
|
string read_string(int fd, size_t size);
|
||||||
|
21
lib/fd.cc
21
lib/fd.cc
@ -426,6 +426,27 @@ namespace crucible {
|
|||||||
return pread_or_die(fd, text.data(), text.size(), offset);
|
return pread_or_die(fd, text.data(), text.size(), offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
pwrite_or_die<vector<uint8_t>>(int fd, const vector<uint8_t> &text, off_t offset)
|
||||||
|
{
|
||||||
|
return pwrite_or_die(fd, text.data(), text.size(), offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
pwrite_or_die<vector<char>>(int fd, const vector<char> &text, off_t offset)
|
||||||
|
{
|
||||||
|
return pwrite_or_die(fd, text.data(), text.size(), offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void
|
||||||
|
pwrite_or_die<string>(int fd, const string &text, off_t offset)
|
||||||
|
{
|
||||||
|
return pwrite_or_die(fd, text.data(), text.size(), offset);
|
||||||
|
}
|
||||||
|
|
||||||
Stat::Stat()
|
Stat::Stat()
|
||||||
{
|
{
|
||||||
memset_zero<stat>(this);
|
memset_zero<stat>(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user