summaryrefslogtreecommitdiffstats
path: root/src/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth')
-rw-r--r--src/bluetooth/qbluetoothtransferreply_bluez.cpp8
-rw-r--r--src/bluetooth/qbluetoothtransferreply_qnx.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothtransferreply_bluez.cpp b/src/bluetooth/qbluetoothtransferreply_bluez.cpp
index ae29ce37..f0806d5e 100644
--- a/src/bluetooth/qbluetoothtransferreply_bluez.cpp
+++ b/src/bluetooth/qbluetoothtransferreply_bluez.cpp
@@ -47,6 +47,7 @@
#include <QtCore/QAtomicInt>
#include <QtCore/QLoggingCategory>
+#include <QtCore/QVector>
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentRun>
@@ -160,16 +161,15 @@ bool QBluetoothTransferReplyBluez::start()
bool QBluetoothTransferReplyBluez::copyToTempFile(QIODevice *to, QIODevice *from)
{
- char *block = new char[4096];
+ QVector<char> block(4096);
int size;
- while ((size = from->read(block, 4096)) > 0) {
- if(size != to->write(block, size)){
+ while ((size = from->read(block.data(), block.size())) > 0) {
+ if (size != to->write(block.data(), size)) {
return false;
}
}
- delete[] block;
return true;
}
diff --git a/src/bluetooth/qbluetoothtransferreply_qnx.cpp b/src/bluetooth/qbluetoothtransferreply_qnx.cpp
index 4c378065..9a717f69 100644
--- a/src/bluetooth/qbluetoothtransferreply_qnx.cpp
+++ b/src/bluetooth/qbluetoothtransferreply_qnx.cpp
@@ -44,6 +44,7 @@
#include "qnx/ppshelpers_p.h"
#include <QSocketNotifier>
+#include <QtCore/QVector>
#include <QtCore/private/qcore_unix_p.h>
@@ -156,15 +157,14 @@ bool QBluetoothTransferReplyQnx::start()
bool QBluetoothTransferReplyQnx::copyToTempFile(QIODevice *to, QIODevice *from)
{
- char *block = new char[4096];
+ QVector<char> block(4096);
int size;
- while ((size = from->read(block, 4096)) > 0) {
- if (size != to->write(block, size))
+ while ((size = from->read(block.data(), block.size())) > 0) {
+ if (size != to->write(block.data(), size))
return false;
}
- delete[] block;
return true;
}