diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-01-16 15:41:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-01-16 15:41:23 +0000 |
commit | 9eda1ec830413271cce82a3115b66d05ea00c91f (patch) | |
tree | 90c6c808ce8721cb90651d91dd6e919f29b59b83 /stoc | |
parent | drop two arg one from this test, because it has different semantics (diff) | |
download | core-9eda1ec830413271cce82a3115b66d05ea00c91f.tar.gz core-9eda1ec830413271cce82a3115b66d05ea00c91f.zip |
equalsAsciiL faster than equals
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/security/file_policy.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 5755defd7739..ce1a525e659f 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -434,16 +434,16 @@ PolicyReader::~PolicyReader() } } -static OUString s_grant = OUSTR("grant"); -static OUString s_user = OUSTR("user"); -static OUString s_permission = OUSTR("permission"); -static OUString s_openBrace = OUSTR("{"); -static OUString s_closingBrace = OUSTR("}"); +#define s_grant "grant" +#define s_user "user" +#define s_permission "permission" +#define s_openBrace "{" +#define s_closingBrace "}" -static OUString s_filePermission = OUSTR("com.sun.star.io.FilePermission"); -static OUString s_socketPermission = OUSTR("com.sun.star.connection.SocketPermission"); -static OUString s_runtimePermission = OUSTR("com.sun.star.security.RuntimePermission"); -static OUString s_allPermission = OUSTR("com.sun.star.security.AllPermission"); +#define s_filePermission "com.sun.star.io.FilePermission" +#define s_socketPermission "com.sun.star.connection.SocketPermission" +#define s_runtimePermission "com.sun.star.security.RuntimePermission" +#define s_allPermission "com.sun.star.security.AllPermission" //__________________________________________________________________________________________________ void FilePolicy::refresh() @@ -469,46 +469,46 @@ void FilePolicy::refresh() OUString token( reader.getToken() ); while (token.getLength()) { - if (! token.equals( s_grant )) + if (!token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_grant))) reader.error( OUSTR("expected >grant< token!") ); OUString userId; token = reader.assureToken(); - if (token.equals( s_user )) // next token is user-id + if (token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_user))) // next token is user-id { userId = reader.assureQuotedToken(); token = reader.assureToken(); } - if (! token.equals( s_openBrace )) + if (!token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_openBrace))) reader.error( OUSTR("expected opening brace >{<!") ); token = reader.assureToken(); // permissions list - while (! token.equals( s_closingBrace )) + while (!token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_closingBrace))) { - if (! token.equals( s_permission )) + if (!token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_permission))) reader.error( OUSTR("expected >permission< or closing brace >}<!") ); token = reader.assureToken(); // permission type Any perm; - if (token.equals( s_filePermission )) // FilePermission + if (token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_filePermission))) // FilePermission { OUString url( reader.assureQuotedToken() ); reader.assureToken( ',' ); OUString actions( reader.assureQuotedToken() ); perm <<= io::FilePermission( url, actions ); } - else if (token.equals( s_socketPermission )) // SocketPermission + else if (token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_socketPermission))) // SocketPermission { OUString host( reader.assureQuotedToken() ); reader.assureToken( ',' ); OUString actions( reader.assureQuotedToken() ); perm <<= connection::SocketPermission( host, actions ); } - else if (token.equals( s_runtimePermission )) // RuntimePermission + else if (token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_runtimePermission))) // RuntimePermission { OUString name( reader.assureQuotedToken() ); perm <<= security::RuntimePermission( name ); } - else if (token.equals( s_allPermission )) // AllPermission + else if (token.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_allPermission))) // AllPermission { perm <<= security::AllPermission(); } |