移除一个经常new的操作

CigaretteSH
Jinhuan 2 months ago
parent 5b215b8e0c
commit 318000820f

@ -359,18 +359,14 @@ void ExportDataThread::run()
QFile* file[2] = { NULL }; QFile* file[2] = { NULL };
file[0] = new QFile(fileList[0]); QFile fileNg(fileList[0]);
file[1] = new QFile(fileList[1]); QFile fileOk(fileList[1]);
fileNg.open(QIODevice::WriteOnly);
fileOk.open(QIODevice::WriteOnly);
//QFile fileNg(fileList[0]); QTextStream ngStream(fileNg);
// QFile fileOk(fileList[1]); QTextStream okStream(fileOk);
file[0]->open(QIODevice::WriteOnly);
file[1]->open(QIODevice::WriteOnly);
QTextStream ngStream(file[0]);
QTextStream okStream(file[1]);
argsNg.append("a"); argsNg.append("a");
argsNg.append(zipFilePaths[0]); argsNg.append(zipFilePaths[0]);
@ -395,8 +391,8 @@ void ExportDataThread::run()
argsOk.append("-i@" + fileList[1]); argsOk.append("-i@" + fileList[1]);
argsOk.append("-mx=3"); argsOk.append("-mx=3");
file[0]->close(); fileNg.close();
file[1]->close(); fileOk.close();
for (int i = 0; i < zipFilePaths.size(); i++) { for (int i = 0; i < zipFilePaths.size(); i++) {
if (file[i]->size() == 0) { if (file[i]->size() == 0) {
@ -413,8 +409,8 @@ void ExportDataThread::run()
QFile file(zipFilePaths[i]); QFile file(zipFilePaths[i]);
file.remove(); file.remove();
} }
file[0]->remove(); fileNg.remove();
file[1]->remove(); fileOk.remove();
listToZip.clear(); listToZip.clear();
readyToSendZip = false; readyToSendZip = false;
} }

Loading…
Cancel
Save