summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qiodevice_p.h')
-rw-r--r--src/corelib/io/qiodevice_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index 4819ec11a0..362ea4bdf0 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -78,8 +78,11 @@ public:
delete [] buf;
}
void clear() {
- first = buf;
len = 0;
+ delete [] buf;
+ buf = 0;
+ first = buf;
+ capacity = 0;
}
int size() const {
return len;
@@ -129,10 +132,9 @@ public:
}
}
QByteArray readAll() {
- char* f = first;
- int l = len;
+ QByteArray retVal(first, len);
clear();
- return QByteArray(f, l);
+ return retVal;
}
int readLine(char* target, int size) {
int r = qMin(size, len);