Skip to content

Commit 51ac521

Browse files
7134956bbogush
authored andcommitted
Qt: Add "verify" action.
Change-Id: Ie1a98e0134e09b53268e52c97e643a217addd92e
1 parent bf47988 commit 51ac521

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

qt/main_window.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void MainWindow::slotProgVerifyCompleted(quint64 readBytes)
377377

378378
setProgress(100);
379379
workFile.close();
380-
buffer.clear();
380+
buffer.buf.clear();
381381

382382
qInfo() << readBytes << " bytes read. Verify end." ;
383383
}
@@ -390,9 +390,10 @@ void MainWindow::slotProgVerifyProgress(quint64 progress)
390390
setProgress(progressPercent);
391391

392392
QVector<uint8_t> cmpBuffer;
393-
cmpBuffer.resize(buffer.size());
393+
buffer.mutex.lock();
394+
cmpBuffer.resize(buffer.buf.size());
394395

395-
qint64 readSize = workFile.read((char *)cmpBuffer.data(), buffer.size());
396+
qint64 readSize = workFile.read((char *)cmpBuffer.data(), buffer.buf.size());
396397

397398
if (readSize < 0)
398399
{
@@ -405,7 +406,7 @@ void MainWindow::slotProgVerifyProgress(quint64 progress)
405406

406407
for(uint32_t i = 0; i < readSize; i++)
407408
{
408-
if(cmpBuffer.at(i) != buffer.at(i))
409+
if(cmpBuffer.at(i) != buffer.buf.at(i))
409410
{
410411
uint64_t block = progress / ui->blockSizeValueLabel->text().toULongLong(nullptr, 16)
411412
+ ui->firstSpinBox->text().toULongLong(nullptr, 10) - 1;
@@ -419,7 +420,8 @@ void MainWindow::slotProgVerifyProgress(quint64 progress)
419420
}
420421
}
421422

422-
buffer.clear();
423+
buffer.buf.clear();
424+
buffer.mutex.unlock();
423425
}
424426

425427
void MainWindow::slotProgVerify()
@@ -486,7 +488,7 @@ void MainWindow::slotProgVerify()
486488
ui->filePathLineEdit->setDisabled(true);
487489
ui->selectFilePushButton->setDisabled(true);
488490

489-
buffer.clear();
491+
buffer.buf.clear();
490492

491493
prog->readChip(&buffer, start_address, areaSize, true);
492494
}

0 commit comments

Comments
 (0)