diff options
author | Jean-Noël Rouvignac <jn.rouvignac@gmail.com> | 2013-01-30 11:44:23 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-01-30 12:54:40 +0000 |
commit | 97eb8a6e0eb830f37dcba64a51d725aab4c5ff53 (patch) | |
tree | a1a95b8249052d846a997ad1729758168d6a3b24 /stoc/source/security | |
parent | f8569cd9a28a3a8856dba4ad53218aa6cc073521 (diff) |
Removed several useless macros: A2OU, A2S, C2U, C2S, OUSTR, OUSTRING
Change-Id: Ie859cb2dfdc7103c379fce56be88eef8fe390afd
Reviewed-on: https://gerrit.libreoffice.org/1924
Tested-by: Luboš Luňák <l.lunak@suse.cz>
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Diffstat (limited to 'stoc/source/security')
-rw-r--r-- | stoc/source/security/access_controller.cxx | 35 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 29 | ||||
-rw-r--r-- | stoc/source/security/permissions.cxx | 6 |
3 files changed, 33 insertions, 37 deletions
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 09ffc70cfb32..987d6ec6c57f 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -50,7 +50,6 @@ #include "bootstrapservices.hxx" -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) #define SERVICE_NAME "com.sun.star.security.AccessController" #define IMPL_NAME "com.sun.star.security.comp.stoc.AccessController" #define USER_CREDS "access-control.user-credentials" @@ -70,7 +69,7 @@ extern ::rtl_StandardModuleCount g_moduleCount; namespace stoc_sec { // static stuff initialized when loading lib -static OUString s_envType = OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME); +static OUString s_envType = CPPU_CURRENT_LANGUAGE_BINDING_NAME; const char s_acRestriction[] = "access-control.restriction"; //################################################################################################## @@ -477,7 +476,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp // to something other than "off" depending on various UNO_AC* bootstrap // variables that are no longer supported, so this is mostly dead code now: OUString mode; - if (m_xComponentContext->getValueByName( OUSTR("/services/" SERVICE_NAME "/mode") ) >>= mode) + if (m_xComponentContext->getValueByName( "/services/" SERVICE_NAME "/mode" ) >>= mode) { if ( mode == "off" ) { @@ -494,12 +493,12 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp else if ( mode == "single-user" ) { m_xComponentContext->getValueByName( - OUSTR("/services/" SERVICE_NAME "/single-user-id") ) >>= m_singleUserId; + "/services/" SERVICE_NAME "/single-user-id" ) >>= m_singleUserId; if (m_singleUserId.isEmpty()) { throw RuntimeException( - OUSTR("expected a user id in component context entry " - "\"/services/" SERVICE_NAME "/single-user-id\"!"), + "expected a user id in component context entry " + "\"/services/" SERVICE_NAME "/single-user-id\"!", (OWeakObject *)this ); } m_mode = SINGLE_USER; @@ -515,7 +514,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp { sal_Int32 cacheSize = 0; // multi-user cache size if (! (m_xComponentContext->getValueByName( - OUSTR("/services/" SERVICE_NAME "/user-cache-size") ) >>= cacheSize)) + "/services/" SERVICE_NAME "/user-cache-size" ) >>= cacheSize)) { cacheSize = 128; // reasonable default? } @@ -550,14 +549,14 @@ void AccessController::initialize( if (SINGLE_USER != m_mode) // only if in single-user mode { throw RuntimeException( - OUSTR("invalid call: ac must be in \"single-user\" mode!"), (OWeakObject *)this ); + "invalid call: ac must be in \"single-user\" mode!", (OWeakObject *)this ); } OUString userId; arguments[ 0 ] >>= userId; if ( userId.isEmpty() ) { throw RuntimeException( - OUSTR("expected a user-id as first argument!"), (OWeakObject *)this ); + "expected a user-id as first argument!", (OWeakObject *)this ); } // assured that no sync is necessary: no check happens at this forking time m_singleUserId = userId; @@ -573,7 +572,7 @@ Reference< security::XPolicy > const & AccessController::getPolicy() { Reference< security::XPolicy > xPolicy; m_xComponentContext->getValueByName( - OUSTR("/singletons/com.sun.star.security.thePolicy") ) >>= xPolicy; + "/singletons/com.sun.star.security.thePolicy" ) >>= xPolicy; if (xPolicy.is()) { MutexGuard guard( m_mutex ); @@ -585,7 +584,7 @@ Reference< security::XPolicy > const & AccessController::getPolicy() else { throw SecurityException( - OUSTR("cannot get policy singleton!"), (OWeakObject *)this ); + "cannot get policy singleton!", (OWeakObject *)this ); } } return m_xPolicy; @@ -719,12 +718,12 @@ PermissionCollection AccessController::getEffectivePermissions( { if (xContext.is()) { - xContext->getValueByName( OUSTR(USER_CREDS ".id") ) >>= userId; + xContext->getValueByName( USER_CREDS ".id" ) >>= userId; } if ( userId.isEmpty() ) { throw SecurityException( - OUSTR("cannot determine current user in multi-user ac!"), (OWeakObject *)this ); + "cannot determine current user in multi-user ac!", (OWeakObject *)this ); } // lookup policy for user @@ -880,7 +879,7 @@ void AccessController::checkPermission( if (rBHelper.bDisposed) { throw lang::DisposedException( - OUSTR("checkPermission() call on disposed AccessController!"), (OWeakObject *)this ); + "checkPermission() call on disposed AccessController!", (OWeakObject *)this ); } if (OFF == m_mode) @@ -910,7 +909,7 @@ Any AccessController::doRestricted( if (rBHelper.bDisposed) { throw lang::DisposedException( - OUSTR("doRestricted() call on disposed AccessController!"), (OWeakObject *)this ); + "doRestricted() call on disposed AccessController!", (OWeakObject *)this ); } if (OFF == m_mode) // optimize this way, because no dynamic check will be performed @@ -943,7 +942,7 @@ Any AccessController::doPrivileged( if (rBHelper.bDisposed) { throw lang::DisposedException( - OUSTR("doPrivileged() call on disposed AccessController!"), (OWeakObject *)this ); + "doPrivileged() call on disposed AccessController!", (OWeakObject *)this ); } if (OFF == m_mode) // no dynamic check will be performed @@ -978,7 +977,7 @@ Reference< security::XAccessControlContext > AccessController::getContext() if (rBHelper.bDisposed) { throw lang::DisposedException( - OUSTR("getContext() call on disposed AccessController!"), (OWeakObject *)this ); + "getContext() call on disposed AccessController!", (OWeakObject *)this ); } if (OFF == m_mode) // optimize this way, because no dynamic check will be performed @@ -1042,7 +1041,7 @@ Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(()) //-------------------------------------------------------------------------------------------------- OUString ac_getImplementationName() SAL_THROW(()) { - return OUSTR(IMPL_NAME); + return OUString(IMPL_NAME); } //-------------------------------------------------------------------------------------------------- Reference< XInterface > SAL_CALL filepolicy_create( diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index d7fa8c4899d6..c05bd884733c 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -40,7 +40,6 @@ #include "bootstrapservices.hxx" -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) #define SERVICE_NAME "com.sun.star.security.Policy" #define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy" @@ -236,7 +235,7 @@ OUString PolicyReader::assureQuotedToken() { OUString token( getQuotedToken() ); if (token.isEmpty()) - error( OUSTR("unexpected end of file!") ); + error( "unexpected end of file!" ); return token; } //__________________________________________________________________________________________________ @@ -247,7 +246,7 @@ OUString PolicyReader::getQuotedToken() OUStringBuffer buf( 32 ); sal_Unicode c = get(); if ('\"' != c) - error( OUSTR("expected quoting >\"< character!") ); + error( "expected quoting >\"< character!" ); c = get(); while ('\0' != c && '\"' != c) { @@ -262,7 +261,7 @@ OUString PolicyReader::assureToken() { OUString token( getToken() ); if ( token.isEmpty()) - error( OUSTR("unexpected end of file!") ); + error( "unexpected end of file!" ); return token; } //__________________________________________________________________________________________________ @@ -326,7 +325,7 @@ void PolicyReader::skipWhiteSpace() } else { - error( OUSTR("expected C/C++ like comment!") ); + error( "expected C/C++ like comment!" ); } } else if ('#' == c) // script like comment @@ -364,13 +363,13 @@ sal_Unicode PolicyReader::get() sal_Bool eof; oslFileError rc = ::osl_isEndOfFile( m_file, &eof ); if (osl_File_E_None != rc) - error( OUSTR("checking eof failed!") ); + error( "checking eof failed!" ); if (eof) return '\0'; rc = ::osl_readLine( m_file, reinterpret_cast< sal_Sequence ** >( &m_line ) ); if (osl_File_E_None != rc) - error( OUSTR("read line failed!") ); + error( "read line failed!" ); ++m_linepos; if (! m_line.getLength()) // empty line read { @@ -404,7 +403,7 @@ PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac ) , m_pos( 1 ) // force readline , m_back( '\0' ) { - ac.checkFilePermission( m_fileName, OUSTR("read") ); + ac.checkFilePermission( m_fileName, "read" ); if (osl_File_E_None != ::osl_openFile( m_fileName.pData, &m_file, osl_File_OpenFlag_Read )) { OUStringBuffer buf( 32 ); @@ -444,11 +443,11 @@ void FilePolicy::refresh() // supported, so this is effectively dead code): OUString fileName; m_xComponentContext->getValueByName( - OUSTR("/implementations/" IMPL_NAME "/file-name") ) >>= fileName; + "/implementations/" IMPL_NAME "/file-name" ) >>= fileName; if ( fileName.isEmpty() ) { throw RuntimeException( - OUSTR("name of policy file unknown!"), + "name of policy file unknown!", (OWeakObject *)this ); } @@ -462,7 +461,7 @@ void FilePolicy::refresh() while (!token.isEmpty()) { if ( token != s_grant ) - reader.error( OUSTR("expected >grant< token!") ); + reader.error( "expected >grant< token!" ); OUString userId; token = reader.assureToken(); if ( token == s_user ) // next token is user-id @@ -471,13 +470,13 @@ void FilePolicy::refresh() token = reader.assureToken(); } if ( token != s_openBrace ) - reader.error( OUSTR("expected opening brace >{<!") ); + reader.error( "expected opening brace >{<!" ); token = reader.assureToken(); // permissions list while ( token != s_closingBrace ) { if ( token != s_permission ) - reader.error( OUSTR("expected >permission< or closing brace >}<!") ); + reader.error( "expected >permission< or closing brace >}<!" ); token = reader.assureToken(); // permission type Any perm; @@ -506,7 +505,7 @@ void FilePolicy::refresh() } else { - reader.error( OUSTR("expected permission type!") ); + reader.error( "expected permission type!" ); } reader.assureToken( ';' ); @@ -588,7 +587,7 @@ Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(()) //-------------------------------------------------------------------------------------------------- OUString filepolicy_getImplementationName() SAL_THROW(()) { - return OUSTR(IMPL_NAME); + return OUString(IMPL_NAME); } } diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index 704158b3e1d8..e97e379ef56a 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -35,8 +35,6 @@ #include "permissions.h" -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - using namespace ::std; using namespace ::osl; @@ -353,7 +351,7 @@ FilePermission::FilePermission( // correct win drive letters if (9 < m_url.getLength() && '|' == m_url[ 9 ]) // file:///X| { - static OUString s_colon = OUSTR(":"); + static OUString s_colon = ":"; // common case in API is a ':' (sal), so convert '|' to ':' m_url = m_url.replaceAt( 9, 1, s_colon ); } @@ -483,7 +481,7 @@ bool AllPermission::implies( Permission const & ) const SAL_THROW(()) //__________________________________________________________________________________________________ OUString AllPermission::toString() const SAL_THROW(()) { - return OUSTR("com.sun.star.security.AllPermission"); + return OUString("com.sun.star.security.AllPermission"); } //################################################################################################## |