ArchiveUtil: use signed return type instead of unsigned
The ExtractFileFromArchive function can sometimes return -1 on error, however the function's return type was specified as u32, which would mean that it would instead be represented as the maximum value. Change the function's return type to the signed s32 instead, and correct uses.
This commit is contained in:
parent
2b3bba512e
commit
8fa9705079
|
@ -119,7 +119,7 @@ QVector<QString> ExtractFileFromArchive(QString path, QString wantedFile, QByteA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 ExtractFileFromArchive(QString path, QString wantedFile, u8** filedata, u32* filesize)
|
s32 ExtractFileFromArchive(QString path, QString wantedFile, u8** filedata, u32* filesize)
|
||||||
{
|
{
|
||||||
struct archive *a = archive_read_new();
|
struct archive *a = archive_read_new();
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Archive
|
||||||
{
|
{
|
||||||
|
|
||||||
QVector<QString> ListArchive(QString path);
|
QVector<QString> ListArchive(QString path);
|
||||||
u32 ExtractFileFromArchive(QString path, QString wantedFile, u8** filedata, u32* filesize);
|
s32 ExtractFileFromArchive(QString path, QString wantedFile, u8** filedata, u32* filesize);
|
||||||
//QVector<QString> ExtractFileFromArchive(QString path, QString wantedFile, QByteArray *romBuffer);
|
//QVector<QString> ExtractFileFromArchive(QString path, QString wantedFile, QByteArray *romBuffer);
|
||||||
//u32 ExtractFileFromArchive(const char* path, const char* wantedFile, u8 **romdata);
|
//u32 ExtractFileFromArchive(const char* path, const char* wantedFile, u8 **romdata);
|
||||||
|
|
||||||
|
|
|
@ -1362,7 +1362,7 @@ bool LoadGBAROM(QStringList filepath)
|
||||||
{
|
{
|
||||||
// file inside archive
|
// file inside archive
|
||||||
|
|
||||||
u32 lenread = Archive::ExtractFileFromArchive(filepath.at(0), filepath.at(1), &filedata, &filelen);
|
s32 lenread = Archive::ExtractFileFromArchive(filepath.at(0), filepath.at(1), &filedata, &filelen);
|
||||||
if (lenread < 0) return false;
|
if (lenread < 0) return false;
|
||||||
if (!filedata) return false;
|
if (!filedata) return false;
|
||||||
if (lenread != filelen)
|
if (lenread != filelen)
|
||||||
|
|
Loading…
Reference in New Issue