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 *previous;
|
||||||
struct dataLinkedList *next;
|
struct dataLinkedList *next;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
int type;
|
int32_t type;
|
||||||
|
uint32_t length;
|
||||||
} dataLinkedList;
|
} dataLinkedList;
|
||||||
|
|
||||||
typedef struct DumpHardwareEntriesWithData
|
typedef struct DumpHardwareEntriesWithData
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ void *open(const char *filepath);
|
|||||||
|
|
||||||
int close(void *context);
|
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);
|
void *crc64_init(uint64_t polynomial, uint64_t seed);
|
||||||
|
|
||||||
|
|||||||
@@ -385,6 +385,7 @@ void *open(const char *filepath)
|
|||||||
|
|
||||||
mediaTag->type = blockHeader.type;
|
mediaTag->type = blockHeader.type;
|
||||||
mediaTag->data = data;
|
mediaTag->data = data;
|
||||||
|
mediaTag->length = blockHeader.length;
|
||||||
|
|
||||||
if(ctx->mediaTagsHead == NULL)
|
if(ctx->mediaTagsHead == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,8 +33,10 @@
|
|||||||
#include <dicformat.h>
|
#include <dicformat.h>
|
||||||
#include <errno.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)
|
if(context == NULL)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -56,7 +58,10 @@ uint8_t *read_media_tag(void *context, int tag)
|
|||||||
while(item != NULL)
|
while(item != NULL)
|
||||||
{
|
{
|
||||||
if(item->type == tag)
|
if(item->type == tag)
|
||||||
|
{
|
||||||
|
*length = item->length;
|
||||||
return item->data;
|
return item->data;
|
||||||
|
}
|
||||||
|
|
||||||
item = item->next;
|
item = item->next;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user