Slurp should take a const source path

This commit is contained in:
Danny Robson 2011-07-04 16:20:53 +10:00 committed by U-steve\danny
parent 6d52e37c93
commit a3a6765d38
2 changed files with 3 additions and 3 deletions

4
io.cpp
View File

@ -15,8 +15,8 @@ using namespace std;
//----------------------------------------------------------------------------
uint8_t *
slurp (boost::filesystem::path& path) {
fd_ref fd(open (path.c_str(), O_RDONLY | O_CLOEXEC));
slurp (const boost::filesystem::path& path) {
fd_ref fd(open (path.string ().c_str (), O_RDONLY)); // | O_CLOEXEC));
// Calculate the total file size
off_t size = lseek (fd, 0, SEEK_END);

2
io.hpp
View File

@ -38,7 +38,7 @@ enum access_t {
/// Reads an entire file into memory. Caller frees the result. Guarantees a
/// null trailing byte.
uint8_t *
slurp (boost::filesystem::path&) mustuse;
slurp (const boost::filesystem::path&) mustuse;
/// A simple RAII wrapper for file descriptors
struct fd_ref {