mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-19 04:02:09 +01:00
Fixed read error check
This commit is contained in:
parent
0248ecb254
commit
542b3e920e
@ -70,11 +70,11 @@ bool Tar::loadTar()
|
|||||||
quint64 size;
|
quint64 size;
|
||||||
qint64 ret;
|
qint64 ret;
|
||||||
|
|
||||||
while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) {
|
while ((ret = _file.read(buffer, BLOCKSIZE))) {
|
||||||
if (ret < BLOCKSIZE) {
|
if (ret < BLOCKSIZE) {
|
||||||
_file.close();
|
_file.close();
|
||||||
_index.clear();
|
_index.clear();
|
||||||
_errorString = "Error reading header block";
|
_errorString = "Error reading TAR header block";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size = number(hdr->size, sizeof(hdr->size));
|
size = number(hdr->size, sizeof(hdr->size));
|
||||||
@ -100,7 +100,7 @@ bool Tar::loadTmi(const QString &path)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (!file.atEnd()) {
|
while (!file.atEnd()) {
|
||||||
QByteArray line = file.readLine(4096);
|
QByteArray line(file.readLine(4096));
|
||||||
int pos = line.indexOf(':');
|
int pos = line.indexOf(':');
|
||||||
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
||||||
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user