HaikuDepot: Icon / Tarball Handling - Fix
Resolves #16523 Change-Id: Ied52904da51455fe164cda93daecde6dc3e051d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3219 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
@@ -28,11 +28,11 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum BitmapSize {
|
enum BitmapSize {
|
||||||
BITMAP_SIZE_16 = 1,
|
BITMAP_SIZE_16 = 0,
|
||||||
BITMAP_SIZE_22 = 2,
|
BITMAP_SIZE_22 = 1,
|
||||||
BITMAP_SIZE_32 = 3,
|
BITMAP_SIZE_32 = 2,
|
||||||
BITMAP_SIZE_64 = 4,
|
BITMAP_SIZE_64 = 3,
|
||||||
BITMAP_SIZE_ANY = 5
|
BITMAP_SIZE_ANY = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
// when somebody rates a package, there is a numerical
|
// when somebody rates a package, there is a numerical
|
||||||
|
|||||||
@@ -116,13 +116,23 @@ TarArchiveService::_ReadHeaderFileType(unsigned char data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*const*/ const BString
|
/*static*/ int32
|
||||||
TarArchiveService::_ReadHeaderString(const uint8 *data, size_t dataLength)
|
TarArchiveService::_ReadHeaderStringLength(const uint8* data,
|
||||||
|
size_t maxStringLength)
|
||||||
{
|
{
|
||||||
uint32 actualLength = 0;
|
int32 actualLength = 0;
|
||||||
while (actualLength < dataLength && 0 != data[actualLength])
|
while (actualLength < (int32) maxStringLength && data[actualLength] != 0)
|
||||||
actualLength++;
|
actualLength++;
|
||||||
return BString((const char *) data, actualLength);
|
return actualLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TarArchiveService::_ReadHeaderString(const uint8 *data, size_t maxStringLength,
|
||||||
|
BString& result)
|
||||||
|
{
|
||||||
|
result.SetTo((const char *) data,
|
||||||
|
_ReadHeaderStringLength(data, maxStringLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -198,8 +208,10 @@ TarArchiveService::_ReadHeader(const uint8* block, TarArchiveHeader& header)
|
|||||||
return B_BAD_DATA;
|
return B_BAD_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
header.SetFileName(
|
BString fileName;
|
||||||
_ReadHeaderString(&block[OFFSET_FILENAME], LENGTH_FILENAME));
|
_ReadHeaderString(&block[OFFSET_FILENAME], LENGTH_FILENAME, fileName);
|
||||||
|
|
||||||
|
header.SetFileName(fileName);
|
||||||
header.SetLength(
|
header.SetLength(
|
||||||
_ReadHeaderNumeric(&block[OFFSET_LENGTH], LENGTH_LENGTH));
|
_ReadHeaderNumeric(&block[OFFSET_LENGTH], LENGTH_LENGTH));
|
||||||
header.SetFileType(
|
header.SetFileType(
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ private:
|
|||||||
|
|
||||||
static status_t _ReadHeader(const uint8* data,
|
static status_t _ReadHeader(const uint8* data,
|
||||||
TarArchiveHeader& header);
|
TarArchiveHeader& header);
|
||||||
static const BString _ReadHeaderString(const uint8* data,
|
static int32 _ReadHeaderStringLength(const uint8* data,
|
||||||
size_t dataLength);
|
size_t maxStringLength);
|
||||||
|
static void _ReadHeaderString(const uint8* data,
|
||||||
|
size_t dataLength, BString& result);
|
||||||
static uint32 _ReadHeaderNumeric(const uint8* data,
|
static uint32 _ReadHeaderNumeric(const uint8* data,
|
||||||
size_t dataLength);
|
size_t dataLength);
|
||||||
static tar_file_type _ReadHeaderFileType(uint8 data);
|
static tar_file_type _ReadHeaderFileType(uint8 data);
|
||||||
|
|||||||
Reference in New Issue
Block a user