Browse Source

slice: Avoid shadowing

pull/108/head
Daniel Scharrer 7 years ago
parent
commit
77c824d5fd
  1. 18
      src/stream/slice.cpp
  2. 24
      src/stream/slice.hpp

18
src/stream/slice.cpp

@ -44,8 +44,8 @@ const char slice_ids[][8] = {
} // anonymous namespace
slice_reader::slice_reader(std::istream * istream, boost::uint32_t data_offset)
: data_offset(data_offset),
slice_reader::slice_reader(std::istream * istream, boost::uint32_t offset)
: data_offset(offset),
slices_per_disk(1), current_slice(0), slice_size(0),
is(istream) {
@ -59,11 +59,11 @@ slice_reader::slice_reader(std::istream * istream, boost::uint32_t data_offset)
}
}
slice_reader::slice_reader(const path_type & dir, const std::string & basename,
const std::string & basename2, size_t slices_per_disk)
slice_reader::slice_reader(const path_type & dirname, const std::string & basename,
const std::string & basename2, size_t disk_slice_count)
: data_offset(0),
dir(dir), base_file(basename), base_file2(basename2),
slices_per_disk(slices_per_disk), current_slice(0), slice_size(0),
dir(dirname), base_file(basename), base_file2(basename2),
slices_per_disk(disk_slice_count), current_slice(0), slice_size(0),
is(&ifs) { }
void slice_reader::seek(size_t slice) {
@ -157,12 +157,12 @@ std::string slice_reader::slice_filename(const std::string & basename, size_t sl
return oss.str();
}
bool slice_reader::open_file_case_insensitive(const path_type & dir, const path_type & filename) {
bool slice_reader::open_file_case_insensitive(const path_type & dirname, const path_type & filename) {
boost::filesystem::directory_iterator end;
for(boost::filesystem::directory_iterator i(dir); i != end; ++i) {
for(boost::filesystem::directory_iterator i(dirname); i != end; ++i) {
path_type actual_filename = i->path().filename();
if(boost::iequals(actual_filename.string(), filename.string()) && open_file(dir / actual_filename)) {
if(boost::iequals(actual_filename.string(), filename.string()) && open_file(dirname / actual_filename)) {
return true;
}
}

24
src/stream/slice.hpp

@ -77,7 +77,7 @@ class slice_reader : public boost::iostreams::source {
void seek(size_t slice);
bool open_file(const path_type & file);
bool open_file_case_insensitive(const path_type & dir, const path_type & filename);
bool open_file_case_insensitive(const path_type & dirname, const path_type & filename);
void open(size_t slice);
public:
@ -89,15 +89,15 @@ public:
* Construct a \ref slice_reader to read from data inside the setup file.
* Seeking to anything except the zeroeth slice is not allowed.
*
* \param istream A seekable input stream for the setup executable.
* The initial read position of the stream is ignored.
* \param data_offset The offset within the given stream where the setup data starts.
* This offset is given by \ref loader::offsets::data_offset.
* \param istream A seekable input stream for the setup executable.
* The initial read position of the stream is ignored.
* \param offset The offset within the given stream where the setup data starts.
* This offset is given by \ref loader::offsets::data_offset.
*
* The constructed reader will allow reading the byte range [data_offset, file end)
* from the setup executable and provide this as the range [0, file end - data_offset).
*/
slice_reader(std::istream * istream, boost::uint32_t data_offset);
slice_reader(std::istream * istream, boost::uint32_t offset);
/*!
* Construct a \ref slice_reader to read from external data slices (aka disks).
@ -109,13 +109,13 @@ public:
* The disk number is given by \code slice / slices_per_disk + 1 \endcode while
* the sliceletter is the ASCII char \code 'a' + (slice % slices_per_disk) \endcode.
*
* \param dir The directory containing the slice files.
* \param basename The base name for slice files.
* \param basename2 Alternative base name for slice files.
* \param slices_per_disk How many slices are grouped into one disk. Must not be \c 0.
* \param dirname The directory containing the slice files.
* \param basename The base name for slice files.
* \param basename2 Alternative base name for slice files.
* \param disk_slice_count How many slices are grouped into one disk. Must not be \c 0.
*/
slice_reader(const path_type & dir, const std::string & basename, const std::string & basename2,
size_t slices_per_disk);
slice_reader(const path_type & dirname, const std::string & basename, const std::string & basename2,
size_t disk_slice_count);
/*!
* Attempt to seek to an offset within a slice.

Loading…
Cancel
Save