Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
y-guyon committed Oct 4, 2024
1 parent 816a298 commit ecc7d7d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions include/avif/avif.h
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,11 @@ typedef enum avifSampleTransformRecipe

typedef struct avifImageItemProperty
{
char boxtype[4]; // boxtype as defined in ISO/IEC 14496-12.
uint8_t boxtype[4]; // boxtype as defined in ISO/IEC 14496-12.
uint8_t usertype[16]; // Universally Unique IDentifier as defined in
// IETF RFC 4122 and ISO/IEC 9834-8.
// Undefined unless boxtype is "uuid".
avifRWData boxpayload; // BoxPayload as defined in ISO/IEC 14496-12.
// Unused unless boxtype is "uuid".
avifRWData boxPayload; // BoxPayload as defined in ISO/IEC 14496-12.
} avifImageItemProperty;

// ---------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions include/avif/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ void avifImageCopySamples(avifImage * dstImage, const avifImage * srcImage, avif
AVIF_API avifResult avifImagePushProperty(avifImage * image,
const uint8_t boxtype[4],
const uint8_t usertype[16],
const uint8_t * boxpayload,
size_t boxpayloadLength);
const uint8_t * boxPayload,
size_t boxPayloadLength);

// ---------------------------------------------------------------------------

Expand Down Expand Up @@ -651,7 +651,7 @@ typedef struct avifBoxHeader
size_t size;

uint8_t type[4];
uint8_t usertype[16]; // Undefined unless |type| is "uuid".
uint8_t usertype[16]; // Unused unless |type| is "uuid".
} avifBoxHeader;

typedef struct avifROStream
Expand Down
14 changes: 7 additions & 7 deletions src/avif.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void avifImageCopySamples(avifImage * dstImage, const avifImage * srcImage, avif
static avifResult avifImageCopyProperties(avifImage * dstImage, const avifImage * srcImage)
{
for (size_t i = 0; i < dstImage->numProperties; ++i) {
avifRWDataFree(&dstImage->properties[i].boxpayload);
avifRWDataFree(&dstImage->properties[i].boxPayload);
}
avifFree(dstImage->properties);
dstImage->properties = NULL;
Expand All @@ -245,9 +245,9 @@ static avifResult avifImageCopyProperties(avifImage * dstImage, const avifImage
for (size_t i = 0; i < srcImage->numProperties; ++i) {
memcpy(dstImage->properties[i].boxtype, srcImage->properties[i].boxtype, sizeof(srcImage->properties[i].boxtype));
memcpy(dstImage->properties[i].usertype, srcImage->properties[i].usertype, sizeof(srcImage->properties[i].usertype));
AVIF_CHECKRES(avifRWDataSet(&dstImage->properties[i].boxpayload,
srcImage->properties[i].boxpayload.data,
srcImage->properties[i].boxpayload.size));
AVIF_CHECKRES(avifRWDataSet(&dstImage->properties[i].boxPayload,
srcImage->properties[i].boxPayload.data,
srcImage->properties[i].boxPayload.size));
}
}
return AVIF_RESULT_OK;
Expand Down Expand Up @@ -371,7 +371,7 @@ void avifImageDestroy(avifImage * image)
avifRWDataFree(&image->exif);
avifRWDataFree(&image->xmp);
for (size_t i = 0; i < image->numProperties; ++i) {
avifRWDataFree(&image->properties[i].boxpayload);
avifRWDataFree(&image->properties[i].boxPayload);
}
avifFree(image->properties);
image->properties = NULL;
Expand All @@ -388,7 +388,7 @@ avifResult avifImageSetMetadataXMP(avifImage * image, const uint8_t * xmp, size_
return avifRWDataSet(&image->xmp, xmp, xmpSize);
}

avifResult avifImagePushProperty(avifImage * image, const uint8_t boxtype[4], const uint8_t usertype[16], const uint8_t * boxpayload, size_t boxpayloadLength)
avifResult avifImagePushProperty(avifImage * image, const uint8_t boxtype[4], const uint8_t usertype[16], const uint8_t * boxPayload, size_t boxPayloadLength)
{
AVIF_CHECKERR(image->numProperties < SIZE_MAX, AVIF_RESULT_INVALID_ARGUMENT);
// Shallow copy the current properties.
Expand All @@ -407,7 +407,7 @@ avifResult avifImagePushProperty(avifImage * image, const uint8_t boxtype[4], co
memset(property, 0, sizeof(*property));
memcpy(property->boxtype, boxtype, sizeof(property->boxtype));
memcpy(property->usertype, usertype, sizeof(property->usertype));
AVIF_CHECKRES(avifRWDataSet(&property->boxpayload, boxpayload, boxpayloadLength));
AVIF_CHECKRES(avifRWDataSet(&property->boxPayload, boxPayload, boxPayloadLength));
return AVIF_RESULT_OK;
}

Expand Down
10 changes: 5 additions & 5 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ typedef struct avifAV1LayeredImageIndexingProperty
typedef struct avifOpaqueProperty
{
uint8_t usertype[16]; // Same as in avifImageItemProperty.
avifRWData boxpayload; // Same as in avifImageItemProperty.
avifRWData boxPayload; // Same as in avifImageItemProperty.
} avifOpaqueProperty;

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -310,7 +310,7 @@ static void avifPropertyArrayDestroy(avifPropertyArray * array)
{
for (size_t i = 0; i < array->count; ++i) {
if (array->prop[i].isOpaque) {
avifRWDataFree(&array->prop[i].u.opaque.boxpayload);
avifRWDataFree(&array->prop[i].u.opaque.boxPayload);
}
}
avifArrayDestroy(array);
Expand Down Expand Up @@ -2629,7 +2629,7 @@ static avifResult avifParseItemPropertyContainerBox(avifPropertyArray * properti
prop->isOpaque = AVIF_TRUE;
memset(&prop->u.opaque, 0, sizeof(prop->u.opaque));
memcpy(prop->u.opaque.usertype, header.usertype, sizeof(prop->u.opaque.usertype));
AVIF_CHECKRES(avifRWDataSet(&prop->u.opaque.boxpayload, avifROStreamCurrent(&s), header.size));
AVIF_CHECKRES(avifRWDataSet(&prop->u.opaque.boxPayload, avifROStreamCurrent(&s), header.size));
}

AVIF_CHECKERR(avifROStreamSkip(&s, header.size), AVIF_RESULT_BMFF_PARSE_FAILED);
Expand Down Expand Up @@ -6051,8 +6051,8 @@ avifResult avifDecoderReset(avifDecoder * decoder)
AVIF_CHECKRES(avifImagePushProperty(decoder->image,
property->type,
property->u.opaque.usertype,
property->u.opaque.boxpayload.data,
property->u.opaque.boxpayload.size));
property->u.opaque.boxPayload.data,
property->u.opaque.boxPayload.size));
}
}

Expand Down

0 comments on commit ecc7d7d

Please sign in to comment.