remove code for always false condition in QX11Data::clipboardReadIncrementalProperty()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-01-20 21:13:16 +02:00
parent b5a9f09364
commit 91a8dacb98
3 changed files with 5 additions and 10 deletions

View file

@ -613,7 +613,7 @@ bool QX11Data::clipboardReadProperty(Window win, Atom property, bool deletePrope
return ok;
}
QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm)
QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes)
{
XEvent event;
@ -640,12 +640,7 @@ QByteArray QX11Data::clipboardReadIncrementalProperty(Window win, Atom property,
continue;
if (qt_x11Data->clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) {
if (length == 0) { // no more data, we're done
if (nullterm) {
buf.resize(offset+1);
buf[offset] = '\0';
} else {
buf.resize(offset);
}
return buf;
} else if (!alloc_error) {
if (offset+length > (int)buf.size()) {
@ -1148,7 +1143,7 @@ QByteArray QClipboardWatcher::getDataInFormat(Atom fmtatom) const
if (qt_x11Data->clipboardReadProperty(win, ATOM(_QT_SELECTION), true, &buf, 0, &type, 0)) {
if (type == ATOM(INCR)) {
int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0;
buf = qt_x11Data->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes, false);
buf = qt_x11Data->clipboardReadIncrementalProperty(win, ATOM(_QT_SELECTION), nbytes);
}
}

View file

@ -2022,7 +2022,7 @@ QVariant QDropData::retrieveData_sys(const QString &mimetype, QVariant::Type req
if (qt_x11Data->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) {
if (type == ATOM(INCR)) {
int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0;
result = qt_x11Data->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false);
result = qt_x11Data->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes);
} else if (type != a && type != XNone) {
DEBUG("Qt clipboard: unknown atom %ld", type);
}

View file

@ -150,7 +150,7 @@ struct QX11Data
bool clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout, bool checkManager = false);
bool clipboardReadProperty(Window win, Atom property, bool deleteProperty,
QByteArray *buffer, int *size, Atom *type, int *format);
QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm);
QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes);
// from qdnd_x11.cpp
bool dndEnable(QWidget* w, bool on);