diff options
Diffstat (limited to 'sal')
31 files changed, 207 insertions, 11 deletions
diff --git a/sal/osl/all/utility.cxx b/sal/osl/all/utility.cxx index 5f157c120b2d..76bdc4cd26ed 100644 --- a/sal/osl/all/utility.cxx +++ b/sal/osl/all/utility.cxx @@ -27,6 +27,8 @@ namespace osl { +namespace { + class OGlobalTimer { @@ -38,6 +40,8 @@ public: }; +} + static OGlobalTimer aGlobalTimer; } // namespace osl diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx index cede35a86d04..d73d67e91b37 100644 --- a/sal/osl/unx/conditn.cxx +++ b/sal/osl/unx/conditn.cxx @@ -29,6 +29,8 @@ #include <osl/conditn.h> #include <osl/time.h> +namespace { + struct oslConditionImpl { pthread_cond_t m_Condition; @@ -36,6 +38,8 @@ struct oslConditionImpl bool m_State; }; +} + oslCondition SAL_CALL osl_createCondition() { oslConditionImpl* pCond; diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index b6a0acaae2c4..cfd71419d3fe 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -60,6 +60,8 @@ #include <android/asset_manager.h> #endif +namespace { + struct FileHandle_Impl { pthread_mutex_t m_mutex; @@ -155,6 +157,8 @@ struct FileHandle_Impl }; }; +} + FileHandle_Impl::Guard::Guard(pthread_mutex_t * pMutex) : m_mutex(pMutex) { diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index 4d629f849868..163deb0c2493 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -158,6 +158,8 @@ bool osl_systemPathIsLocalOrParentDirectoryEntry( dirent == ".."); } +namespace { + /** Simple iterator for a path list separated by the specified character */ class path_list_iterator @@ -225,6 +227,8 @@ private: const sal_Unicode* m_path_segment_end; }; +} + bool osl_searchPath( const rtl_uString* pustrFilePath, const rtl_uString* pustrSearchPathList, diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 41d6de0b04ea..d479e0d40cfc 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -788,6 +788,8 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process) } #if defined(LINUX) +namespace { + struct osl_procStat { /* from 'stat' */ @@ -848,6 +850,8 @@ struct osl_procStat unsigned long vm_lib; /* library size */ }; +} + static bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) { int fd = 0; diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 35a5b90ece0d..fe7dc9db5ccf 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -140,6 +140,8 @@ oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL) #endif +namespace { + struct CommandArgs_Impl { pthread_mutex_t m_mutex; @@ -147,6 +149,8 @@ struct CommandArgs_Impl rtl_uString ** m_ppArgs; }; +} + static struct CommandArgs_Impl g_command_args = { PTHREAD_MUTEX_INITIALIZER, @@ -409,12 +413,16 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir(rtl_uString **ppustrWorkingDir return result; } +namespace { + struct ProcessLocale_Impl { pthread_mutex_t m_mutex; rtl_Locale * m_pLocale; }; +} + static struct ProcessLocale_Impl g_process_locale = { PTHREAD_MUTEX_INITIALIZER, diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index ad8868b5490c..717316c0817c 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -58,8 +58,6 @@ enum osl_TLockMode un_lock, read_lock, write_lock }; -} - struct osl_TFile { int m_Handle; @@ -104,6 +102,8 @@ struct osl_TProfileImpl bool m_bIsValid; }; +} + static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption ProfileFlags); static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags); static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode); diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index 5ea77495daa6..fb694ebd92cd 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -75,6 +75,8 @@ #define THREADIMPL_FLAGS_ATTACHED 0x00010 #define THREADIMPL_FLAGS_DESTROYED 0x00020 +namespace { + typedef struct osl_thread_impl_st { pthread_t m_hThread; @@ -95,18 +97,26 @@ struct osl_thread_priority_st int m_Lowest; }; +} + #define OSL_THREAD_PRIORITY_INITIALIZER { 127, 96, 64, 32, 0 } static void osl_thread_priority_init_Impl(); +namespace { + struct osl_thread_textencoding_st { pthread_key_t m_key; /* key to store thread local text encoding */ rtl_TextEncoding m_default; /* the default text encoding */ }; +} + #define OSL_THREAD_TEXTENCODING_INITIALIZER { 0, RTL_TEXTENCODING_DONTKNOW } static void osl_thread_textencoding_init_Impl(); +namespace { + struct osl_thread_global_st { pthread_once_t m_once; @@ -114,6 +124,8 @@ struct osl_thread_global_st struct osl_thread_textencoding_st m_textencoding; }; +} + static struct osl_thread_global_st g_thread = { PTHREAD_ONCE_INIT, @@ -555,6 +567,8 @@ void SAL_CALL osl_setThreadName(char const * name) /* osl_getThreadIdentifier @@@ see TODO @@@ */ +namespace { + struct HashEntry { pthread_t Handle; @@ -562,6 +576,8 @@ struct HashEntry HashEntry * Next; }; +} + static HashEntry* HashTable[31]; static const int HashSize = SAL_N_ELEMENTS(HashTable); @@ -951,12 +967,16 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) return Priority; } +namespace { + struct wrapper_pthread_key { pthread_key_t m_key; oslThreadKeyCallbackFunction pfnCallback; }; +} + oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallback ) { wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(malloc(sizeof(wrapper_pthread_key))); diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx index 0d3cba799583..0e6a56f37c3b 100644 --- a/sal/qa/osl/condition/osl_Condition.cxx +++ b/sal/qa/osl/condition/osl_Condition.cxx @@ -31,8 +31,6 @@ enum ConditionType thread_type_wait }; -} - /** thread for testing Condition. */ class ConditionThread : public Thread @@ -61,6 +59,8 @@ protected: } }; +} + namespace osl_Condition { /** testing the method: diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 54c0e01b90ff..3811ab29d3e8 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -4997,6 +4997,8 @@ namespace osl_Directory } } + namespace { + class DirCreatedObserver : public DirectoryCreationObserver { public: @@ -5009,6 +5011,8 @@ namespace osl_Directory int i; }; + } + class createPath : public CppUnit::TestFixture { public: @@ -5149,6 +5153,8 @@ OUString getCurrentPID() return OUString::number(nPID); } +namespace { + //~ do some clean up work after all test completed. class GlobalObject { @@ -5197,6 +5203,8 @@ public: } }; +} + static GlobalObject theGlobalObject; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index 52112cb9f151..f440a715162f 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -44,6 +44,7 @@ static OUString getDllURL() namespace osl_Module { + namespace { /** class and member function that is available for module test : */ @@ -57,6 +58,8 @@ namespace osl_Module }; }; + } + /** testing the methods: Module(); Module( const OUString& strModuleName, sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT); diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index d0b8283c68e3..c345ae33eb2b 100644 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -49,6 +49,8 @@ namespace ThreadHelper // Beginning of the test cases for osl_Mutex class +namespace { + /** mutually exclusive data */ struct resource { @@ -229,6 +231,8 @@ protected: } }; +} + namespace osl_Mutex { @@ -524,6 +528,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::getGlobalMutex, "osl_Mutex"); // Beginning of the test cases for osl_Guard class +namespace { + class GuardThread : public Thread { public: @@ -545,6 +551,8 @@ protected: } }; +} + namespace osl_Guard { class ctor : public CppUnit::TestFixture @@ -607,6 +615,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Guard::ctor, "osl_Guard"); // Beginning of the test cases for osl_ClearableGuard class +namespace { + /** Thread for test ClearableGuard */ class ClearGuardThread : public Thread @@ -635,6 +645,8 @@ protected: } }; +} + namespace osl_ClearableGuard { @@ -748,6 +760,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_ClearableGuard::clear, "osl_Clearable // Beginning of the test cases for osl_ResettableGuard class +namespace { + /** Thread for test ResettableGuard */ class ResetGuardThread : public Thread @@ -774,6 +788,8 @@ protected: } }; +} + namespace osl_ResettableGuard { class ctor : public CppUnit::TestFixture diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 482ae750f36f..d7bedb5baaa8 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -744,6 +744,8 @@ namespace osl_StreamPipe } // test read/write & send/recv data to pipe + namespace { + class Pipe_DataSink_Thread : public Thread { public: @@ -838,6 +840,8 @@ namespace osl_StreamPipe } }; + } + /** testing the method: read/write/send/recv and Pipe::accept */ class recv : public CppUnit::TestFixture diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index 0b97d0b95d8c..3c9891b76e54 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -48,6 +48,8 @@ using namespace osl; +namespace { + // Small stopwatch class StopWatch { TimeValue t1,t2; // Start and stoptime @@ -69,6 +71,8 @@ public: double getTenthSec() const; }; +} + // ================================= Stop Watch ================================= // A small stopwatch for internal use @@ -145,6 +149,8 @@ double StopWatch::getTenthSec() const return nValue ; } +namespace { + template <class T> class ThreadSafeValue { @@ -168,6 +174,8 @@ public: void release() {m_aMutex.release();} }; +} + namespace ThreadHelper { static void thread_sleep_tenth_sec(sal_Int32 _nTenthSec) @@ -205,6 +213,8 @@ namespace ThreadHelper } } +namespace { + /** Simple thread for testing Thread-create. Just add 1 of value 0, and after running, result is 1. @@ -393,6 +403,8 @@ public: }; +} + namespace osl_Thread { @@ -1671,6 +1683,8 @@ static void destroyCallback(void * data) static ThreadData myThreadData(destroyCallback); +namespace { + class myKeyThread : public Thread { public: @@ -1708,8 +1722,12 @@ public: } }; +} + static ThreadData idData; +namespace { + class idThread: public Thread { public: @@ -1735,6 +1753,8 @@ public: } }; +} + namespace osl_ThreadData { diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index eaf34bd46d5b..104f9238eea6 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -80,6 +80,8 @@ static OUString getExecutablePath() #if !defined _WIN32 +namespace { + class exclude { public: @@ -118,8 +120,6 @@ private: std::vector<OString> exclude_list_; }; -namespace -{ void tidy_container(std::vector<OString> &env_container) { //sort them because there are no guarantees to ordering diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index 3bce893731cc..bc00d27a21e7 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -309,6 +309,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::loginUserOnFileServer); */ #include <cppunit/plugin/TestPlugInDefaultImpl.h> +namespace { + class MyTestPlugInImpl: public CPPUNIT_NS::TestPlugInDefaultImpl { public: @@ -317,6 +319,8 @@ class MyTestPlugInImpl: public CPPUNIT_NS::TestPlugInDefaultImpl const CPPUNIT_NS::PlugInParameters ¶meters ) override; }; +} + void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, const CPPUNIT_NS::PlugInParameters & ) { diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx index d2e094d19c12..6f59e55e62cd 100644 --- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx +++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx @@ -50,7 +50,6 @@ struct Gregorian : public rtl::StaticWithInit<OUString, Gregorian> { return CONST_TEST_STRING; } }; -} /** Simple thread for testing Thread-create. * Just add 1 of value 0, and after running, result is 1. @@ -108,6 +107,8 @@ public: } }; +} + namespace rtl_DoubleLocking { diff --git a/sal/qa/rtl/random/rtl_random.cxx b/sal/qa/rtl/random/rtl_random.cxx index 1e0eb625d5f5..c43638277c90 100644 --- a/sal/qa/rtl/random/rtl_random.cxx +++ b/sal/qa/rtl/random/rtl_random.cxx @@ -139,6 +139,8 @@ public: CPPUNIT_TEST_SUITE_END(); }; // class addBytes +namespace { + class Statistics { int m_nDispensation[256]; @@ -208,6 +210,8 @@ public: }; +} + class getBytes : public CppUnit::TestFixture { public: diff --git a/sal/qa/rtl/ref/rtl_ref.cxx b/sal/qa/rtl/ref/rtl_ref.cxx index 2c7d3aae5276..2bf7c9803f3d 100644 --- a/sal/qa/rtl/ref/rtl_ref.cxx +++ b/sal/qa/rtl/ref/rtl_ref.cxx @@ -16,6 +16,8 @@ namespace rtl_ref { +namespace { + class MoveTestClass { private: @@ -45,6 +47,8 @@ public: void set_inc_flag() { m_bIncFlag = true; } }; +} + static rtl::Reference< MoveTestClass > get_reference( MoveTestClass* pcTestClass ) { // constructor will increment the reference count diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index 626d05c7b895..f126efdabd27 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -29,6 +29,8 @@ #include <string.h> #include <stdio.h> +namespace { + /** @internal */ @@ -38,6 +40,8 @@ struct rtl_arena_list_st rtl_arena_type m_arena_head; }; +} + static rtl_arena_list_st g_arena_list; /** diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 7f5d4317636a..dae54a88df66 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -55,11 +55,11 @@ using osl::DirectoryItem; using osl::FileStatus; -struct Bootstrap_Impl; - namespace { +struct Bootstrap_Impl; + static char const VND_SUN_STAR_PATHNAME[] = "vnd.sun.star.pathname:"; bool isPathnameUrl(OUString const & url) @@ -111,8 +111,6 @@ OUString recursivelyExpandMacros( return expandMacros(file, text, mode, &link); } -} // end namespace - struct rtl_bootstrap_NameValue { OUString sName; @@ -126,6 +124,8 @@ struct rtl_bootstrap_NameValue {} }; +} // end namespace + typedef std::vector<rtl_bootstrap_NameValue> NameValueVector; static bool find( @@ -281,6 +281,8 @@ static void EnsureNoFinalSlash (OUString & url) url = url.copy(0, i - 1); } +namespace { + struct Bootstrap_Impl { sal_Int32 _nRefCount; @@ -313,6 +315,8 @@ struct Bootstrap_Impl ExpandRequestLink const * requestStack) const; }; +} + Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName ) : _nRefCount( 0 ), _base_ini( nullptr ), diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index 26d9cca29afc..9bc438114651 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -105,6 +105,8 @@ typedef rtlCipherError(cipher_update_t) ( typedef void (cipher_delete_t) (rtlCipher Cipher); +namespace { + struct Cipher_Impl { rtlCipherAlgorithm m_algorithm; @@ -117,6 +119,8 @@ struct Cipher_Impl cipher_delete_t *m_delete; }; +} + rtlCipher SAL_CALL rtl_cipher_create( rtlCipherAlgorithm Algorithm, rtlCipherMode Mode) SAL_THROW_EXTERN_C() @@ -192,6 +196,8 @@ void SAL_CALL rtl_cipher_destroy(rtlCipher Cipher) SAL_THROW_EXTERN_C() pImpl->m_delete(Cipher); } +namespace { + #if !defined LIBO_CIPHER_OPENSSL_BACKEND #define CIPHER_ROUNDS_BF 16 @@ -223,6 +229,8 @@ struct CipherBF_Impl CipherContextBF m_context; }; +} + #if !defined LIBO_CIPHER_OPENSSL_BACKEND static rtlCipherError BF_init( CipherContextBF *ctx, @@ -1150,6 +1158,8 @@ void SAL_CALL rtl_cipher_destroyBF(rtlCipher Cipher) SAL_THROW_EXTERN_C() #define CIPHER_CBLOCK_ARCFOUR 256 #endif +namespace { + struct ContextARCFOUR_Impl { #if defined LIBO_CIPHER_OPENSSL_BACKEND @@ -1166,6 +1176,8 @@ struct CipherARCFOUR_Impl ContextARCFOUR_Impl m_context; }; +} + static rtlCipherError rtl_cipherARCFOUR_update_Impl( ContextARCFOUR_Impl *ctx, const sal_uInt8 *pData, sal_Size nDatLen, diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx index 1000fc0aed02..55af5ad7c3b2 100644 --- a/sal/rtl/digest.cxx +++ b/sal/rtl/digest.cxx @@ -52,6 +52,8 @@ typedef rtlDigestError (Digest_update_t) ( typedef rtlDigestError (Digest_get_t) ( void *ctx, sal_uInt8 *Buffer, sal_uInt32 BufLen); +namespace { + struct Digest_Impl { rtlDigestAlgorithm m_algorithm; @@ -63,6 +65,8 @@ struct Digest_Impl Digest_get_t *m_get; }; +} + static void swapLong(sal_uInt32 *pData, sal_uInt32 nDatLen) { sal_uInt32 *X; @@ -175,6 +179,8 @@ void SAL_CALL rtl_digest_destroy(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_MD2 16 #define DIGEST_LBLOCK_MD2 16 +namespace { + struct DigestContextMD2 { sal_uInt32 m_nDatLen; @@ -189,6 +195,8 @@ struct DigestMD2_Impl DigestContextMD2 m_context; }; +} + static void initMD2 (DigestContextMD2 *ctx); static void updateMD2 (DigestContextMD2 *ctx); static void endMD2 (DigestContextMD2 *ctx); @@ -437,6 +445,8 @@ void SAL_CALL rtl_digest_destroyMD2(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_MD5 64 #define DIGEST_LBLOCK_MD5 16 +namespace { + struct DigestContextMD5 { sal_uInt32 m_nDatLen; @@ -451,6 +461,8 @@ struct DigestMD5_Impl DigestContextMD5 m_context; }; +} + static void initMD5 (DigestContextMD5 *ctx); static void updateMD5 (DigestContextMD5 *ctx); static void endMD5 (DigestContextMD5 *ctx); @@ -824,6 +836,8 @@ typedef sal_uInt32 DigestSHA_update_t(sal_uInt32 x); static sal_uInt32 updateSHA_0(sal_uInt32 x); static sal_uInt32 updateSHA_1(sal_uInt32 x); +namespace { + struct DigestContextSHA { DigestSHA_update_t *m_update; @@ -839,6 +853,8 @@ struct DigestSHA_Impl DigestContextSHA m_context; }; +} + static void initSHA( DigestContextSHA *ctx, DigestSHA_update_t *fct); @@ -1390,6 +1406,8 @@ void SAL_CALL rtl_digest_destroySHA1(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_HMAC_MD5 64 +namespace { + struct ContextHMAC_MD5 { DigestMD5_Impl m_hash; @@ -1402,6 +1420,8 @@ struct DigestHMAC_MD5_Impl ContextHMAC_MD5 m_context; }; +} + static void initHMAC_MD5(ContextHMAC_MD5 * ctx); static void ipadHMAC_MD5(ContextHMAC_MD5 * ctx); static void opadHMAC_MD5(ContextHMAC_MD5 * ctx); @@ -1586,6 +1606,8 @@ void SAL_CALL rtl_digest_destroyHMAC_MD5(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_HMAC_SHA1 64 +namespace { + struct ContextHMAC_SHA1 { DigestSHA_Impl m_hash; @@ -1598,6 +1620,8 @@ struct DigestHMAC_SHA1_Impl ContextHMAC_SHA1 m_context; }; +} + static void initHMAC_SHA1(ContextHMAC_SHA1 * ctx); static void ipadHMAC_SHA1(ContextHMAC_SHA1 * ctx); static void opadHMAC_SHA1(ContextHMAC_SHA1 * ctx); diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index 4cbe1da785c6..4fed60889f50 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -26,12 +26,16 @@ #include <osl/diagnose.h> #include <sal/macros.h> +namespace { + struct StringHashTableImpl { sal_uInt32 nEntries; sal_uInt32 nSize; rtl_uString **pData; }; +} + typedef StringHashTableImpl StringHashTable; // Only for use in the implementation diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx index e362a342bcbc..bae0f40b3d66 100644 --- a/sal/rtl/locale.cxx +++ b/sal/rtl/locale.cxx @@ -26,6 +26,8 @@ #include <memory> #include <unordered_map> +namespace { + struct locale_deleter { void operator() (rtl_Locale* p) noexcept @@ -37,6 +39,8 @@ struct locale_deleter } }; +} + using locale_unique_ptr = std::unique_ptr<rtl_Locale, locale_deleter>; static std::unordered_map<sal_Int32, locale_unique_ptr>* g_pLocaleTable = nullptr; diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index c9cc0f841ea9..418358b22e22 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -46,6 +46,8 @@ if ((z) < 0) (z) += 30307; \ } +namespace { + struct RandomData_Impl { sal_Int16 m_nX; @@ -53,12 +55,16 @@ struct RandomData_Impl sal_Int16 m_nZ; }; +} + static double data (RandomData_Impl *pImpl); #define RTL_RANDOM_DIGEST rtl_Digest_AlgorithmMD5 #define RTL_RANDOM_SIZE_DIGEST RTL_DIGEST_LENGTH_MD5 #define RTL_RANDOM_SIZE_POOL 1023 +namespace { + struct RandomPool_Impl { rtlDigest m_hDigest; @@ -69,6 +75,8 @@ struct RandomPool_Impl sal_uInt32 m_nCount; }; +} + static bool initPool(RandomPool_Impl *pImpl); static void seedPool( diff --git a/sal/rtl/uuid.cxx b/sal/rtl/uuid.cxx index bb9490ef8b99..130be12456d6 100644 --- a/sal/rtl/uuid.cxx +++ b/sal/rtl/uuid.cxx @@ -55,6 +55,8 @@ ( ( static_cast<sal_uInt32>(p[3])) & 0xff);\ } +namespace { + struct UUID { sal_uInt32 time_low; @@ -65,6 +67,8 @@ struct UUID sal_uInt8 node[6]; }; +} + static void write_v3( sal_uInt8 *pUuid ) { UUID uuid; diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx index b8566ed6a51e..ae25d811df2d 100644 --- a/sal/textenc/convertisciidevangari.cxx +++ b/sal/textenc/convertisciidevangari.cxx @@ -22,6 +22,8 @@ using namespace sal::detail::textenc; using namespace rtl::textenc; +namespace { + struct IsciiDevanagariToUnicode { sal_uInt8 m_cPrevChar; @@ -57,6 +59,8 @@ struct UnicodeToIsciiDevanagari sal_uInt32 * pInfo, sal_Size * pSrcCvtChars); }; +} + static const sal_Unicode IsciiDevanagariMap[256] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, diff --git a/sal/textenc/tcvtutf7.cxx b/sal/textenc/tcvtutf7.cxx index b09ccd47f1d8..1a1ca7603241 100644 --- a/sal/textenc/tcvtutf7.cxx +++ b/sal/textenc/tcvtutf7.cxx @@ -91,6 +91,8 @@ static unsigned char const aImplMustShiftTab[128] = /* ----------------------------------------------------------------------- */ +namespace { + struct ImplUTF7ToUCContextData { bool mbShifted; @@ -100,6 +102,8 @@ struct ImplUTF7ToUCContextData sal_uInt32 mnBufferBits; }; +} + /* ----------------------------------------------------------------------- */ void* ImplUTF7CreateUTF7TextToUnicodeContext() @@ -410,6 +414,8 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, /* ======================================================================= */ +namespace { + struct ImplUTF7FromUCContextData { bool mbShifted; @@ -417,6 +423,8 @@ struct ImplUTF7FromUCContextData sal_uInt32 mnBufferBits; }; +} + /* ----------------------------------------------------------------------- */ void* ImplUTF7CreateUnicodeToTextContext() diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx index 950d810e8b85..ca29156c418f 100644 --- a/sal/textenc/tcvtutf8.cxx +++ b/sal/textenc/tcvtutf8.cxx @@ -30,6 +30,8 @@ #include "tenchelp.hxx" #include "unichars.hxx" +namespace { + struct ImplUtf8ToUnicodeContext { sal_uInt32 nUtf32; @@ -43,6 +45,8 @@ struct ImplUnicodeToUtf8Context sal_Unicode nHighSurrogate; /* 0xFFFF: write BOM */ }; +} + void * ImplCreateUtf8ToUnicodeContext() { ImplUtf8ToUnicodeContext * p = new ImplUtf8ToUnicodeContext; diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx index f541fcb20004..b69cf4c586fd 100644 --- a/sal/textenc/tencinfo.cxx +++ b/sal/textenc/tencinfo.cxx @@ -102,6 +102,8 @@ static bool Impl_matchString( const char* pCompStr, const char* pMatchStr ) /* ======================================================================= */ +namespace { + struct ImplStrCharsetDef { const char* mpCharsetStr; @@ -114,6 +116,8 @@ struct ImplStrFirstPartCharsetDef const ImplStrCharsetDef* mpSecondPartTab; }; +} + /* ======================================================================= */ sal_Bool SAL_CALL rtl_getTextEncodingInfo( rtl_TextEncoding eTextEncoding, rtl_TextEncodingInfo* pEncInfo ) |