Skip to content

Commit

Permalink
SubFolder should take a reference (not a pointer).
Browse files Browse the repository at this point in the history
  • Loading branch information
saurik committed Oct 10, 2015
1 parent 2dcf3fa commit 2443500
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions ldid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,22 +1643,22 @@ void DiskFolder::Find(const std::string &path, const Functor<void (const std::st
Find(path, "", code);
}

SubFolder::SubFolder(Folder *parent, const std::string &path) :
SubFolder::SubFolder(Folder &parent, const std::string &path) :
parent_(parent),
path_(path)
{
}

void SubFolder::Save(const std::string &path, const Functor<void (std::streambuf &)> &code) {
return parent_->Save(path_ + path, code);
return parent_.Save(path_ + path, code);
}

bool SubFolder::Open(const std::string &path, const Functor<void (std::streambuf &)> &code) {
return parent_->Open(path_ + path, code);
return parent_.Open(path_ + path, code);
}

void SubFolder::Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code) {
return parent_->Find(path_ + path, code);
return parent_.Find(path_ + path, code);
}

static size_t copy(std::streambuf &source, std::streambuf &target) {
Expand Down Expand Up @@ -1837,7 +1837,7 @@ std::string Bundle(const std::string &root, Folder &folder, const std::string &k
if (!nested(name))
return;
auto bundle(root + Split(name).dir);
SubFolder subfolder(&folder, bundle);
SubFolder subfolder(folder, bundle);
Bundle(bundle, subfolder, key, local);
}));

Expand Down
4 changes: 2 additions & 2 deletions ldid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ class SubFolder :
public Folder
{
private:
Folder *parent_;
Folder &parent_;
std::string path_;

public:
SubFolder(Folder *parent, const std::string &path);
SubFolder(Folder &parent, const std::string &path);

virtual void Save(const std::string &path, const Functor<void (std::streambuf &)> &code);
virtual bool Open(const std::string &path, const Functor<void (std::streambuf &)> &code);
Expand Down

0 comments on commit 2443500

Please sign in to comment.