Bug 821628 - xptcstubs_x86_64_darwin is wrongly converting some bool params
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 20 Dec 2012 23:44:40 +0100
changeset 122301 2a2087aaedc55363913a4a337ea9db69e695bf88
parent 122300 9901508358d30b50228ce35fce2992186b754915
child 122302 5356d4e7814c557882af1dd8453bb836ae084dc9
push idunknown
push userunknown
push dateunknown
bugs821628
milestone20.0a1
Bug 821628 - xptcstubs_x86_64_darwin is wrongly converting some bool params r=bsmedberg
xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_darwin.cpp
xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_darwin.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_darwin.cpp
@@ -103,17 +103,18 @@ PrepareAndDispatch(nsXPTCStubBase * self
         case nsXPTType::T_I8:      dp->val.i8  = (int8_t)   value; break;
         case nsXPTType::T_I16:     dp->val.i16 = (int16_t)  value; break;
         case nsXPTType::T_I32:     dp->val.i32 = (int32_t)  value; break;
         case nsXPTType::T_I64:     dp->val.i64 = (int64_t)  value; break;
         case nsXPTType::T_U8:      dp->val.u8  = (uint8_t)  value; break;
         case nsXPTType::T_U16:     dp->val.u16 = (uint16_t) value; break;
         case nsXPTType::T_U32:     dp->val.u32 = (uint32_t) value; break;
         case nsXPTType::T_U64:     dp->val.u64 = (uint64_t) value; break;
-        case nsXPTType::T_BOOL:    dp->val.b   = (bool)   value; break;
+        // Cast to uint8_t first, to remove garbage on upper 56 bits.
+        case nsXPTType::T_BOOL:    dp->val.b   = (bool)(uint8_t)   value; break;
         case nsXPTType::T_CHAR:    dp->val.c   = (char)     value; break;
         case nsXPTType::T_WCHAR:   dp->val.wc  = (wchar_t)  value; break;
 
         default:
             NS_ERROR("bad type");
             break;
         }
     }
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
@@ -103,17 +103,18 @@ PrepareAndDispatch(nsXPTCStubBase * self
         case nsXPTType::T_I8:      dp->val.i8  = (int8_t)   value; break;
         case nsXPTType::T_I16:     dp->val.i16 = (int16_t)  value; break;
         case nsXPTType::T_I32:     dp->val.i32 = (int32_t)  value; break;
         case nsXPTType::T_I64:     dp->val.i64 = (int64_t)  value; break;
         case nsXPTType::T_U8:      dp->val.u8  = (uint8_t)  value; break;
         case nsXPTType::T_U16:     dp->val.u16 = (uint16_t) value; break;
         case nsXPTType::T_U32:     dp->val.u32 = (uint32_t) value; break;
         case nsXPTType::T_U64:     dp->val.u64 = (uint64_t) value; break;
-        case nsXPTType::T_BOOL:    dp->val.b   = (bool)   value; break;
+        // Cast to uint8_t first, to remove garbage on upper 56 bits.
+        case nsXPTType::T_BOOL:    dp->val.b   = (bool)(uint8_t)   value; break;
         case nsXPTType::T_CHAR:    dp->val.c   = (char)     value; break;
         case nsXPTType::T_WCHAR:   dp->val.wc  = (wchar_t)  value; break;
 
         default:
             NS_ERROR("bad type");
             break;
         }
     }
--- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp
+++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp
@@ -103,17 +103,18 @@ PrepareAndDispatch(nsXPTCStubBase * self
         case nsXPTType::T_I8:      dp->val.i8  = (int8_t)   value; break;
         case nsXPTType::T_I16:     dp->val.i16 = (int16_t)  value; break;
         case nsXPTType::T_I32:     dp->val.i32 = (int32_t)  value; break;
         case nsXPTType::T_I64:     dp->val.i64 = (int64_t)  value; break;
         case nsXPTType::T_U8:      dp->val.u8  = (uint8_t)  value; break;
         case nsXPTType::T_U16:     dp->val.u16 = (uint16_t) value; break;
         case nsXPTType::T_U32:     dp->val.u32 = (uint32_t) value; break;
         case nsXPTType::T_U64:     dp->val.u64 = (uint64_t) value; break;
-        case nsXPTType::T_BOOL:    dp->val.b   = (bool)   value; break;
+        // Cast to uint8_t first, to remove garbage on upper 56 bits.
+        case nsXPTType::T_BOOL:    dp->val.b   = (bool)(uint8_t)   value; break;
         case nsXPTType::T_CHAR:    dp->val.c   = (char)     value; break;
         case nsXPTType::T_WCHAR:   dp->val.wc  = (wchar_t)  value; break;
 
         default:
             NS_ERROR("bad type");
             break;
         }
     }