From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Cc: Pierre-Anthony Lemieux <pal@palemieux.com> Subject: [FFmpeg-devel] [PATCH v1 2/2] fate/imf: remove redundant code Date: Mon, 15 May 2023 08:28:12 -0700 Message-ID: <20230515152812.23405-2-pal@sandflow.com> (raw) In-Reply-To: <20230515152812.23405-1-pal@sandflow.com> From: Pierre-Anthony Lemieux <pal@palemieux.com> --- libavformat/tests/imf.c | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/libavformat/tests/imf.c b/libavformat/tests/imf.c index a5bdf16645..a23b687c3d 100644 --- a/libavformat/tests/imf.c +++ b/libavformat/tests/imf.c @@ -257,7 +257,7 @@ const char *cpl_doc = "</SegmentList>" "</CompositionPlaylist>"; -const char *cpl_bad_doc = "<Composition></Composition>"; +const char *cpl_bad_empty_doc = "<Composition></Composition>"; const char *asset_map_doc = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" @@ -384,36 +384,11 @@ static int test_cpl_parsing(void) return 0; } -static int test_bad_cpl_parsing(FFIMFCPL **cpl) -{ - xmlDocPtr doc; - int ret; - - doc = xmlReadMemory(cpl_bad_doc, strlen(cpl_bad_doc), NULL, NULL, 0); - if (doc == NULL) { - printf("XML parsing failed.\n"); - return 1; - } - - ret = ff_imf_parse_cpl_from_xml_dom(doc, cpl); - xmlFreeDoc(doc); - if (ret) { - printf("CPL parsing failed.\n"); - return ret; - } - - ff_imf_cpl_free(*cpl); - *cpl = NULL; - - return 0; -} - -static int test_bad_resource_cpl_parsing(FFIMFCPL **cpl) -{ +static int test_bad_cpl(FFIMFCPL **cpl, const char* bad_cpl_doc) { xmlDocPtr doc; int ret; - doc = xmlReadMemory(cpl_bad_resource_doc, strlen(cpl_bad_resource_doc), NULL, NULL, 0); + doc = xmlReadMemory(bad_cpl_doc, strlen(bad_cpl_doc), NULL, NULL, 0); if (doc == NULL) { printf("XML parsing failed.\n"); return 1; @@ -591,7 +566,7 @@ int main(int argc, char *argv[]) ret = 1; printf("#### The following should fail ####\n"); - if (test_bad_cpl_parsing(&cpl) == 0) { + if (test_bad_cpl(&cpl, cpl_bad_empty_doc) == 0) { ret = 1; } else if (cpl) { printf("Improper cleanup after failed CPL parsing\n"); @@ -600,10 +575,7 @@ int main(int argc, char *argv[]) printf("#### End failing test ####\n"); printf("#### The following should emit errors ####\n"); - if (test_bad_resource_cpl_parsing(&cpl) != 0) { - ret = 1; - } else if (cpl) { - printf("Improper cleanup after failed CPL parsing\n"); + if (test_bad_cpl(&cpl, cpl_bad_resource_doc) != 0) { ret = 1; } printf("#### End emission of errors ####\n"); -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2023-05-15 15:28 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-15 15:28 [FFmpeg-devel] [PATCH v1 1/2] fate/imf: fix memory leak pal 2023-05-15 15:28 ` pal [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230515152812.23405-2-pal@sandflow.com \ --to=pal@sandflow.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=pal@palemieux.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git