OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Fix VS warning C4244: 'function': conversion from 'UINT32' to 'UINT16',
possible loss of data.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
---
OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
index c059264..54e7409 100644
--- a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
+++ b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
@@ -613,8 +613,8 @@ PciCapListInit (
}
Status = InsertPciCap (OutCapList, CapHdrOffsets, PciCapExtended,
- ExtendedCapHdr.CapabilityId, ExtendedCapHdrOffset,
- ExtendedCapHdr.CapabilityVersion);
+ (UINT16) ExtendedCapHdr.CapabilityId, ExtendedCapHdrOffset,
+ (UINT8) ExtendedCapHdr.CapabilityVersion);
if (RETURN_ERROR (Status)) {
goto FreeCapHdrOffsets;
}
--
2.8.0.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
On 05/29/18 07:04, Liming Gao wrote:
> Fix VS warning C4244: 'function': conversion from 'UINT32' to 'UINT16',
> possible loss of data.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
> OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
> index c059264..54e7409 100644
> --- a/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
> +++ b/OvmfPkg/Library/BasePciCapLib/BasePciCapLib.c
> @@ -613,8 +613,8 @@ PciCapListInit (
> }
>
> Status = InsertPciCap (OutCapList, CapHdrOffsets, PciCapExtended,
> - ExtendedCapHdr.CapabilityId, ExtendedCapHdrOffset,
> - ExtendedCapHdr.CapabilityVersion);
> + (UINT16) ExtendedCapHdr.CapabilityId, ExtendedCapHdrOffset,
> + (UINT8) ExtendedCapHdr.CapabilityVersion);
> if (RETURN_ERROR (Status)) {
> goto FreeCapHdrOffsets;
> }
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Before pushing, I removed the whitespace right after the casts -- in the
past, we've had problems due to such whitespace; it caused confusion
about operator binding strength. Typecast is one of the most strongly
binding operators, so I find the space after it counter-intuitive.
I also ran some basic regression-tests before pushing the patch.
Commit 2d0c6692eee4.
Thanks for the patch!
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.