Kaydet (Commit) 9044260c authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

add some asserts to validate KeyCode values

Change-Id: I1b4b8d44f11086ed994a093fef0029982fac2c63
Reviewed-on: https://gerrit.libreoffice.org/12161Tested-by: 's avatarLibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 513956cf
...@@ -40,8 +40,7 @@ private: ...@@ -40,8 +40,7 @@ private:
public: public:
KeyCode() { nKeyCodeAndModifiers = 0; eFunc = KeyFuncType::DONTKNOW; } KeyCode() { nKeyCodeAndModifiers = 0; eFunc = KeyFuncType::DONTKNOW; }
KeyCode( const ResId& rResId ); KeyCode( const ResId& rResId );
KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 ) KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 );
{ nKeyCodeAndModifiers = nKey | nModifier; eFunc = KeyFuncType::DONTKNOW; }
KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 ); KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 );
KeyCode( KeyFuncType eFunction ); KeyCode( KeyFuncType eFunction );
...@@ -78,8 +77,17 @@ public: ...@@ -78,8 +77,17 @@ public:
} // namespace vcl } // namespace vcl
inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier )
{
assert(nKey <= KEY_CODE);
assert(nModifier >= KEY_MODTYPE);
nKeyCodeAndModifiers = nKey | nModifier;
eFunc = KeyFuncType::DONTKNOW;
}
inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 ) inline vcl::KeyCode::KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 )
{ {
assert(nKey <= KEY_CODE);
nKeyCodeAndModifiers = nKey; nKeyCodeAndModifiers = nKey;
if( bShift ) if( bShift )
nKeyCodeAndModifiers |= KEY_SHIFT; nKeyCodeAndModifiers |= KEY_SHIFT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment