some leaks fixed and cosmetics changes

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent d3ca55c9a1
commit 429e6460dc
  1. 8
      src/adaptors/UBCFFSubsetAdaptor.cpp
  2. 6
      src/adaptors/UBExportCFF.cpp
  3. 2
      src/adaptors/UBSvgSubsetAdaptor.cpp
  4. 2
      src/domain/UBGraphicsTextItemDelegate.cpp
  5. 24
      src/frameworks/UBCryptoUtils.cpp

@ -1215,13 +1215,17 @@ UBGraphicsGroupContainerItem *UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGro
pStrokesGroup->addToGroup(poly); pStrokesGroup->addToGroup(poly);
} }
} }
if (currentStroke->polygons().empty()) if (currentStroke->polygons().empty()){
delete currentStroke; delete currentStroke;
currentStroke = NULL;
}
if (pStrokesGroup->childItems().count()) if (pStrokesGroup->childItems().count())
mCurrentScene->addItem(pStrokesGroup); mCurrentScene->addItem(pStrokesGroup);
else else{
delete pStrokesGroup; delete pStrokesGroup;
pStrokesGroup = NULL;
}
if (pStrokesGroup) if (pStrokesGroup)
{ {

@ -51,10 +51,10 @@ QString UBExportCFF::exportExtention()
void UBExportCFF::persist(UBDocumentProxy* pDocument) void UBExportCFF::persist(UBDocumentProxy* pDocument)
{ {
QString src = pDocument->persistencePath();
if (!pDocument) if (!pDocument)
return; return;
QString src = pDocument->persistencePath();
QString filename = askForFileName(pDocument, tr("Export as IWB File")); QString filename = askForFileName(pDocument, tr("Export as IWB File"));
@ -82,4 +82,4 @@ void UBExportCFF::persist(UBDocumentProxy* pDocument)
} }
} }

@ -1553,7 +1553,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgPolygon(UBGraphicsPo
QPolygonF polygon = polygonItem->polygon(); QPolygonF polygon = polygonItem->polygon();
int pointsCount = polygon.size(); int pointsCount = polygon.size();
if (polygonItem && pointsCount > 0) if (pointsCount > 0)
{ {
mXmlWriter.writeStartElement("polygon"); mXmlWriter.writeStartElement("polygon");

@ -132,7 +132,7 @@ void UBGraphicsTextItemDelegate::customize(QFontDialog &fontDialog)
fontDialog.setStyleSheet("background-color: white;"); fontDialog.setStyleSheet("background-color: white;");
} }
QListView *fontNameListView; QListView *fontNameListView = NULL;
QList<QListView*> listViews = fontDialog.findChildren<QListView*>(); QList<QListView*> listViews = fontDialog.findChildren<QListView*>();
if (listViews.count() > 0) if (listViews.count() > 0)
{ {

@ -68,15 +68,21 @@ QString UBCryptoUtils::symetricEncrypt(const QString& clear)
int paddingLength = 0; int paddingLength = 0;
unsigned char *ciphertext = (unsigned char *)malloc(cipheredLength); unsigned char *ciphertext = (unsigned char *)malloc(cipheredLength);
if(!EVP_EncryptInit_ex(&mAesEncryptContext, NULL, NULL, NULL, NULL)) if(!EVP_EncryptInit_ex(&mAesEncryptContext, NULL, NULL, NULL, NULL)){
free(ciphertext);
return QString(); return QString();
}
if(!EVP_EncryptUpdate(&mAesEncryptContext, ciphertext, &cipheredLength, (unsigned char *)clearData.data(), clearData.length())) if(!EVP_EncryptUpdate(&mAesEncryptContext, ciphertext, &cipheredLength, (unsigned char *)clearData.data(), clearData.length())){
free(ciphertext);
return QString(); return QString();
}
/* update ciphertext with the final remaining bytes */ /* update ciphertext with the final remaining bytes */
if(!EVP_EncryptFinal_ex(&mAesEncryptContext, ciphertext + cipheredLength, &paddingLength)) if(!EVP_EncryptFinal_ex(&mAesEncryptContext, ciphertext + cipheredLength, &paddingLength)){
free(ciphertext);
return QString(); return QString();
}
QByteArray cipheredData((const char *)ciphertext, cipheredLength + paddingLength); QByteArray cipheredData((const char *)ciphertext, cipheredLength + paddingLength);
@ -94,14 +100,20 @@ QString UBCryptoUtils::symetricDecrypt(const QString& encrypted)
int paddingLength = 0; int paddingLength = 0;
unsigned char *plaintext = (unsigned char *)malloc(encryptedLength); unsigned char *plaintext = (unsigned char *)malloc(encryptedLength);
if(!EVP_DecryptInit_ex(&mAesDecryptContext, NULL, NULL, NULL, NULL)) if(!EVP_DecryptInit_ex(&mAesDecryptContext, NULL, NULL, NULL, NULL)){
free(plaintext);
return QString(); return QString();
}
if(!EVP_DecryptUpdate(&mAesDecryptContext, plaintext, &encryptedLength, (const unsigned char *)encryptedData.data(), encryptedData.length())) if(!EVP_DecryptUpdate(&mAesDecryptContext, plaintext, &encryptedLength, (const unsigned char *)encryptedData.data(), encryptedData.length())){
free(plaintext);
return QString(); return QString();
}
if(!EVP_DecryptFinal_ex(&mAesDecryptContext, plaintext + encryptedLength, &paddingLength)) if(!EVP_DecryptFinal_ex(&mAesDecryptContext, plaintext + encryptedLength, &paddingLength)){
free(plaintext);
return QString(); return QString();
}
int len = encryptedLength + paddingLength; int len = encryptedLength + paddingLength;
QByteArray clearData((const char *)plaintext, len); QByteArray clearData((const char *)plaintext, len);

Loading…
Cancel
Save