Slurp should take a const source path
This commit is contained in:
parent
6d52e37c93
commit
a3a6765d38
4
io.cpp
4
io.cpp
@ -15,8 +15,8 @@ using namespace std;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
uint8_t *
|
uint8_t *
|
||||||
slurp (boost::filesystem::path& path) {
|
slurp (const boost::filesystem::path& path) {
|
||||||
fd_ref fd(open (path.c_str(), O_RDONLY | O_CLOEXEC));
|
fd_ref fd(open (path.string ().c_str (), O_RDONLY)); // | O_CLOEXEC));
|
||||||
|
|
||||||
// Calculate the total file size
|
// Calculate the total file size
|
||||||
off_t size = lseek (fd, 0, SEEK_END);
|
off_t size = lseek (fd, 0, SEEK_END);
|
||||||
|
2
io.hpp
2
io.hpp
@ -38,7 +38,7 @@ enum access_t {
|
|||||||
/// Reads an entire file into memory. Caller frees the result. Guarantees a
|
/// Reads an entire file into memory. Caller frees the result. Guarantees a
|
||||||
/// null trailing byte.
|
/// null trailing byte.
|
||||||
uint8_t *
|
uint8_t *
|
||||||
slurp (boost::filesystem::path&) mustuse;
|
slurp (const boost::filesystem::path&) mustuse;
|
||||||
|
|
||||||
/// A simple RAII wrapper for file descriptors
|
/// A simple RAII wrapper for file descriptors
|
||||||
struct fd_ref {
|
struct fd_ref {
|
||||||
|
Loading…
Reference in New Issue
Block a user