summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 11:32:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 12:49:35 +0200
commita3c294e6ad33c43b7c515b9bf543aa4bb27a7d51 (patch)
tree0a7d29936797cae962d4147a1eea014778032967 /unotools
parent05144427303b2aa09108eeb03606fa66da275d2b (diff)
convert ReadWriteGuardMode to scoped enum
Change-Id: I21ae815d5bbd7b39cd690168738c21925558585e Reviewed-on: https://gerrit.libreoffice.org/36452 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx18
-rw-r--r--unotools/source/i18n/readwritemutexguard.cxx16
2 files changed, 17 insertions, 17 deletions
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index db93ea18c1d5..56f73b94ef94 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -115,7 +115,7 @@ LocaleDataWrapper::~LocaleDataWrapper()
void LocaleDataWrapper::setLanguageTag( const LanguageTag& rLanguageTag )
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nCriticalChange );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::CriticalChange );
maLanguageTag = rLanguageTag;
invalidateData();
}
@@ -1383,7 +1383,7 @@ sal_Unicode* LocaleDataWrapper::ImplAddFormatNum( sal_Unicode* pBuf,
OUString LocaleDataWrapper::getDate( const Date& rDate ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
//!TODO: leading zeros et al
sal_Unicode aBuf[128];
sal_Unicode* pBuf = aBuf;
@@ -1429,7 +1429,7 @@ OUString LocaleDataWrapper::getDate( const Date& rDate ) const
OUString LocaleDataWrapper::getTime( const tools::Time& rTime, bool bSec, bool b100Sec ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
//!TODO: leading zeros et al
sal_Unicode aBuf[128];
sal_Unicode* pBuf = aBuf;
@@ -1458,7 +1458,7 @@ OUString LocaleDataWrapper::getTime( const tools::Time& rTime, bool bSec, bool b
OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCal,
bool bTwoDigitYear ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
using namespace css::i18n;
sal_Unicode aBuf[20];
sal_Unicode* pBuf;
@@ -1500,7 +1500,7 @@ OUString LocaleDataWrapper::getLongDate( const Date& rDate, CalendarWrapper& rCa
OUString LocaleDataWrapper::getDuration( const tools::Time& rTime, bool bSec, bool b100Sec ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
sal_Unicode aBuf[128];
sal_Unicode* pBuf = aBuf;
@@ -1544,7 +1544,7 @@ inline size_t ImplGetNumberStringLengthGuess( const LocaleDataWrapper& rLoc, sal
OUString LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
bool bUseThousandSep, bool bTrailingZeros ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
sal_Unicode aBuf[128]; // big enough for 64-bit long and crazy grouping
// check if digits and separators will fit into fixed buffer or allocate
size_t nGuess = ImplGetNumberStringLengthGuess( *this, nDecimals );
@@ -1563,7 +1563,7 @@ OUString LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
const OUString& rCurrencySymbol, bool bUseThousandSep ) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
sal_Unicode aBuf[192];
sal_Unicode aNumBuf[128]; // big enough for 64-bit long and crazy grouping
sal_Unicode cZeroChar = getCurrZeroChar();
@@ -1771,7 +1771,7 @@ LanguageTag LocaleDataWrapper::getLoadedLanguageTag() const
OUString LocaleDataWrapper::appendLocaleInfo(const OUString& rDebugMsg) const
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::BlockCritical );
OUStringBuffer aDebugMsg(rDebugMsg);
aDebugMsg.append('\n');
aDebugMsg.append(maLanguageTag.getBcp47());
@@ -1872,7 +1872,7 @@ css::uno::Sequence< OUString > LocaleDataWrapper::getDateAcceptancePatterns() co
void LocaleDataWrapper::setDateAcceptancePatterns(
const css::uno::Sequence< OUString > & rPatterns )
{
- ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nWrite );
+ ::utl::ReadWriteGuard aGuard( aMutex, ReadWriteGuardMode::Write );
if (!aDateAcceptancePatterns.getLength() || !rPatterns.getLength())
{
diff --git a/unotools/source/i18n/readwritemutexguard.cxx b/unotools/source/i18n/readwritemutexguard.cxx
index 2932212d3c12..134f06c35747 100644
--- a/unotools/source/i18n/readwritemutexguard.cxx
+++ b/unotools/source/i18n/readwritemutexguard.cxx
@@ -23,14 +23,14 @@
namespace utl {
ReadWriteGuard::ReadWriteGuard( ReadWriteMutex& rMutexP,
- sal_Int32 nRequestMode )
+ ReadWriteGuardMode nRequestMode )
: rMutex( rMutexP )
{
// don't do anything until a pending write completed (or another
// ReadWriteGuard leaves the ctor phase)
::osl::MutexGuard aGuard( rMutex.maWriteMutex );
nMode = nRequestMode;
- if ( nMode & ReadWriteGuardMode::nWrite )
+ if ( nMode & ReadWriteGuardMode::Write )
{
rMutex.maWriteMutex.acquire();
// wait for any read to complete
@@ -40,12 +40,12 @@ ReadWriteGuard::ReadWriteGuard( ReadWriteMutex& rMutexP,
{
rMutex.maMutex.acquire();
bWait = (rMutex.nReadCount != 0);
- if ( nMode & ReadWriteGuardMode::nCriticalChange )
+ if ( nMode & ReadWriteGuardMode::CriticalChange )
bWait |= (rMutex.nBlockCriticalCount != 0);
rMutex.maMutex.release();
} while ( bWait );
}
- else if ( nMode & ReadWriteGuardMode::nBlockCritical )
+ else if ( nMode & ReadWriteGuardMode::BlockCritical )
{
rMutex.maMutex.acquire();
++rMutex.nBlockCriticalCount;
@@ -61,9 +61,9 @@ ReadWriteGuard::ReadWriteGuard( ReadWriteMutex& rMutexP,
ReadWriteGuard::~ReadWriteGuard()
{
- if ( nMode & ReadWriteGuardMode::nWrite )
+ if ( nMode & ReadWriteGuardMode::Write )
rMutex.maWriteMutex.release();
- else if ( nMode & ReadWriteGuardMode::nBlockCritical )
+ else if ( nMode & ReadWriteGuardMode::BlockCritical )
{
rMutex.maMutex.acquire();
--rMutex.nBlockCriticalCount;
@@ -79,7 +79,7 @@ ReadWriteGuard::~ReadWriteGuard()
void ReadWriteGuard::changeReadToWrite()
{
- bool bOk = !(nMode & (ReadWriteGuardMode::nWrite | ReadWriteGuardMode::nBlockCritical));
+ bool bOk = !(nMode & (ReadWriteGuardMode::Write | ReadWriteGuardMode::BlockCritical));
DBG_ASSERT( bOk, "ReadWriteGuard::changeReadToWrite: can't" );
if ( bOk )
{
@@ -91,7 +91,7 @@ void ReadWriteGuard::changeReadToWrite()
rMutex.maMutex.release();
rMutex.maWriteMutex.acquire();
- nMode |= ReadWriteGuardMode::nWrite;
+ nMode |= ReadWriteGuardMode::Write;
// wait for any other read to complete
// TODO: set up a waiting thread instead of a loop
bool bWait = true;