replace free with std::free

This commit is contained in:
Syping 2023-01-27 21:39:12 +01:00
parent 487372f7ee
commit 8d866cb44e

View file

@ -86,12 +86,12 @@ inline bool gta5view_export_load(const QByteArray &fileData, RagePhoto *ragePhot
return false; return false;
size = dataBuffer.read(compressedPhotoHeader, compressedSize); size = dataBuffer.read(compressedPhotoHeader, compressedSize);
if (size != compressedSize) { if (size != compressedSize) {
free(compressedPhotoHeader); std::free(compressedPhotoHeader);
return false; return false;
} }
QByteArray t_photoHeader = QByteArray::fromRawData(compressedPhotoHeader, compressedSize); QByteArray t_photoHeader = QByteArray::fromRawData(compressedPhotoHeader, compressedSize);
t_photoHeader = qUncompress(t_photoHeader); t_photoHeader = qUncompress(t_photoHeader);
free(compressedPhotoHeader); std::free(compressedPhotoHeader);
if (t_photoHeader.isEmpty()) if (t_photoHeader.isEmpty())
return false; return false;
@ -116,12 +116,12 @@ inline bool gta5view_export_load(const QByteArray &fileData, RagePhoto *ragePhot
return false; return false;
size = dataBuffer.read(compressedPhoto, compressedSize); size = dataBuffer.read(compressedPhoto, compressedSize);
if (size != compressedSize) { if (size != compressedSize) {
free(compressedPhoto); std::free(compressedPhoto);
return false; return false;
} }
QByteArray t_photoData = QByteArray::fromRawData(compressedPhoto, compressedSize); QByteArray t_photoData = QByteArray::fromRawData(compressedPhoto, compressedSize);
t_photoData = qUncompress(t_photoData); t_photoData = qUncompress(t_photoData);
free(compressedPhoto); std::free(compressedPhoto);
ragePhoto->setPhoto(t_photoData.constData(), t_photoData.size(), t_photoBuffer); ragePhoto->setPhoto(t_photoData.constData(), t_photoData.size(), t_photoBuffer);
// JSON offset will be calculated later, offsets will be removed in G5E4P // JSON offset will be calculated later, offsets will be removed in G5E4P
@ -144,12 +144,12 @@ inline bool gta5view_export_load(const QByteArray &fileData, RagePhoto *ragePhot
return false; return false;
size = dataBuffer.read(compressedJson, compressedSize); size = dataBuffer.read(compressedJson, compressedSize);
if (size != compressedSize) { if (size != compressedSize) {
free(compressedJson); std::free(compressedJson);
return false; return false;
} }
QByteArray t_jsonData = QByteArray::fromRawData(compressedJson, compressedSize); QByteArray t_jsonData = QByteArray::fromRawData(compressedJson, compressedSize);
t_jsonData = qUncompress(t_jsonData); t_jsonData = qUncompress(t_jsonData);
free(compressedJson); std::free(compressedJson);
if (t_jsonData.isEmpty()) if (t_jsonData.isEmpty())
return false; return false;
ragePhoto->setJson(t_jsonData.constData(), t_jsonBuffer); ragePhoto->setJson(t_jsonData.constData(), t_jsonBuffer);
@ -174,12 +174,12 @@ inline bool gta5view_export_load(const QByteArray &fileData, RagePhoto *ragePhot
return false; return false;
size = dataBuffer.read(compressedTitl, compressedSize); size = dataBuffer.read(compressedTitl, compressedSize);
if (size != compressedSize) { if (size != compressedSize) {
free(compressedTitl); std::free(compressedTitl);
return false; return false;
} }
QByteArray t_titlData = QByteArray::fromRawData(compressedTitl, compressedSize); QByteArray t_titlData = QByteArray::fromRawData(compressedTitl, compressedSize);
t_titlData = qUncompress(t_titlData); t_titlData = qUncompress(t_titlData);
free(compressedTitl); std::free(compressedTitl);
ragePhoto->setTitle(t_titlData.constData(), t_titlBuffer); ragePhoto->setTitle(t_titlData.constData(), t_titlBuffer);
// DESC offset will be calculated later, offsets will be removed in G5E4P // DESC offset will be calculated later, offsets will be removed in G5E4P
@ -202,12 +202,12 @@ inline bool gta5view_export_load(const QByteArray &fileData, RagePhoto *ragePhot
return false; return false;
size = dataBuffer.read(compressedDesc, compressedSize); size = dataBuffer.read(compressedDesc, compressedSize);
if (size != compressedSize) { if (size != compressedSize) {
free(compressedDesc); std::free(compressedDesc);
return false; return false;
} }
QByteArray t_descData = QByteArray::fromRawData(compressedDesc, compressedSize); QByteArray t_descData = QByteArray::fromRawData(compressedDesc, compressedSize);
t_descData = qUncompress(t_descData); t_descData = qUncompress(t_descData);
free(compressedDesc); std::free(compressedDesc);
ragePhoto->setDescription(t_descData.constData(), t_descBuffer); ragePhoto->setDescription(t_descData.constData(), t_descBuffer);
// EOF will be calculated later, EOF marker will be removed in G5E4P // EOF will be calculated later, EOF marker will be removed in G5E4P