[Libreoffice-commits] core.git: 3 commits - sal/rtl vcl/inc vcl/source vcl/unx
Noel Grandin
noel at peralex.com
Sun May 22 17:52:37 UTC 2016
sal/rtl/alloc_cache.cxx | 4 -
sal/rtl/alloc_global.cxx | 18 ++--
sal/rtl/alloc_impl.hxx | 2
vcl/inc/unx/i18n_cb.hxx | 14 +--
vcl/inc/unx/i18n_ic.hxx | 2
vcl/source/filter/wmf/emfwr.cxx | 146 ++++++++++++++++++++--------------------
vcl/source/filter/wmf/emfwr.hxx | 5 -
vcl/unx/generic/app/i18n_cb.cxx | 18 ++--
vcl/unx/generic/app/i18n_ic.cxx | 2
9 files changed, 106 insertions(+), 105 deletions(-)
New commits:
commit 602fc6153fd1d326a827351e7ade649638446f7c
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 20 15:31:56 2016 +0200
Convert AllocMode to scoped enum
Change-Id: I642d7546059f1af993ab15eb3948949109df05c4
Reviewed-on: https://gerrit.libreoffice.org/25203
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 362582f..b557504 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -1133,7 +1133,7 @@ SAL_CALL rtl_cache_alloc (
if (cache == nullptr)
return nullptr;
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
obj = rtl_allocateMemory(cache->m_type_size);
if ((obj != nullptr) && (cache->m_constructor != nullptr))
@@ -1216,7 +1216,7 @@ SAL_CALL rtl_cache_free (
{
if ((obj != nullptr) && (cache != nullptr))
{
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
if (cache->m_destructor != nullptr)
{
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 6c9b288..703a42b 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -29,13 +29,13 @@
#include "rtllifecycle.h"
#include <oslmemory.h>
-AllocMode alloc_mode = AMode_UNSET;
+AllocMode alloc_mode = AllocMode::UNSET;
#if !defined(FORCE_SYSALLOC)
static void determine_alloc_mode()
{
- assert(alloc_mode == AMode_UNSET);
- alloc_mode = (getenv("G_SLICE") == nullptr ? AMode_CUSTOM : AMode_SYSTEM);
+ assert(alloc_mode == AllocMode::UNSET);
+ alloc_mode = (getenv("G_SLICE") == nullptr ? AllocMode::CUSTOM : AllocMode::SYSTEM);
}
/* ================================================================= *
@@ -296,11 +296,11 @@ void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
return rtl_allocateMemory_CUSTOM(n);
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
return rtl_allocateMemory_SYSTEM(n);
}
@@ -319,11 +319,11 @@ void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
return rtl_reallocateMemory_CUSTOM(p,n);
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
return rtl_reallocateMemory_SYSTEM(p,n);
}
@@ -339,12 +339,12 @@ void SAL_CALL rtl_freeMemory (void * p) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
rtl_freeMemory_CUSTOM(p);
return;
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
rtl_freeMemory_SYSTEM(p);
return;
diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx
index 3666996..d10ba93 100644
--- a/sal/rtl/alloc_impl.hxx
+++ b/sal/rtl/alloc_impl.hxx
@@ -228,7 +228,7 @@ typedef CRITICAL_SECTION rtl_memory_lock_type;
#define RTL_CACHE_FLAG_NOMAGAZINE (1 << 13) /* w/o magazine layer */
#define RTL_CACHE_FLAG_QUANTUMCACHE (2 << 13) /* used as arena quantum cache */
-typedef enum { AMode_CUSTOM, AMode_SYSTEM, AMode_UNSET } AllocMode;
+enum class AllocMode { CUSTOM, SYSTEM, UNSET };
extern AllocMode alloc_mode;
commit 866d1bbecb7cfe8256d38e5fb77c7bce149e648f
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 20 15:29:40 2016 +0200
Convert PreeditStatus to scoped enum
Change-Id: Ibc1329d9c6c2c5fe84fa2c0b0d420da82a82adc1
Reviewed-on: https://gerrit.libreoffice.org/25202
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/vcl/inc/unx/i18n_cb.hxx b/vcl/inc/unx/i18n_cb.hxx
index b990262..35b44a0 100644
--- a/vcl/inc/unx/i18n_cb.hxx
+++ b/vcl/inc/unx/i18n_cb.hxx
@@ -60,16 +60,16 @@ typedef struct {
class SalFrame;
-typedef enum {
- ePreeditStatusDontKnow = 0,
- ePreeditStatusActive,
- ePreeditStatusActivationRequired,
- ePreeditStatusStartPending
-} preedit_status_t;
+enum class PreeditStatus {
+ DontKnow = 0,
+ Active,
+ ActivationRequired,
+ StartPending
+};
typedef struct {
SalFrame* pFrame;
- preedit_status_t eState;
+ PreeditStatus eState;
preedit_text_t aText;
SalExtTextInputEvent aInputEv;
std::vector< ExtTextInputAttr > aInputFlags;
diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx
index e612590..ee96340 100644
--- a/vcl/inc/unx/i18n_ic.hxx
+++ b/vcl/inc/unx/i18n_ic.hxx
@@ -58,7 +58,7 @@ private:
public:
Bool UseContext() { return mbUseable; }
- bool IsPreeditMode() { return maClientData.eState == ePreeditStatusActive; }
+ bool IsPreeditMode() { return maClientData.eState == PreeditStatus::Active; }
XIC GetContext() { return maContext; }
void ExtendEventMask( ::Window aFocusWindow );
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index a892c90..2c7bc67 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -42,9 +42,9 @@ int
PreeditStartCallback ( XIC, XPointer client_data, XPointer )
{
preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data);
- if ( pPreeditData->eState == ePreeditStatusActivationRequired )
+ if ( pPreeditData->eState == PreeditStatus::ActivationRequired )
{
- pPreeditData->eState = ePreeditStatusActive;
+ pPreeditData->eState = PreeditStatus::Active;
pPreeditData->aText.nCursorPos = 0;
pPreeditData->aText.nLength = 0;
}
@@ -57,13 +57,13 @@ PreeditStartCallback ( XIC, XPointer client_data, XPointer )
void
PreeditDoneCallback ( XIC, XPointer client_data, XPointer )
{
- preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data);
- if (pPreeditData->eState == ePreeditStatusActive )
+ preedit_data_t* pPreeditData = reinterpret_cast<preedit_data_t*>(client_data);
+ if (pPreeditData->eState == PreeditStatus::Active )
{
if( pPreeditData->pFrame )
pPreeditData->pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
}
- pPreeditData->eState = ePreeditStatusStartPending;
+ pPreeditData->eState = PreeditStatus::StartPending;
}
// iii. preedit draw callback
@@ -314,8 +314,8 @@ PreeditDrawCallback(XIC ic, XPointer client_data,
// if (pPreeditData->eState == ePreeditStatusStartPending && call_data->text == NULL)
// return;
- if ( pPreeditData->eState == ePreeditStatusStartPending )
- pPreeditData->eState = ePreeditStatusActivationRequired;
+ if ( pPreeditData->eState == PreeditStatus::StartPending )
+ pPreeditData->eState = PreeditStatus::ActivationRequired;
PreeditStartCallback( ic, client_data, nullptr );
// Edit the internal textbuffer as indicated by the call_data,
@@ -368,13 +368,13 @@ PreeditDrawCallback(XIC ic, XPointer client_data,
pPreeditData->aInputEv.mnCursorFlags = 0; // default: make cursor visible
pPreeditData->aInputEv.mbOnlyCursor = False;
- if ( pPreeditData->eState == ePreeditStatusActive && pPreeditData->pFrame )
+ if ( pPreeditData->eState == PreeditStatus::Active && pPreeditData->pFrame )
pPreeditData->pFrame->CallCallback(SalEvent::ExtTextInput, static_cast<void*>(&pPreeditData->aInputEv));
if (pPreeditData->aText.nLength == 0 && pPreeditData->pFrame )
pPreeditData->pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
if (pPreeditData->aText.nLength == 0)
- pPreeditData->eState = ePreeditStatusStartPending;
+ pPreeditData->eState = PreeditStatus::StartPending;
GetPreeditSpotLocation(ic, reinterpret_cast<XPointer>(pPreeditData));
}
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index d4102fb..a67e589 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -179,7 +179,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
// for status callbacks and commit string callbacks
#define PREEDIT_BUFSZ 16
- maClientData.eState = ePreeditStatusStartPending;
+ maClientData.eState = PreeditStatus::StartPending;
maClientData.pFrame = pFrame;
maClientData.aText.pUnicodeBuffer =
static_cast<sal_Unicode*>(malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode)));
commit 3aeeaae41e8fa5a025b9b792da75c6766f17f8f2
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 20 15:24:24 2016 +0200
Convert EmfPlusRecordType to scoped enum
Change-Id: I4da601998f65deb7105f4b58281edf41ba6e58bc
Reviewed-on: https://gerrit.libreoffice.org/25201
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 083bd77..5ac14fb 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -93,67 +93,67 @@
#define MM_ANISOTROPIC 8
-typedef enum
+enum class EmfPlusRecordType
{
- EmfPlusHeader = 0x4001,
- EmfPlusEndOfFile = 0x4002,
- EmfPlusComment = 0x4003,
- EmfPlusGetDC = 0x4004,
- EmfPlusMultiFormatStart = 0x4005,
- EmfPlusMultiFormatSection = 0x4006,
- EmfPlusMultiFormatEnd = 0x4007,
- EmfPlusObject = 0x4008,
- EmfPlusClear = 0x4009,
- EmfPlusFillRects = 0x400A,
- EmfPlusDrawRects = 0x400B,
- EmfPlusFillPolygon = 0x400C,
- EmfPlusDrawLines = 0x400D,
- EmfPlusFillEllipse = 0x400E,
- EmfPlusDrawEllipse = 0x400F,
- EmfPlusFillPie = 0x4010,
- EmfPlusDrawPie = 0x4011,
- EmfPlusDrawArc = 0x4012,
- EmfPlusFillRegion = 0x4013,
- EmfPlusFillPath = 0x4014,
- EmfPlusDrawPath = 0x4015,
- EmfPlusFillClosedCurve = 0x4016,
- EmfPlusDrawClosedCurve = 0x4017,
- EmfPlusDrawCurve = 0x4018,
- EmfPlusDrawBeziers = 0x4019,
- EmfPlusDrawImage = 0x401A,
- EmfPlusDrawImagePoints = 0x401B,
- EmfPlusDrawstring = 0x401C,
- EmfPlusSetRenderingOrigin = 0x401D,
- EmfPlusSetAntiAliasMode = 0x401E,
- EmfPlusSetTextRenderingHint = 0x401F,
- EmfPlusSetTextContrast = 0x4020,
- EmfPlusSetInterpolationMode = 0x4021,
- EmfPlusSetPixelOffsetMode = 0x4022,
- EmfPlusSetCompositingMode = 0x4023,
- EmfPlusSetCompositingQuality = 0x4024,
- EmfPlusSave = 0x4025,
- EmfPlusRestore = 0x4026,
- EmfPlusBeginContainer = 0x4027,
- EmfPlusBeginContainerNoParams = 0x4028,
- EmfPlusEndContainer = 0x4029,
- EmfPlusSetWorldTransform = 0x402A,
- EmfPlusResetWorldTransform = 0x402B,
- EmfPlusMultiplyWorldTransform = 0x402C,
- EmfPlusTranslateWorldTransform = 0x402D,
- EmfPlusScaleWorldTransform = 0x402E,
- EmfPlusRotateWorldTransform = 0x402F,
- EmfPlusSetPageTransform = 0x4030,
- EmfPlusResetClip = 0x4031,
- EmfPlusSetClipRect = 0x4032,
- EmfPlusSetClipPath = 0x4033,
- EmfPlusSetClipRegion = 0x4034,
- EmfPlusOffsetClip = 0x4035,
- EmfPlusDrawDriverstring = 0x4036,
- EmfPlusStrokeFillPath = 0x4037,
- EmfPlusSerializableObject = 0x4038,
- EmfPlusSetTSGraphics = 0x4039,
- EmfPlusSetTSClip = 0x403A
-} EmfPlusRecordType;
+ Header = 0x4001,
+ EndOfFile = 0x4002,
+ Comment = 0x4003,
+ GetDC = 0x4004,
+ MultiFormatStart = 0x4005,
+ MultiFormatSection = 0x4006,
+ MultiFormatEnd = 0x4007,
+ Object = 0x4008,
+ Clear = 0x4009,
+ FillRects = 0x400A,
+ DrawRects = 0x400B,
+ FillPolygon = 0x400C,
+ DrawLines = 0x400D,
+ FillEllipse = 0x400E,
+ DrawEllipse = 0x400F,
+ FillPie = 0x4010,
+ DrawPie = 0x4011,
+ DrawArc = 0x4012,
+ FillRegion = 0x4013,
+ FillPath = 0x4014,
+ DrawPath = 0x4015,
+ FillClosedCurve = 0x4016,
+ DrawClosedCurve = 0x4017,
+ DrawCurve = 0x4018,
+ DrawBeziers = 0x4019,
+ DrawImage = 0x401A,
+ DrawImagePoints = 0x401B,
+ Drawstring = 0x401C,
+ SetRenderingOrigin = 0x401D,
+ SetAntiAliasMode = 0x401E,
+ SetTextRenderingHint = 0x401F,
+ SetTextContrast = 0x4020,
+ SetInterpolationMode = 0x4021,
+ SetPixelOffsetMode = 0x4022,
+ SetCompositingMode = 0x4023,
+ SetCompositingQuality = 0x4024,
+ Save = 0x4025,
+ Restore = 0x4026,
+ BeginContainer = 0x4027,
+ BeginContainerNoParams = 0x4028,
+ EndContainer = 0x4029,
+ SetWorldTransform = 0x402A,
+ ResetWorldTransform = 0x402B,
+ MultiplyWorldTransform = 0x402C,
+ TranslateWorldTransform = 0x402D,
+ ScaleWorldTransform = 0x402E,
+ RotateWorldTransform = 0x402F,
+ SetPageTransform = 0x4030,
+ ResetClip = 0x4031,
+ SetClipRect = 0x4032,
+ SetClipPath = 0x4033,
+ SetClipRegion = 0x4034,
+ OffsetClip = 0x4035,
+ DrawDriverstring = 0x4036,
+ StrokeFillPath = 0x4037,
+ SerializableObject = 0x4038,
+ SetTSGraphics = 0x4039,
+ SetTSClip = 0x403A
+};
void EMFWriter::ImplBeginCommentRecord( sal_Int32 nCommentType )
{
@@ -174,7 +174,7 @@ void EMFWriter::ImplEndCommentRecord()
ImplEndRecord();
}
-void EMFWriter::ImplBeginPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags )
+void EMFWriter::ImplBeginPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags )
{
DBG_ASSERT( !mbRecordPlusOpen, "Another EMF+ record is already opened!" );
@@ -183,7 +183,7 @@ void EMFWriter::ImplBeginPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags )
mbRecordPlusOpen = true;
mnRecordPlusPos = m_rStm.Tell();
- m_rStm.WriteUInt16( nType ).WriteUInt16( nFlags );
+ m_rStm.WriteUInt16( (sal_uInt16)nType ).WriteUInt16( nFlags );
m_rStm.SeekRel( 8 );
}
}
@@ -204,7 +204,7 @@ void EMFWriter::ImplEndPlusRecord()
}
}
-void EMFWriter::ImplPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags )
+void EMFWriter::ImplPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags )
{
ImplBeginPlusRecord( nType, nFlags );
ImplEndPlusRecord();
@@ -224,7 +224,7 @@ void EMFWriter::WriteEMFPlusHeader( const Size &rMtfSizePix, const Size &rMtfSiz
if (nDivY)
nDPIY /= nDivY; // DPI Y
- m_rStm.WriteInt16( EmfPlusHeader );
+ m_rStm.WriteInt16( (sal_Int16)EmfPlusRecordType::Header );
m_rStm.WriteInt16( 0x01 ) // Flags - Dual Mode // TODO: Check this
.WriteInt32( 0x1C ) // Size
.WriteInt32( 0x10 ) // Data Size
@@ -236,19 +236,19 @@ void EMFWriter::WriteEMFPlusHeader( const Size &rMtfSizePix, const Size &rMtfSiz
// Write more properties
ImplBeginCommentRecord( WIN_EMR_COMMENT_EMFPLUS );
- ImplPlusRecord( EmfPlusSetPixelOffsetMode, 0x0 );
- ImplPlusRecord( EmfPlusSetAntiAliasMode, 0x09 ); // TODO: Check actual values for AntiAlias
- ImplPlusRecord( EmfPlusSetCompositingQuality, 0x0100 ); // Default Quality
- ImplPlusRecord( EmfPlusSetPageTransform, 1 );
- ImplPlusRecord( EmfPlusSetInterpolationMode, 0x00 ); // Default
- ImplPlusRecord( EmfPlusGetDC, 0x00 );
+ ImplPlusRecord( EmfPlusRecordType::SetPixelOffsetMode, 0x0 );
+ ImplPlusRecord( EmfPlusRecordType::SetAntiAliasMode, 0x09 ); // TODO: Check actual values for AntiAlias
+ ImplPlusRecord( EmfPlusRecordType::SetCompositingQuality, 0x0100 ); // Default Quality
+ ImplPlusRecord( EmfPlusRecordType::SetPageTransform, 1 );
+ ImplPlusRecord( EmfPlusRecordType::SetInterpolationMode, 0x00 ); // Default
+ ImplPlusRecord( EmfPlusRecordType::GetDC, 0x00 );
ImplEndCommentRecord();
}
void EMFWriter::ImplWritePlusEOF()
{
ImplBeginCommentRecord( WIN_EMR_COMMENT_EMFPLUS );
- ImplPlusRecord( EmfPlusEndOfFile, 0x0 );
+ ImplPlusRecord( EmfPlusRecordType::EndOfFile, 0x0 );
ImplEndCommentRecord();
}
@@ -275,7 +275,7 @@ void EMFWriter::ImplWritePlusFillPolygonRecord( const tools::Polygon& rPoly, sal
ImplBeginCommentRecord( WIN_EMR_COMMENT_EMFPLUS );
if( rPoly.GetSize() )
{
- ImplBeginPlusRecord( EmfPlusFillPolygon, 0xC000 ); // Sets the color as well
+ ImplBeginPlusRecord( EmfPlusRecordType::FillPolygon, 0xC000 ); // Sets the color as well
ImplWritePlusColor( maVDev->GetFillColor(), nTrans );
m_rStm.WriteUInt32( rPoly.GetSize() );
for( sal_uInt16 i = 0; i < rPoly.GetSize(); i++ )
@@ -1215,7 +1215,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
ImplWritePolyPolygonRecord( rPolyPoly );
ImplBeginCommentRecord( WIN_EMR_COMMENT_EMFPLUS );
- ImplPlusRecord( EmfPlusGetDC, 0x00 );
+ ImplPlusRecord( EmfPlusRecordType::GetDC, 0x00 );
ImplEndCommentRecord();
}
break;
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index 41d2684..c34ad63 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -28,6 +28,7 @@
class LineInfo;
namespace basegfx { class B2DPolygon; }
+enum class EmfPlusRecordType;
class EMFWriter
{
@@ -53,9 +54,9 @@ private:
void ImplBeginRecord( sal_uInt32 nType );
void ImplEndRecord();
- void ImplBeginPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags );
+ void ImplBeginPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags );
void ImplEndPlusRecord();
- void ImplPlusRecord( sal_uInt16 nType, sal_uInt16 nFlags );
+ void ImplPlusRecord( EmfPlusRecordType nType, sal_uInt16 nFlags );
void ImplBeginCommentRecord( sal_Int32 nCommentType );
void ImplEndCommentRecord();
More information about the Libreoffice-commits
mailing list