Initialize the array DescriptorLBAs[] after declaration to fix
non-constant aggregate initializer warning in VS tool chains.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
index c1d4480..3174ab2 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
@@ -46,15 +46,22 @@ FindAnchorVolumeDescriptorPointer (
IN EFI_DISK_IO_PROTOCOL *DiskIo,
OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint
)
{
EFI_STATUS Status;
- UINT32 BlockSize = BlockIo->Media->BlockSize;
- EFI_LBA EndLBA = BlockIo->Media->LastBlock;
- EFI_LBA DescriptorLBAs[] = { 256, EndLBA - 256, EndLBA, 512 };
+ UINT32 BlockSize;
+ EFI_LBA EndLBA;
+ EFI_LBA DescriptorLBAs[4];
UINTN Index;
+ BlockSize = BlockIo->Media->BlockSize;
+ EndLBA = BlockIo->Media->LastBlock;
+ DescriptorLBAs[0] = 256;
+ DescriptorLBAs[1] = EndLBA - 256;
+ DescriptorLBAs[2] = EndLBA;
+ DescriptorLBAs[3] = 512;
+
for (Index = 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) {
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 (DescriptorLBAs[Index], BlockSize),
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Thanks/Ray
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Dandan Bi
> Sent: Tuesday, September 12, 2017 4:56 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v3 3/3] MdeModulePkg/PartitionDxe: Initialize the
> array after declaration
>
> Initialize the array DescriptorLBAs[] after declaration to fix non-constant
> aggregate initializer warning in VS tool chains.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Paulo Alcantara <pcacjr@zytor.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
> MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
> b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
> index c1d4480..3174ab2 100644
> --- a/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
> +++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
> @@ -46,15 +46,22 @@ FindAnchorVolumeDescriptorPointer (
> IN EFI_DISK_IO_PROTOCOL *DiskIo,
> OUT UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER *AnchorPoint
> )
> {
> EFI_STATUS Status;
> - UINT32 BlockSize = BlockIo->Media->BlockSize;
> - EFI_LBA EndLBA = BlockIo->Media->LastBlock;
> - EFI_LBA DescriptorLBAs[] = { 256, EndLBA - 256, EndLBA, 512 };
> + UINT32 BlockSize;
> + EFI_LBA EndLBA;
> + EFI_LBA DescriptorLBAs[4];
> UINTN Index;
>
> + BlockSize = BlockIo->Media->BlockSize; EndLBA =
> + BlockIo->Media->LastBlock; DescriptorLBAs[0] = 256;
> + DescriptorLBAs[1] = EndLBA - 256; DescriptorLBAs[2] = EndLBA;
> + DescriptorLBAs[3] = 512;
> +
> for (Index = 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) {
> Status = DiskIo->ReadDisk (
> DiskIo,
> BlockIo->Media->MediaId,
> MultU64x32 (DescriptorLBAs[Index], BlockSize),
> --
> 1.9.5.msysgit.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.