Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/DefaultFileSystem.cpp

Issue 29409580: Issue 5013 - Make parameter const ref when applicable. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Remove an unecessary smart pointer. Created April 11, 2017, 3:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ConsoleJsObject.cpp ('k') | src/FileSystemJsObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/DefaultFileSystem.cpp
===================================================================
--- a/src/DefaultFileSystem.cpp
+++ b/src/DefaultFileSystem.cpp
@@ -71,20 +71,20 @@
{
std::shared_ptr<std::istream> result(new std::ifstream(NormalizePath(path).c_str()));
if (result->fail())
throw RuntimeErrorWithErrno("Failed to open " + path);
return result;
}
void DefaultFileSystem::Write(const std::string& path,
- std::shared_ptr<std::istream> data)
+ const std::istream& data)
{
std::ofstream file(NormalizePath(path).c_str(), std::ios_base::out | std::ios_base::binary);
- file << Utils::Slurp(*data);
+ file << Utils::Slurp(data);
}
void DefaultFileSystem::Move(const std::string& fromPath,
const std::string& toPath)
{
if (rename(NormalizePath(fromPath).c_str(), NormalizePath(toPath).c_str()))
throw RuntimeErrorWithErrno("Failed to move " + fromPath + " to " + toPath);
}
« no previous file with comments | « src/ConsoleJsObject.cpp ('k') | src/FileSystemJsObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld