summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-08-26 13:07:05 +0200
committerLars Knoll <lars.knoll@digia.com>2014-09-15 08:08:42 +0200
commit0c748fb7b109244c03eebbceb400db53af95974c (patch)
tree3e9ac5ce8b960cfb7dece23c52aaec1c74938b29 /src/corelib/io/qiodevice_p.h
parent0f92875891efca16599d7fd4f29b3f397cd2ca4e (diff)
Fix 64 bit issues in QIODevicePrivateLinearBuffer
The API was using int, not qint64 leading to implicit truncation of numbers in a few places Task-number: QTBUG-40974 Change-Id: I13aedc84557a19b6f74fe6825764e7b5827f27b0 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib/io/qiodevice_p.h')
-rw-r--r--src/corelib/io/qiodevice_p.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index faf64e2cf1..132ab1cad2 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -84,13 +84,13 @@ public:
first = buf;
capacity = 0;
}
- int size() const {
+ qint64 size() const {
return len;
}
bool isEmpty() const {
return len == 0;
}
- void skip(int n) {
+ void skip(qint64 n) {
if (n >= len) {
clear();
} else {
@@ -106,14 +106,14 @@ public:
first++;
return ch;
}
- int read(char* target, int size) {
+ int read(char* target, qint64 size) {
int r = qMin(size, len);
memcpy(target, first, r);
len -= r;
first += r;
return r;
}
- int peek(char* target, int size) {
+ int peek(char* target, qint64 size) {
int r = qMin(size, len);
memcpy(target, first, r);
return r;
@@ -124,7 +124,7 @@ public:
len += size;
return writePtr;
}
- void chop(int size) {
+ void chop(qint64 size) {
if (size >= len) {
clear();
} else {
@@ -136,7 +136,7 @@ public:
clear();
return retVal;
}
- int readLine(char* target, int size) {
+ int readLine(char* target, qint64 size) {
int r = qMin(size, len);
char* eol = static_cast<char*>(memchr(first, '\n', r));
if (eol)
@@ -158,7 +158,7 @@ public:
len++;
*first = c;
}
- void ungetBlock(const char* block, int size) {
+ void ungetBlock(const char* block, qint64 size) {
if ((first - buf) < size) {
// underflow, the existing valid data needs to move to the end of the (potentially bigger) buffer
makeSpace(len + size, freeSpaceAtStart);
@@ -191,7 +191,7 @@ private:
private:
// length of the unread data
- int len;
+ qint64 len;
// start of the unread data
char* first;
// the allocated buffer