mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Set length on output from read media tag.
This commit is contained in:
@@ -74,7 +74,8 @@ typedef struct dataLinkedList
|
||||
struct dataLinkedList *previous;
|
||||
struct dataLinkedList *next;
|
||||
uint8_t *data;
|
||||
int type;
|
||||
int32_t type;
|
||||
uint32_t length;
|
||||
} dataLinkedList;
|
||||
|
||||
typedef struct DumpHardwareEntriesWithData
|
||||
|
||||
@@ -44,7 +44,7 @@ void *open(const char *filepath);
|
||||
|
||||
int close(void *context);
|
||||
|
||||
uint8_t *read_media_tag(void *context, int tag);
|
||||
uint8_t *read_media_tag(void *context, int32_t tag, uint32_t *length);
|
||||
|
||||
void *crc64_init(uint64_t polynomial, uint64_t seed);
|
||||
|
||||
|
||||
@@ -383,8 +383,9 @@ void *open(const char *filepath)
|
||||
// TODO: MediaTagType
|
||||
// MediaTagType mediaTagType = GetMediaTagTypeForDataType(blockHeader.type);
|
||||
|
||||
mediaTag->type = blockHeader.type;
|
||||
mediaTag->data = data;
|
||||
mediaTag->type = blockHeader.type;
|
||||
mediaTag->data = data;
|
||||
mediaTag->length = blockHeader.length;
|
||||
|
||||
if(ctx->mediaTagsHead == NULL)
|
||||
{
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
#include <dicformat.h>
|
||||
#include <errno.h>
|
||||
|
||||
uint8_t *read_media_tag(void *context, int tag)
|
||||
uint8_t *read_media_tag(void *context, int32_t tag, uint32_t *length)
|
||||
{
|
||||
*length = 0;
|
||||
|
||||
if(context == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
@@ -56,7 +58,10 @@ uint8_t *read_media_tag(void *context, int tag)
|
||||
while(item != NULL)
|
||||
{
|
||||
if(item->type == tag)
|
||||
{
|
||||
*length = item->length;
|
||||
return item->data;
|
||||
}
|
||||
|
||||
item = item->next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user