]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: BaseOrderedCollectionRedBlackTreeLib: silence invalid VS2005 warnings
authorLaszlo Ersek <lersek@redhat.com>
Sat, 16 Aug 2014 16:18:59 +0000 (16:18 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 16 Aug 2014 16:18:59 +0000 (16:18 +0000)
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 <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15813 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c

index 9f40b70ff5516674d8df82d92598dc6e9f0b11d4..b37caf239aa589092c7842fd337bbb7ec968433f 100644 (file)
@@ -148,7 +148,7 @@ OrderedCollectionIsEmpty (
   IN CONST RED_BLACK_TREE *Tree\r
   )\r
 {\r
-  return Tree->Root == NULL;\r
+  return (BOOLEAN)(Tree->Root == NULL);\r
 }\r
 \r
 \r
@@ -838,7 +838,7 @@ NodeIsNullOrBlack (
   IN CONST RED_BLACK_TREE_NODE *Node\r
   )\r
 {\r
-  return Node == NULL || Node->Color == RedBlackTreeBlack;\r
+  return (BOOLEAN)(Node == NULL || Node->Color == RedBlackTreeBlack);\r
 }\r
 \r
 \r