diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-06-16 10:35:22 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-06-16 10:35:22 +0000 |
commit | a3d187bfde40bb048767d162b849b3f723ffbd69 (patch) | |
tree | b3adf14f3f8b37cb57f13aade5461dad2c85e687 /vcl/source | |
parent | cc6fdbdd42103f465fb642764144a611a83f30ff (diff) |
INTEGRATION: CWS rcregression01 (1.10.10); FILE MERGED
2003/06/12 10:59:15 ssa 1.10.10.1: #110212#,#110219# check nIndex before accessing rKey
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/mnemonic.cxx | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 14310febeb6d..2f55578ed328 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mnemonic.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: vg $ $Date: 2003-06-04 11:22:56 $ + * last change: $Author: hr $ $Date: 2003-06-16 11:35:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -308,20 +308,29 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) aStr += c; aStr += ')'; nIndex = rKey.Len(); - static sal_Unicode cGreaterGreater[] = { 0xFF1E, 0xFF1E }; - if ( rKey.EqualsAscii( ">>", nIndex-2, 2 ) || - rKey.Equals( cGreaterGreater, nIndex-2, 2 ) ) - nIndex -= 2; - static sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E }; - if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) || - rKey.Equals( cDotDotDot, nIndex-3, 3 ) ) - nIndex -= 3; - sal_Unicode cLastChar = rKey.GetChar( nIndex-1 ); - if ( (cLastChar == ':') || (cLastChar == 0xFF1A) || - (cLastChar == '.') || (cLastChar == 0xFF0E) || - (cLastChar == '?') || (cLastChar == 0xFF1F) || - (cLastChar == ' ') ) - nIndex--; + if( nIndex >= 2 ) + { + static sal_Unicode cGreaterGreater[] = { 0xFF1E, 0xFF1E }; + if ( rKey.EqualsAscii( ">>", nIndex-2, 2 ) || + rKey.Equals( cGreaterGreater, nIndex-2, 2 ) ) + nIndex -= 2; + } + if( nIndex >= 3 ) + { + static sal_Unicode cDotDotDot[] = { 0xFF0E, 0xFF0E, 0xFF0E }; + if ( rKey.EqualsAscii( "...", nIndex-3, 3 ) || + rKey.Equals( cDotDotDot, nIndex-3, 3 ) ) + nIndex -= 3; + } + if( nIndex >= 1) + { + sal_Unicode cLastChar = rKey.GetChar( nIndex-1 ); + if ( (cLastChar == ':') || (cLastChar == 0xFF1A) || + (cLastChar == '.') || (cLastChar == 0xFF0E) || + (cLastChar == '?') || (cLastChar == 0xFF1F) || + (cLastChar == ' ') ) + nIndex--; + } rKey.Insert( aStr, nIndex ); bChanged = TRUE; break; |