VS2005 reports the following build failure:
BaseOrderedCollectionRedBlackTreeLib.c(151) : warning C4244:
'return' : conversion from 'int' to 'BOOLEAN', possible loss of data
BaseOrderedCollectionRedBlackTreeLib.c(840) : warning C4244:
'return' : conversion from 'int' to 'BOOLEAN', possible loss of data
This is incorrect. The ISO C standard guarantees that the expressions in
question can only return values 0 and 1, both of which can be represented
by BOOLEAN (== UINT8, == unsigned char).
Silence the incorrect warnings with explicit casts to BOOLEAN.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
---
.../BaseOrderedCollectionRedBlackTreeLib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
index 9f40b70..b37caf2 100644
---
a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
+++
b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
@@ -148,7 +148,7 @@ OrderedCollectionIsEmpty (
IN CONST RED_BLACK_TREE *Tree
)
{
- return Tree->Root == NULL;
+ return (BOOLEAN)(Tree->Root == NULL);
}
@@ -838,7 +838,7 @@ NodeIsNullOrBlack (
IN CONST RED_BLACK_TREE_NODE *Node
)
{
- return Node == NULL || Node->Color == RedBlackTreeBlack;
+ return (BOOLEAN)(Node == NULL || Node->Color == RedBlackTreeBlack);
}
--
1.8.3.1
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel