summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer/FileWriteBytestream.cpp')
-rw-r--r--Swiften/FileTransfer/FileWriteBytestream.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/FileWriteBytestream.cpp b/Swiften/FileTransfer/FileWriteBytestream.cpp
index 747e1de..bbf3d51 100644
--- a/Swiften/FileTransfer/FileWriteBytestream.cpp
+++ b/Swiften/FileTransfer/FileWriteBytestream.cpp
@@ -1,25 +1,27 @@
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/FileWriteBytestream.h>
8
8#include <cassert> 9#include <cassert>
9#include <boost/numeric/conversion/cast.hpp>
10 10
11#include <Swiften/FileTransfer/FileWriteBytestream.h> 11#include <boost/filesystem/fstream.hpp>
12#include <boost/numeric/conversion/cast.hpp>
12 13
13namespace Swift { 14namespace Swift {
14 15
15FileWriteBytestream::FileWriteBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) { 16FileWriteBytestream::FileWriteBytestream(const boost::filesystem::path& file) : file(file), stream(NULL) {
16} 17}
17 18
18FileWriteBytestream::~FileWriteBytestream() { 19FileWriteBytestream::~FileWriteBytestream() {
19 if (stream) { 20 if (stream) {
20 stream->close(); 21 stream->close();
22 delete stream;
21 stream = NULL; 23 stream = NULL;
22 } 24 }
23} 25}
24 26
25void FileWriteBytestream::write(const std::vector<unsigned char>& data) { 27void FileWriteBytestream::write(const std::vector<unsigned char>& data) {
@@ -35,10 +37,11 @@ void FileWriteBytestream::write(const std::vector<unsigned char>& data) {
35} 37}
36 38
37void FileWriteBytestream::close() { 39void FileWriteBytestream::close() {
38 if (stream) { 40 if (stream) {
39 stream->close(); 41 stream->close();
42 delete stream;
40 stream = NULL; 43 stream = NULL;
41 } 44 }
42} 45}
43 46
44} 47}