From fd91ff3ee92149ed9087f4d4351cc40102b00803 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Sat, 22 Dec 2012 00:07:08 +0900 Subject: [PATCH] Bug 823369 Check mozilla::widget::EventFlags size at compile time r=smaug --- widget/nsGUIEvent.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index e123b1ff4354..2f85f4714606 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -564,13 +564,17 @@ public: } private: - inline void SetRawFlags(uint32_t aRawFlags) + typedef uint32_t RawFlags; + + inline void SetRawFlags(RawFlags aRawFlags) { + MOZ_STATIC_ASSERT(sizeof(EventFlags) <= sizeof(RawFlags), + "mozilla::widget::EventFlags must not be bigger than the RawFlags"); memcpy(this, &aRawFlags, sizeof(EventFlags)); } - inline uint32_t GetRawFlags() const + inline RawFlags GetRawFlags() const { - uint32_t result = 0; + RawFlags result = 0; memcpy(&result, this, sizeof(EventFlags)); return result; }