summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer/FileReadBytestream.cpp')
-rw-r--r--Swiften/FileTransfer/FileReadBytestream.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/FileReadBytestream.cpp b/Swiften/FileTransfer/FileReadBytestream.cpp
index 5885076..4700a9c 100644
--- a/Swiften/FileTransfer/FileReadBytestream.cpp
+++ b/Swiften/FileTransfer/FileReadBytestream.cpp
@@ -1,27 +1,30 @@
1/* 1/*
2 * Copyright (c) 2010-2013 Isode Limited. 2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
6 6
7#include <boost/filesystem/fstream.hpp> 7#include <Swiften/FileTransfer/FileReadBytestream.h>
8
8#include <cassert> 9#include <cassert>
9#include <boost/smart_ptr/make_shared.hpp> 10
11#include <boost/filesystem/fstream.hpp>
10#include <boost/numeric/conversion/cast.hpp> 12#include <boost/numeric/conversion/cast.hpp>
13#include <boost/smart_ptr/make_shared.hpp>
11 14
12#include <Swiften/FileTransfer/FileReadBytestream.h>
13#include <Swiften/Base/ByteArray.h> 15#include <Swiften/Base/ByteArray.h>
14 16
15namespace Swift { 17namespace Swift {
16 18
17FileReadBytestream::FileReadBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) { 19FileReadBytestream::FileReadBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) {
18} 20}
19 21
20FileReadBytestream::~FileReadBytestream() { 22FileReadBytestream::~FileReadBytestream() {
21 if (stream) { 23 if (stream) {
22 stream->close(); 24 stream->close();
25 delete stream;
23 stream = NULL; 26 stream = NULL;
24 } 27 }
25} 28}
26 29
27boost::shared_ptr<ByteArray> FileReadBytestream::read(size_t size) { 30boost::shared_ptr<ByteArray> FileReadBytestream::read(size_t size) {