From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 92FA040AC3 for ; Thu, 3 Feb 2022 18:46:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A159A68B1A3; Thu, 3 Feb 2022 20:45:42 +0200 (EET) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2541168B15A for ; Thu, 3 Feb 2022 20:45:38 +0200 (EET) Received: by mail-qt1-f174.google.com with SMTP id p14so3714198qtx.0 for ; Thu, 03 Feb 2022 10:45:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6TtBKnRc/q65PuEwViCo/0Q7qdak8CEUFAt/85ItZoI=; b=HlhnHFcoS7n7312lmUYMlTNLaYU9h+hCNZ7XJX44rF10NC00mR69wzLejf9hzJUbxv pMkzOPfl0WtzyJRGfXnqUR0NEXpDYrgq/yrMq9iJ1V/xONRAEEb2sNYR9i8GvPMUS+WL gpd0igzhKhRawhfvvHCvUjJy3e5F1YdxYnrnJmXoASe0Ay1q/y7Eq2dUkoGcteiWKQ0d azEjHyNbrX2CyhTENcwbwXDsT4NoFOBF7m7KK2NDUQt7B9ZGZD3x60GtBnjW3HFt8+E/ sznbIIYWY1zH94qoPhNGvOkU2zRLaFM6ArXIVLG2MABXnPMHOkZGqJNoLC2yAspDB7rE ugbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6TtBKnRc/q65PuEwViCo/0Q7qdak8CEUFAt/85ItZoI=; b=3fb42AISb+Yo5cLBhUZu5imkS2jTSAYQIQIlvbU3Mkk21Kt4QKsO63pJ1Ubd6GyHp3 C43GOrW6o7UHjYP5DZS9PyRI60gInzEDbD2HVRTBtAI4V0xeX32EKxPG4dkPsxDSjh4s XsAR1j+8y70UXXqV7CIJrEz92wlycGYKPbSh686Iu51NE33Lq2SQ7Z9Ti8PKNjm6b4Pw 83uwqSMRA/moVFi1F278QhNObbUNSJ3jjguMgPnBD8CK5OuW1ZFCkEn/zhgs0JR8p4Kp ItHY2frDA1zwCpKFoYxR3uza+Sb+AtFtmCfEuL00peoLqdFb0tP04Xyfgpwjop+7Jn9G st9w== X-Gm-Message-State: AOAM532ZqnsJDeksdYbIyY8I1b6jNDNIuzwlP8fxWkgCTifhsyIvnKFu bLpgiL2d1JDeKO8feHv77G3j/GYVZggZvQ== X-Google-Smtp-Source: ABdhPJwP+aPJk4nDZM5Fl8akJ0cNzr1qH9bismp95qMTEd00kRow6qPxtlb7eGdkfMMUMlkCFbi8tg== X-Received: by 2002:ac8:5bc1:: with SMTP id b1mr27230541qtb.495.1643913937468; Thu, 03 Feb 2022 10:45:37 -0800 (PST) Received: from localhost.localdomain ([151.200.235.219]) by smtp.gmail.com with ESMTPSA id f16sm5947887qtk.8.2022.02.03.10.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 10:45:36 -0800 (PST) From: Scott Theisen To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Feb 2022 13:44:47 -0500 Message-Id: <20220203184450.5491-11-scott.the.elm@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220203184450.5491-1-scott.the.elm@gmail.com> References: <20220201212056.29712-1-scott.the.elm@gmail.com> <20220203184450.5491-1-scott.the.elm@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 10/13] cbs_mpeg2.c: use a while loop with a loop condition instead of an infinite loop X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Scott Theisen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This enhances the clarity of the code. --- libavcodec/cbs_mpeg2.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index d41477620e..afe78eef9a 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -148,7 +148,7 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamUnitType unit_type; uint32_t start_code = -1; size_t unit_size; - int err, i, final = 0; + int err, i = 0, final = 0; start = avpriv_find_start_code(frag->data, frag->data + frag->data_size, &start_code, 1); @@ -157,7 +157,7 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx, return AVERROR_INVALIDDATA; } - for (i = 0;; i++) { + while (!final) { unit_type = start_code & 0xff; if (start == frag->data + frag->data_size) { @@ -190,10 +190,8 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx, if (err < 0) return err; - if (final) - break; - start = end; + i++; } return 0; -- 2.32.0 _______________________________________________ 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".