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

Side by Side Diff: src/FileSystemJsObject.cpp

Issue 10805001: Fixed: FileSystem;:Write should take an istream instance for input, not ostream (Closed)
Patch Set: Created May 24, 2013, 9:35 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/DefaultFileSystem.cpp ('k') | src/Utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const std::string& path, const std::string& content) 93 const std::string& path, const std::string& content)
94 : IoThread(jsEngine, callback), path(path), content(content) 94 : IoThread(jsEngine, callback), path(path), content(content)
95 { 95 {
96 } 96 }
97 97
98 void Run() 98 void Run()
99 { 99 {
100 std::string error; 100 std::string error;
101 try 101 try
102 { 102 {
103 std::tr1::shared_ptr<std::ostream> stream(new std::stringstream); 103 std::tr1::shared_ptr<std::iostream> stream(new std::stringstream);
104 *stream << content; 104 *stream << content;
105 fileSystem->Write(path, stream); 105 fileSystem->Write(path, stream);
106 } 106 }
107 catch (std::exception& e) 107 catch (std::exception& e)
108 { 108 {
109 error = e.what(); 109 error = e.what();
110 } 110 }
111 catch (...) 111 catch (...)
112 { 112 {
113 error = "Unknown error while writing to " + path; 113 error = "Unknown error while writing to " + path;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj) 351 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj)
352 { 352 {
353 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback)); 353 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback));
354 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback)); 354 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback));
355 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback)); 355 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback));
356 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback)); 356 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback));
357 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback)); 357 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback));
358 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback)); 358 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback));
359 return obj; 359 return obj;
360 } 360 }
OLDNEW
« no previous file with comments | « src/DefaultFileSystem.cpp ('k') | src/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld