* [Patch] OvmfPkg BasePciCapLib: Fix VS build failure
@ 2018-05-29 5:04 Liming Gao
2018-05-29 8:39 ` Laszlo Ersek
0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2018-05-29 5:04 UTC (permalink / raw)
To: edk2-devel; +Cc: Laszlo Ersek
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] OvmfPkg BasePciCapLib: Fix VS build failure
2018-05-29 5:04 [Patch] OvmfPkg BasePciCapLib: Fix VS build failure Liming Gao
@ 2018-05-29 8:39 ` Laszlo Ersek
0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2018-05-29 8:39 UTC (permalink / raw)
To: Liming Gao; +Cc: 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-29 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-29 5:04 [Patch] OvmfPkg BasePciCapLib: Fix VS build failure Liming Gao
2018-05-29 8:39 ` Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox