Fixes for sequential devices

This commit is contained in:
Mirco Miranda
2022-09-25 08:27:47 +02:00
committed by Albert Astals Cid
parent 49bd131eef
commit c96ad6ba8a
9 changed files with 137 additions and 67 deletions

View File

@ -57,6 +57,9 @@ bool KraHandler::canRead(QIODevice *device)
qWarning("KraHandler::canRead() called with no device");
return false;
}
if (device->isSequential()) {
return false;
}
char buff[57];
if (device->peek(buff, sizeof(buff)) == sizeof(buff)) {

View File

@ -56,6 +56,9 @@ bool OraHandler::canRead(QIODevice *device)
qWarning("OraHandler::canRead() called with no device");
return false;
}
if (device->isSequential()) {
return false;
}
char buff[54];
if (device->peek(buff, sizeof(buff)) == sizeof(buff)) {

View File

@ -174,7 +174,7 @@ static QDataStream &operator>>(QDataStream &s, PCXHEADER &ph)
// Skip the rest of the header
quint8 byte;
while (s.device()->pos() < 128) {
for (auto i = 0; i < 54; ++i) {
s >> byte;
}
@ -684,12 +684,6 @@ bool PCXHandler::canRead(QIODevice *device)
return false;
}
// We do not support sequential images
// We need to know the current position to properly read the header
if (device->isSequential()) {
return false;
}
qint64 oldPos = device->pos();
char head[1];

View File

@ -1249,6 +1249,9 @@ bool PSDHandler::canRead(QIODevice *device)
qWarning("PSDHandler::canRead() called with no device");
return false;
}
if (device->isSequential()) {
return false;
}
qint64 oldPos = device->pos();

View File

@ -855,6 +855,14 @@ int RAWHandler::currentImageNumber() const
bool RAWHandler::canRead(QIODevice *device)
{
if (!device) {
qWarning("RAWHandler::canRead() called with no device");
return false;
}
if (device->isSequential()) {
return false;
}
device->startTransaction();
std::unique_ptr<LibRaw> rawProcessor(new LibRaw);

View File

@ -3341,6 +3341,9 @@ bool XCFHandler::canRead(QIODevice *device)
qCDebug(XCFPLUGIN) << "XCFHandler::canRead() called with no device";
return false;
}
if (device->isSequential()) {
return false;
}
qint64 oldPos = device->pos();