From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-x235.google.com (mail-yb0-x235.google.com [IPv6:2607:f8b0:4002:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 014021A1E3A for ; Mon, 24 Oct 2016 00:58:47 -0700 (PDT) Received: by mail-yb0-x235.google.com with SMTP id g68so69108109ybi.0 for ; Mon, 24 Oct 2016 00:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qbpR7cK+eQ1Gtoz4sDIVhhOMzO4bo8Q/pIwy2eR62XY=; b=BoIvRevvjsj1POhrCAWWaEdXfa5WNGf32DBAaqRxpbWuMoMIECjwsW4FO4KwlQ6cJ9 rC0FfX+Nj6Q3WM7Em4/IaeXk2ZV2zgpOkj/tNTQsoCV+2EBVGwA3Ux0YzORrzaf5B08P j643b2i+VJMdlyciAV+O2OqQj+Ans4lO06kFg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qbpR7cK+eQ1Gtoz4sDIVhhOMzO4bo8Q/pIwy2eR62XY=; b=Z3hbFo9dA4UQcJl86H2ZeXPH9Z/xVu7fYOoQdXnvYp837q1+izhyrreu4cK/Wh2wlD 5wXET2b/LGNLblwRF2qCCBfZyRxIROZ+q+NVEFBQVlXfWa/nqZCUdL/MlMN98dBAv2QP 3elmhQs9D1hh54yHg1poAp+GeiYu/myDr0LWbdWjnVvT/3/xOmru6LnVFmBx4DI2VYbA 4zbArLfGv5IlHqX0ZdanQqoukTGXMR+XORDaNC65u4gOwXswLoW4qGKkSWeRqI67odwV wYzqs21LZUpu2p3uCtxpp3FjVcCa5SQRUcP5bgG+RC2uL6+/WNped0zpd5oW63i8Dxwa SW1g== X-Gm-Message-State: ABUngvfAhNhYZ+Ea7PRvF+fO8UICAZSAszxBtARNdQ5QwF/e7aopDz/CKs3rLC+T3r+b4Wi2pyY3/1M3aC8w79Wq X-Received: by 10.36.107.72 with SMTP id v69mr1155277itc.37.1477295926981; Mon, 24 Oct 2016 00:58:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.5.139 with HTTP; Mon, 24 Oct 2016 00:58:46 -0700 (PDT) In-Reply-To: <20161021212737.15974-18-lersek@redhat.com> References: <20161021212737.15974-1-lersek@redhat.com> <20161021212737.15974-18-lersek@redhat.com> From: Ard Biesheuvel Date: Mon, 24 Oct 2016 08:58:46 +0100 Message-ID: To: Laszlo Ersek Cc: edk2-devel-01 , Leif Lindholm , Michael Zimmermann Subject: Re: [PATCH 17/19] ArmPkg/ArmDisassemblerLib: replace AsciiStrCat() with AsciiStrCatS() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 07:58:48 -0000 Content-Type: text/plain; charset=UTF-8 On 21 October 2016 at 22:27, Laszlo Ersek wrote: > AsciiStrCat() is deprecated / disabled under the > DISABLE_NEW_DEPRECATED_INTERFACES feature test macro. > > The "Str" variable serves no particular purpose in the MRegList() and > ThumbMRegList() functions; replace it with the pointed-to "mMregListStr" / > "mThumbMregListStr" global variable (as appropriate), so that the new > AsciiStrCatS() calls are as clear as possible. > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Cc: Michael Zimmermann > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=164 > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=165 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel > --- > > Notes: > - build-tested only > > - Michael (CC'd) had posted a patch earlier for this: > , > but I only noticed that now that he pointed it out, in > . > I'll leave it to the ArmPkg maintainers to choose one; I don't feel > strongly either way. > Apologies to Michael for ignoring his contribution, but I'd be happy for Laszlo to merge this as part of the series. > ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 22 +++++++++----------- > ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c | 20 ++++++++---------- > 2 files changed, 19 insertions(+), 23 deletions(-) > > diff --git a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > index 29a8d4438622..8551edc379c1 100644 > --- a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > +++ b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c > @@ -88,12 +88,10 @@ MRegList ( > ) > { > UINTN Index, Start, End; > - CHAR8 *Str; > BOOLEAN First; > > - Str = mMregListStr; > - *Str = '\0'; > - AsciiStrCat (Str, "{"); > + mMregListStr[0] = '\0'; > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, "{"); > for (Index = 0, First = TRUE; Index <= 15; Index++) { > if ((OpCode & (1 << Index)) != 0) { > Start = End = Index; > @@ -102,25 +100,25 @@ MRegList ( > } > > if (!First) { > - AsciiStrCat (Str, ","); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, ","); > } else { > First = FALSE; > } > > if (Start == End) { > - AsciiStrCat (Str, gReg[Start]); > - AsciiStrCat (Str, ", "); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[Start]); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, ", "); > } else { > - AsciiStrCat (Str, gReg[Start]); > - AsciiStrCat (Str, "-"); > - AsciiStrCat (Str, gReg[End]); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[Start]); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, "-"); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, gReg[End]); > } > } > } > if (First) { > - AsciiStrCat (Str, "ERROR"); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, "ERROR"); > } > - AsciiStrCat (Str, "}"); > + AsciiStrCatS (mMregListStr, sizeof mMregListStr, "}"); > > // BugBug: Make caller pass in buffer it is cleaner > return mMregListStr; > diff --git a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c > index 5bad3afcfbf6..86d5083cb189 100644 > --- a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c > +++ b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c > @@ -397,12 +397,10 @@ ThumbMRegList ( > ) > { > UINTN Index, Start, End; > - CHAR8 *Str; > BOOLEAN First; > > - Str = mThumbMregListStr; > - *Str = '\0'; > - AsciiStrCat (Str, "{"); > + mThumbMregListStr[0] = '\0'; > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "{"); > > for (Index = 0, First = TRUE; Index <= 15; Index++) { > if ((RegBitMask & (1 << Index)) != 0) { > @@ -412,24 +410,24 @@ ThumbMRegList ( > } > > if (!First) { > - AsciiStrCat (Str, ","); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, ","); > } else { > First = FALSE; > } > > if (Start == End) { > - AsciiStrCat (Str, gReg[Start]); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[Start]); > } else { > - AsciiStrCat (Str, gReg[Start]); > - AsciiStrCat (Str, "-"); > - AsciiStrCat (Str, gReg[End]); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[Start]); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "-"); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, gReg[End]); > } > } > } > if (First) { > - AsciiStrCat (Str, "ERROR"); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "ERROR"); > } > - AsciiStrCat (Str, "}"); > + AsciiStrCatS (mThumbMregListStr, sizeof mThumbMregListStr, "}"); > > // BugBug: Make caller pass in buffer it is cleaner > return mThumbMregListStr; > -- > 2.9.2 > >