diff options
Diffstat (limited to 'Source/ThirdParty/woff2/src/file.h')
-rw-r--r-- | Source/ThirdParty/woff2/src/file.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/ThirdParty/woff2/src/file.h b/Source/ThirdParty/woff2/src/file.h index 69a92f8ab..7afcb315f 100644 --- a/Source/ThirdParty/woff2/src/file.h +++ b/Source/ThirdParty/woff2/src/file.h @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// File IO helpers +// File IO helpers. #ifndef WOFF2_FILE_H_ #define WOFF2_FILE_H_ @@ -22,18 +22,20 @@ namespace woff2 { -inline std::string GetFileContent(std::string filename) { +using std::string; + + +inline string GetFileContent(string filename) { std::ifstream ifs(filename.c_str(), std::ios::binary); - return std::string( + return string( std::istreambuf_iterator<char>(ifs.rdbuf()), std::istreambuf_iterator<char>()); } -inline void SetFileContents(std::string filename, std::string content) { +inline void SetFileContents(string filename, string::iterator start, + string::iterator end) { std::ofstream ofs(filename.c_str(), std::ios::binary); - std::copy(content.begin(), - content.end(), - std::ostream_iterator<char>(ofs)); + std::copy(start, end, std::ostream_iterator<char>(ofs)); } } // namespace woff2 |