render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame 0031-BaseTools-fix-gcc12-warning.patch

Gerd Hoffmann e3d786
From c537b93adc2dc2243c6e53dfbbe8cd10fb073b7a Mon Sep 17 00:00:00 2001
Gerd Hoffmann e3d786
From: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann e3d786
Date: Mon, 24 Jan 2022 11:04:55 +0100
Gerd Hoffmann e3d786
Subject: [PATCH 31/32] BaseTools: fix gcc12 warning
Gerd Hoffmann e3d786
MIME-Version: 1.0
Gerd Hoffmann e3d786
Content-Type: text/plain; charset=UTF-8
Gerd Hoffmann e3d786
Content-Transfer-Encoding: 8bit
Gerd Hoffmann e3d786
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c: In function ‘LzmaEnc_CodeOneMemBlock’:
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*p.rc.outStream’ [-Werror=dangling-pointer=]
Gerd Hoffmann e3d786
 2828 |   p->rc.outStream = &outStream.vt;
Gerd Hoffmann e3d786
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
Gerd Hoffmann e3d786
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
Gerd Hoffmann e3d786
      |                            ^~~~~~~~~
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*(CLzmaEnc *)pp.rc.outStream’ [-Werror=dangling-pointer=]
Gerd Hoffmann e3d786
 2828 |   p->rc.outStream = &outStream.vt;
Gerd Hoffmann e3d786
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
Gerd Hoffmann e3d786
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
Gerd Hoffmann e3d786
      |                            ^~~~~~~~~
Gerd Hoffmann e3d786
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
Gerd Hoffmann e3d786
cc1: all warnings being treated as errors
Gerd Hoffmann e3d786
Gerd Hoffmann e3d786
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann e3d786
---
Gerd Hoffmann e3d786
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++-
Gerd Hoffmann e3d786
 1 file changed, 2 insertions(+), 1 deletion(-)
Gerd Hoffmann e3d786
Gerd Hoffmann e3d786
diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
Gerd Hoffmann e3d786
index 4e9b499f8d80..4b9f5fa69248 100644
Gerd Hoffmann e3d786
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
Gerd Hoffmann e3d786
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
Gerd Hoffmann e3d786
@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
Gerd Hoffmann e3d786
 
Gerd Hoffmann e3d786
   nowPos64 = p->nowPos64;
Gerd Hoffmann e3d786
   RangeEnc_Init(&p->rc);
Gerd Hoffmann e3d786
-  p->rc.outStream = &outStream.vt;
Gerd Hoffmann e3d786
 
Gerd Hoffmann e3d786
   if (desiredPackSize == 0)
Gerd Hoffmann e3d786
     return SZ_ERROR_OUTPUT_EOF;
Gerd Hoffmann e3d786
 
Gerd Hoffmann e3d786
+  p->rc.outStream = &outStream.vt;
Gerd Hoffmann e3d786
   res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
Gerd Hoffmann e3d786
+  p->rc.outStream = NULL;
Gerd Hoffmann e3d786
 
Gerd Hoffmann e3d786
   *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
Gerd Hoffmann e3d786
   *destLen -= outStream.rem;
Gerd Hoffmann e3d786
-- 
Gerd Hoffmann e3d786
2.35.1
Gerd Hoffmann e3d786