MCPcopy Create free account
hub / github.com/Qucs/qucs / extractFile

Method extractFile

qucs/dialogs/packagedialog.cpp:452–470  ·  view source on GitHub ↗

---------------------------------------------------------------

Source from the content-addressed store, hash-verified

450
451// ---------------------------------------------------------------
452int PackageDialog::extractFile(QFile& PkgFile, Q_UINT32 Count, QDir& currDir)
453{
454 char *p = (char*)malloc(Count);
455 PkgFile.read(p, Count);
456 QByteArray Content = qUncompress((unsigned char*)p, Count);
457 free(p);
458
459 p = Content.data();
460 QFile File(currDir.absoluteFilePath(QString(p)));
461 if(!File.open(QIODevice::WriteOnly)) {
462 MsgText->append(tr("ERROR: Cannot create file \"%1\"!").arg(QString(p)));
463 return -1;
464 }
465
466 File.write(p+strlen(p)+1, Content.size()-strlen(p)-1);
467 File.close();
468 MsgText->append(tr("Create file \"%1\"").arg(QString(p)));
469 return 1;
470}
471
472// ---------------------------------------------------------------
473int PackageDialog::extractLibrary(QFile& PkgFile, Q_UINT32 Count)

Callers

nothing calls this directly

Calls 3

dataMethod · 0.80
sizeMethod · 0.80
QStringClass · 0.70

Tested by

no test coverage detected