diff options
author | Martin Gallwey <mtg@openoffice.org> | 2001-09-14 13:41:39 +0000 |
---|---|---|
committer | Martin Gallwey <mtg@openoffice.org> | 2001-09-14 13:41:39 +0000 |
commit | c476f31d3b5789155924e7818ad1505cb728d22e (patch) | |
tree | 99f9a07d90ea5af7913e1d47ade73420e341936d /package/inc | |
parent | 465c97902200aca64a25773c6a365a7b4df1c23b (diff) |
#89303# Avoid calling ImplValidChars in a loop by putting the loop in the function
Diffstat (limited to 'package/inc')
-rw-r--r-- | package/inc/ImplValidCharacters.hxx | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/package/inc/ImplValidCharacters.hxx b/package/inc/ImplValidCharacters.hxx index 7520de7fc34c..96d6395403bf 100644 --- a/package/inc/ImplValidCharacters.hxx +++ b/package/inc/ImplValidCharacters.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ImplValidCharacters.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mtg $ $Date: 2001-07-04 14:56:13 $ + * last change: $Author: mtg $ $Date: 2001-09-14 14:41:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,29 +65,30 @@ #include <sal/types.h> #endif -static sal_Bool Impl_IsValidChar ( sal_Unicode aChar, sal_Bool bSlashAllowed ) +static sal_Bool Impl_IsValidChar ( const sal_Unicode *pChar, sal_Int16 nLength, sal_Bool bSlashAllowed ) { - sal_Bool bReturn = sal_True; - - switch ( aChar ) + for ( sal_Int16 i = 0 ; i < nLength ; i++ ) { - case '\\': - case '?': - case '<': - case '>': - case '\"': - case '|': - case ':': - bReturn = sal_False; - break; - case '/': - bReturn = bSlashAllowed; - break; - default: - if ( aChar < 32 || aChar > 127 ) - bReturn = sal_False; - break; + switch ( pChar[i] ) + { + case '\\': + case '?': + case '<': + case '>': + case '\"': + case '|': + case ':': + return sal_False; + break; + case '/': + if ( !bSlashAllowed ) + return sal_False; + break; + default: + if ( pChar[i] < 32 || pChar[i] > 127 ) + return sal_False; + } } - return bReturn; + return sal_True; } #endif |