Skip to content

Commit

Permalink
Code formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
palemieux committed Dec 7, 2021
1 parent e3b19e2 commit de2d1a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
12 changes: 4 additions & 8 deletions libavformat/imf_cpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,8 @@ static int fill_marker_resource(xmlNodePtr marker_resource_elem,
if (xmlStrcmp(element->name, "Marker") == 0) {
tmp = av_realloc(marker_resource->markers,
(marker_resource->marker_count + 1) * sizeof(FFIMFMarker));
if (!tmp) {
if (!tmp)
return AVERROR(ENOMEM);
}
marker_resource->markers = tmp;
imf_marker_init(&marker_resource->markers[marker_resource->marker_count]);
ret = fill_marker(element,
Expand Down Expand Up @@ -369,9 +368,8 @@ static int push_marker_sequence(xmlNodePtr marker_sequence_elem, FFIMFCPL *cpl)
/* create main marker virtual track if it does not exist */
if (!cpl->main_markers_track) {
cpl->main_markers_track = av_malloc(sizeof(FFIMFMarkerVirtualTrack));
if (!cpl->main_markers_track) {
if (!cpl->main_markers_track)
return AVERROR(ENOMEM);
}
imf_marker_virtual_track_init(cpl->main_markers_track);
memcpy(cpl->main_markers_track->base.id_uuid, uuid, sizeof(uuid));
} else if (memcmp(cpl->main_markers_track->base.id_uuid, uuid, sizeof(uuid)) != 0) {
Expand Down Expand Up @@ -458,9 +456,8 @@ static int push_main_audio_sequence(xmlNodePtr audio_sequence_elem, FFIMFCPL *cp
if (!vt) {
tmp = av_realloc(cpl->main_audio_tracks,
(cpl->main_audio_track_count + 1) * sizeof(FFIMFTrackFileVirtualTrack));
if (!tmp) {
if (!tmp)
return AVERROR(ENOMEM);
}
cpl->main_audio_tracks = tmp;
vt = &cpl->main_audio_tracks[cpl->main_audio_track_count];
imf_trackfile_virtual_track_init(vt);
Expand Down Expand Up @@ -528,9 +525,8 @@ static int push_main_image_2d_sequence(xmlNodePtr image_sequence_elem, FFIMFCPL
/* create main image virtual track if one does not exist */
if (!cpl->main_image_2d_track) {
cpl->main_image_2d_track = av_malloc(sizeof(FFIMFTrackFileVirtualTrack));
if (!cpl->main_image_2d_track) {
if (!cpl->main_image_2d_track)
return AVERROR(ENOMEM);
}
imf_trackfile_virtual_track_init(cpl->main_image_2d_track);
memcpy(cpl->main_image_2d_track->base.id_uuid, uuid, sizeof(uuid));
} else if (memcmp(cpl->main_image_2d_track->base.id_uuid, uuid, sizeof(uuid)) != 0) {
Expand Down
9 changes: 2 additions & 7 deletions libavformat/imfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,8 @@ static int open_track_resource_context(AVFormatContext *s,

if (!track_resource->ctx) {
track_resource->ctx = avformat_alloc_context();
if (!track_resource->ctx) {
av_log(NULL, AV_LOG_ERROR, "Cannot allocate Track Resource Context\n");
if (!track_resource->ctx)
return AVERROR(ENOMEM);
}
}

if (track_resource->ctx->iformat) {
Expand Down Expand Up @@ -454,10 +452,8 @@ static int open_track_file_resource(AVFormatContext *s,
&track->resources_alloc_sz,
(track->resource_count + track_file_resource->base.repeat_count)
* sizeof(IMFVirtualTrackResourcePlaybackCtx));
if (!tmp) {
av_log(NULL, AV_LOG_ERROR, "Cannot allocate Virtual Track playback context\n");
if (!tmp)
return AVERROR(ENOMEM);
}
track->resources = tmp;

for (uint32_t i = 0; i < track_file_resource->base.repeat_count; ++i) {
Expand Down Expand Up @@ -508,7 +504,6 @@ static int open_virtual_track(AVFormatContext *s,

tmp = av_realloc(c->tracks, (c->track_count + 1) * sizeof(IMFVirtualTrackPlaybackCtx *));
if (!tmp) {
av_log(NULL, AV_LOG_ERROR, "Cannot allocate Virtual Track playback context\n");
ret = AVERROR(ENOMEM);
goto clean_up;
}
Expand Down
6 changes: 3 additions & 3 deletions libavformat/tests/imf.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static int check_asset_locator_attributes(IMFAssetLocator *asset, IMFAssetLocato
printf("\tCompare " FF_UUID_FORMAT " to " FF_UUID_FORMAT ".\n",
UID_ARG(asset->uuid),
UID_ARG(expected_asset->uuid));
for(uint32_t i = 0; i < 16; ++i) {
for (uint32_t i = 0; i < 16; ++i) {
if (asset->uuid[i] != expected_asset->uuid[i]) {
printf("Invalid asset locator UUID: found " FF_UUID_FORMAT " instead of " FF_UUID_FORMAT " expected.\n",
UID_ARG(asset->uuid),
Expand Down Expand Up @@ -412,7 +412,7 @@ static int test_asset_map_parsing(void)
goto cleanup;
}

for(uint32_t i = 0; i < asset_locator_map.asset_count; ++i) {
for (uint32_t i = 0; i < asset_locator_map.asset_count; ++i) {
printf("For asset: %d:\n", i);
ret = check_asset_locator_attributes(&(asset_locator_map.assets[i]),
&(ASSET_MAP_EXPECTED_LOCATORS[i]));
Expand Down Expand Up @@ -450,7 +450,7 @@ static const PathTypeTestStruct PATH_TYPE_TEST_STRUCTS[11] = {
static int test_path_type_functions(void)
{
PathTypeTestStruct path_type;
for(uint32_t i = 0; i < 11; ++i) {
for (uint32_t i = 0; i < 11; ++i) {
path_type = PATH_TYPE_TEST_STRUCTS[i];
if (imf_uri_is_url(path_type.path) != path_type.is_url) {
fprintf(stderr,
Expand Down

0 comments on commit de2d1a1

Please sign in to comment.