Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 831 vs 832 for /trunk/Source Code/Platform/ByteBuffer.cpp

Diff revisions: vs.
  @@ -1,6 +1,4 @@
1 1 #include "Headers/ByteBuffer.h"
2 - #include <cassert>
3 - #include <fstream>
4 2
5 3 namespace Divide {
6 4
  @@ -17,30 +15,11 @@
17 15
18 16
19 17 bool ByteBuffer::dumpToFile(const stringImpl& fileName) const {
20 - std::ofstream outputBuffer(fileName.c_str(), std::ios::out | std::ios::binary);
21 - if (!outputBuffer.is_open()) {
22 - //return false;
23 - }
24 - outputBuffer.write((const char*)contents(), size());
25 - outputBuffer.close();
26 - return outputBuffer.good();
18 + return writeFile(fileName, _storage, FileType::BINARY);
27 19 }
28 20
29 21 bool ByteBuffer::loadFromFile(const stringImpl& fileName) {
30 - std::ifstream fileBuffer(fileName.c_str(), std::ios::in | std::ios::binary);
31 -
32 - if (!fileBuffer.eof() && !fileBuffer.fail())
33 - {
34 - fileBuffer.seekg(0, std::ios_base::end);
35 - std::streampos fileSize = fileBuffer.tellg();
36 - fileBuffer.seekg(0, std::ios_base::beg);
37 - resize(fileSize);
38 - fileBuffer.read(reinterpret_cast<char*>(&_storage.front()), fileSize);
39 - fileBuffer.close();
40 - return fileBuffer.good();
41 - }
42 -
43 - return false;
22 + return readFile(fileName, _storage, FileType::BINARY);
44 23 }
45 24
46 25 }; // namespace Divide