[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-04-19 Thread Michael Meeks
 vcl/source/window/window.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 3430b5610b9740a592d9c2ca0634ddd04e1e3ca1
Author: Michael Meeks 
Date:   Wed Apr 19 01:19:59 2017 +0100

vcl: protect Window from exceptions during construction.

Probable fix for:

http://crashreport.libreoffice.org/stats/crash_details/f69188bd-0fdd-4b74-9ec6-35b544cba0c9

Change-Id: I6442451785867f0fc2daf84776118b092d4d6a18
Reviewed-on: https://gerrit.libreoffice.org/36653
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 6827da5052bfe975a3b34af8dfa8af75d41e904c)
Reviewed-on: https://gerrit.libreoffice.org/36675
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 722486cc490f..2cd6307b2829 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -530,6 +530,7 @@ void Window::dispose()
 }
 
 delete mpWindowImpl->mpWinData;
+mpWindowImpl->mpWinData = nullptr;
 
 // remove BorderWindow or Frame window data
 mpWindowImpl->mpBorderWindow.disposeAndClear();
@@ -556,11 +557,16 @@ void Window::dispose()
 SAL_WARN("vcl", "Window " << this << " marked as frame window, 
"
  "is missing from list of " << nWindows << " frames");
 }
-mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
-pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+if (mpWindowImpl->mpFrame) // otherwise exception during init
+{
+mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
+pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+}
 assert (mpWindowImpl->mpFrameData->mnFocusId == nullptr);
 assert (mpWindowImpl->mpFrameData->mnMouseMoveId == nullptr);
+
 delete mpWindowImpl->mpFrameData;
+mpWindowImpl->mpFrameData = nullptr;
 }
 
 // should be the last statements
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-03-29 Thread Michael Meeks
 vcl/source/window/window.cxx |   25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit b8381e0f275d1d1a6b4a737437905ace71f1fe3a
Author: Michael Meeks 
Date:   Tue Mar 28 10:35:50 2017 +0100

Attempted fix for mirrored geometry crasher.

Only plausible cause is pWindow->GetParent() being null, while
we have a pParent which has to be valid.


http://crashreport.libreoffice.org/stats/crash_details/6161398d-17b6-4a93-aa70-a559efa07868

Code was initially introduced in this form:
commit 4716735ba7d0ad133ff018481f94d6b4f201bbd9
Author: Stephan Schäfer 
Date:   Thu Sep 19 15:46:19 2002 +

#103362# improve positioning and resizing of system windows

No public report, sadly.  And modified by

commit fba46c6efd08d50fee92cc11546f3ed253a57af8
Author: Chris Sherlock 
Date:   Mon Feb 3 16:46:04 2014 +1100

fdo#74424 Use Window::GetOutDev() to access ImplReMirrored()

Part of the decoupling of Window from OutputDevice. We now get
he Window's OutputDevice instance and manipulate this. Do not rely
on the inherited function.

where the GetParent()/pWindow->GetParent() problem surfaces

Change-Id: Ia261028a4719525135e3fe4b00074427c1d9df6c
Reviewed-on: https://gerrit.libreoffice.org/35796
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit d93b8268da982ad26db9e03156ce9b89f3410486)
Reviewed-on: https://gerrit.libreoffice.org/35828
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 472b0f67c403..722486cc490f 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2750,7 +2750,7 @@ void Window::setPosSizePixel( long nX, long nY,
 mpWindowImpl->mbDefSize = false;
 
 // The top BorderWindow is the window which is to be positioned
-vcl::Window* pWindow = this;
+VclPtr pWindow = this;
 while ( pWindow->mpWindowImpl->mpBorderWindow )
 pWindow = pWindow->mpWindowImpl->mpBorderWindow;
 
@@ -2767,7 +2767,8 @@ void Window::setPosSizePixel( long nX, long nY,
 nHeight = pWindow->mnOutHeight;
 
 sal_uInt16 nSysFlags=0;
-vcl::Window *pParent = GetParent();
+VclPtr pParent = GetParent();
+VclPtr pWinParent = pWindow->GetParent();
 
 if( nFlags & PosSizeFlags::Width )
 nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
@@ -2776,9 +2777,9 @@ void Window::setPosSizePixel( long nX, long nY,
 if( nFlags & PosSizeFlags::X )
 {
 nSysFlags |= SAL_FRAME_POSSIZE_X;
-if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
+if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
 {
-nX += pParent->mnOutOffX;
+nX += pWinParent->mnOutOffX;
 }
 if( pParent && pParent->ImplIsAntiparallel() )
 {
@@ -2793,9 +2794,9 @@ void Window::setPosSizePixel( long nX, long nY,
 {
 // --- RTL ---  make sure the old right aligned position is not 
changed
 //  system windows will always grow to the right
-if ( pParent )
+if ( pWinParent )
 {
-OutputDevice *pParentOutDev = pParent->GetOutDev();
+OutputDevice *pParentOutDev = pWinParent->GetOutDev();
 if( pParentOutDev->HasMirroredGraphics() )
 {
 long myWidth = nOldWidth;
@@ -2805,13 +2806,13 @@ void Window::setPosSizePixel( long nX, long nY,
 myWidth = nWidth;
 nFlags |= PosSizeFlags::X;
 nSysFlags |= SAL_FRAME_POSSIZE_X;
-nX = 
pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
-
pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
+nX = 
pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
+
pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 
- mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
 if(!(nFlags & PosSizeFlags::Y))
 {
 nFlags |= PosSizeFlags::Y;
 nSysFlags |= SAL_FRAME_POSSIZE_Y;
-nY = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-02-13 Thread Caolán McNamara
 vcl/source/window/dialog.cxx |2 +-
 vcl/source/window/menu.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0d8746c091ce3e70340c431da8d35d453d2b3b2c
Author: Caolán McNamara 
Date:   Thu Feb 9 10:26:05 2017 +

Resolves: tdf#101972 skip invalidating labels on alt if autoaccel is 
disabled

so no Invalidate will be called if auto accelerators are not enabled
so there should be no blinking under windows

(cherry picked from commit f67dc04cfdd9e63a45ec6c8bc00829bce8f17d4b)

Change-Id: Iccc5dad7af41f39ac02d3be93e935f2d926a82a6
Reviewed-on: https://gerrit.libreoffice.org/34077
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index e160322..2cebcb1 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -598,7 +598,7 @@ IMPL_LINK_NOARG_TYPED(Dialog, ImplAsyncCloseHdl, void*, 
void)
 
 bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent )
 {
-if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && 
ImplGetSVData()->maNWFData.mbAutoAccel)
 {
 const CommandModKeyData *pCData = rCEvent.GetModKeyData ();
 bool bShowAccel =  pCData && pCData->IsMod2();
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a647e88..d7f6b08 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2570,7 +2570,7 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& 
rCEvent )
 MenuBarWindow* pWin = static_cast(ImplGetWindow());
 if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled()  && ! 
pWin->IsInModalMode() )
 {
-if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && 
ImplGetSVData()->maNWFData.mbAutoAccel)
 {
 const CommandModKeyData* pCData = rCEvent.GetModKeyData ();
 if (pWin->nHighlightedItem == ITEMPOS_INVALID)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-02-10 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   49 
 1 file changed, 30 insertions(+), 19 deletions(-)

New commits:
commit 43f36b8b10a36169fedff568c75c14e82703b979
Author: Caolán McNamara 
Date:   Thu Feb 9 09:21:39 2017 +

Resolves: ofz#576 unexpected exception with invalid fraction

(cherry picked from commit cff6cdb2ee37e836b9bab39500d24fcedc360121)

Change-Id: I1d653775e88e9fa2ba7b62fce39d52fc21ffe363
Reviewed-on: https://gerrit.libreoffice.org/34070
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 12dec2d..32648f7 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -129,19 +129,26 @@ void ImplWriteColor( SvStream& rOStm, const Color& rColor 
)
 rOStm.WriteInt16( nVal );
 }
 
-void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
+bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
 {
-Point   aOrg;
-sal_Int32   nXNum;
-sal_Int32   nXDenom;
-sal_Int32   nYNum;
-sal_Int32   nYDenom;
-sal_Int16   nUnit;
-
-rIStm.ReadInt16( nUnit );
-ReadPair( rIStm, aOrg );
-rIStm.ReadInt32( nXNum ).ReadInt32( nXDenom ).ReadInt32( nYNum 
).ReadInt32( nYDenom );
+sal_Int16 nUnit(0);
+rIStm.ReadInt16(nUnit);
+
+Point aOrg;
+ReadPair(rIStm, aOrg);
+
+sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
+
rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
+
+if (!rIStm.good() || nXDenom == 0 || nYDenom == 0)
+{
+SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode fraction");
+return false;
+}
+
 rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), 
Fraction( nYNum, nYDenom ) );
+
+return true;
 }
 
 void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
@@ -506,7 +513,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 boolbFatLine = false;
 
 // TODO: fix reindentation below if you can accept being blamed by the SCM
-MapMode aMapMode;
 tools::Polygon aActionPoly;
 Rectangle   aRect;
 Point   aPt, aPt1;
@@ -516,7 +522,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 sal_uInt32  nUnicodeCommentStreamPos = 0;
 sal_Int32   nUnicodeCommentActionNumber = 0;
 
-ImplReadMapMode( rIStm, aMapMode ); // MapMode
+rMtf.SetPrefSize( aPrefSz );
+
+MapMode aMapMode;
+if (ImplReadMapMode(rIStm, aMapMode))   // MapMode
+rMtf.SetPrefMapMode(aMapMode);
+
 sal_Int32 nActions(0);
 rIStm.ReadInt32( nActions );// Action count
 if (nActions < 0)
@@ -533,8 +544,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 nActions = nMaxPossibleActions;
 }
 
-rMtf.SetPrefSize( aPrefSz );
-rMtf.SetPrefMapMode( aMapMode );
 size_t nLastPolygonAction(0);
 
 for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
@@ -1059,11 +1068,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& 
rIStm, GDIMetaFile& rMtf )
 
 case GDI_MAPMODE_ACTION:
 {
-ImplReadMapMode( rIStm, aMapMode );
-rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
+if (ImplReadMapMode(rIStm, aMapMode))
+{
+rMtf.AddAction(new MetaMapModeAction(aMapMode));
 
-// #106172# Track font relevant data in shadow VDev
-aFontVDev->SetMapMode( aMapMode );
+// #106172# Track font relevant data in shadow VDev
+aFontVDev->SetMapMode(aMapMode);
+}
 }
 break;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-02-09 Thread Caolán McNamara
 vcl/source/gdi/pngread.cxx |   43 ++-
 1 file changed, 38 insertions(+), 5 deletions(-)

New commits:
commit 38f0a87ba8d840f7a79f6d466d833518470d337c
Author: Caolán McNamara 
Date:   Wed Jun 22 16:40:03 2016 +0100

ofz#574 sanitize png palette indexes

clarify we're not setting a pal index in the mask

no logic changed intended, SetPixelIndex expands
to this, just want to clarify that this is an alpha
value, not an index into a palette

(cherry picked from commit e5b23d924d60e7a0fb67c44c6dad3f4cb3bd5ddc)

Change-Id: I006ffdf5c8c751e7e07b133716022e2a9b154478
e9bb188b116adf3eab4e2bb1d6da8badbaead88b

crashtesting: fix tdf95481-1.odg reexport to odg failure

revealed since

commit 81e3ca4f60e6ac0823c1233841c22a759cfe937f
Author: Tor Lillqvist 
Date:   Tue Jun 21 10:34:21 2016 +0300

Use real assert() instead of DBG_ASSERT()

sanitize invalid palette entry indexes at the outer perimeter on initial 
load
to try and avoid having to do it in all sort of places in the interior.

png spec says that the palette has to appear before the first IDAT so we
should always know the palette size here

Change-Id: I6e04223adce1c88d037f9cf34862e6f54e381bb0
(cherry picked from commit 9d2fa0bfdc93fa9bfed7dea89d603b1611d7a6e0)
Reviewed-on: https://gerrit.libreoffice.org/34036
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 377d41b..e6c9abe 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1122,6 +1122,37 @@ void PNGReaderImpl::ImplApplyFilter()
 memcpy( mpScanPrior, mpInflateInBuf, mnScansize );
 }
 
+namespace
+{
+sal_uInt8 SanitizePaletteIndex(sal_uInt8 nIndex, sal_uInt16 
nPaletteEntryCount)
+{
+if (nIndex >= nPaletteEntryCount)
+{
+auto nSanitizedIndex = nIndex % nPaletteEntryCount;
+SAL_WARN_IF(nIndex != nSanitizedIndex, "vcl", "invalid colormap 
index: "
+<< static_cast(nIndex) << ", colormap 
len is: "
+<< nPaletteEntryCount);
+nIndex = nSanitizedIndex;
+}
+return nIndex;
+}
+
+void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, 
BitmapWriteAccess* pAcc)
+{
+sal_uInt16 nPaletteEntryCount = pAcc->GetPaletteEntryCount();
+for (int nX = 0; nX < nLen; ++nX)
+{
+if (pEntries[nX] >= nPaletteEntryCount)
+{
+SAL_WARN("vcl.gdi", "invalid colormap index: "
+  << static_cast(pEntries[nX]) << ", 
colormap len is: "
+  << nPaletteEntryCount);
+pEntries[nX] = pEntries[nX] % nPaletteEntryCount;
+}
+}
+}
+}
+
 // ImplDrawScanlines draws the complete Scanline (nY) into the target bitmap
 // In interlace mode the parameter nXStart and nXAdd append to the currently 
used pass
 
@@ -1137,7 +1168,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, 
sal_uInt32 nXAdd )
 // => TODO; also do this for nX here instead of in the ImplSet*Pixel() 
methods
 const sal_uInt32 nY = mnYpos >> mnPreviewShift;
 
-const sal_uInt8* pTmp = mpInflateInBuf + 1;
+sal_uInt8* pTmp = mpInflateInBuf + 1;
 if ( mpAcc->HasPalette() ) // alphachannel is not allowed by pictures 
including palette entries
 {
 switch ( mpAcc->GetBitCount() )
@@ -1304,6 +1335,8 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, 
sal_uInt32 nXAdd )
 if( nXAdd == 1 && mnPreviewShift == 0 )  // copy raw 
line data if possible
 {
 int nLineBytes = maOrigSize.Width();
+if (mbPalette)
+SanitizePaletteIndexes(pTmp, nLineBytes, 
mpAcc);
 mpAcc->CopyScanline( nY, pTmp, 
ScanlineFormat::N8BitPal, nLineBytes );
 }
 else
@@ -1592,7 +1625,7 @@ void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, 
sal_uInt32 nX, sal_uInt8 nPalIn
 return;
 nX >>= mnPreviewShift;
 
-mpAcc->SetPixelIndex( nY, nX, nPalIndex );
+mpAcc->SetPixelIndex(nY, nX, SanitizePaletteIndex(nPalIndex, 
mpAcc->GetPaletteEntryCount()));
 }
 
 void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const 
BitmapColor& rBitmapColor, bool bTrans )
@@ -1618,8 +1651,8 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, 
sal_uInt32 nX,
 return;
 nX >>= mnPreviewShift;
 
-mpAcc->SetPixelIndex( nY, nX, nPalIndex );
-mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
+mpAcc->SetPixelIndex(nY, nX, SanitizePaletteIndex(nPalIndex, 
mpAcc->GetPaletteEntryCount()));
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-02-02 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx |   23 +++
 1 file changed, 23 insertions(+)

New commits:
commit 264f2265884b3d50103a5315c6bd46df3be04451
Author: Miklos Vajna 
Date:   Wed Feb 1 10:52:19 2017 +0100

tdf#105461 PDF export: handle text fill color

Text portion level background in Writer text was working already, as
Writer paints its background explicitly, and then uses no text fill
color in the metafile (that is turned into a PDF later).

However, text fill color is used for Writer shape text and also in
Impress. The rectangle is not just the text itself, but also the ascent
/ descent region, this matches the desktop rendering result.

(cherry picked from commit ee32c7d8083ae1449d6b379034be92995c142da9)

Change-Id: I644007ade43a8b9e663890643b826ae12c427ea5
Reviewed-on: https://gerrit.libreoffice.org/33795
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 458ecba..e138f38 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9014,6 +9014,29 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, 
const OUString& rText, bool
 }
 }
 
+if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT))
+{
+// PDF doesn't have a text fill color, so draw a rectangle before
+// drawing the actual text.
+push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+setFillColor(m_aCurrentPDFState.m_aFont.GetFillColor());
+// Avoid border around the rectangle for Writer shape text.
+setLineColor(Color(COL_TRANSPARENT));
+
+// The rectangle is the bounding box of the text, but also includes
+// ascent / descent to match the on-screen rendering.
+Rectangle aRectangle;
+// This is the top left of the text without ascent / descent.
+
aRectangle.SetPos(m_pReferenceDevice->PixelToLogic(rLayout.GetDrawPosition()));
+aRectangle.setY(aRectangle.getY() - aRefDevFontMetric.GetAscent());
+
aRectangle.SetSize(m_pReferenceDevice->PixelToLogic(Size(rLayout.GetTextWidth(),
 0)));
+// This includes ascent / descent.
+aRectangle.setHeight(aRefDevFontMetric.GetLineHeight());
+drawRectangle(aRectangle);
+
+pop();
+}
+
 Point aAlignOffset;
 if ( eAlign == ALIGN_BOTTOM )
 aAlignOffset.Y() -= aRefDevFontMetric.GetDescent();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-02-01 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d3e76140637691ea6afe2aa0d73d1297f9ede0d8
Author: Caolán McNamara 
Date:   Tue Jan 31 09:23:09 2017 +

ofz#502 negative index

Change-Id: I2eb3da9d378cd8fdace5ccd644f501f5119f6698
Reviewed-on: https://gerrit.libreoffice.org/33741
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 81e04b9..12dec2d 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -940,7 +940,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 // #106172# Add last DX array elem, if missing
 if( nAryLen != nStrLen )
 {
-if( nAryLen+1 == nStrLen )
+if (nAryLen+1 == nStrLen && nIndex >= 0)
 {
 std::unique_ptr pTmpAry(new 
long[nStrLen]);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-26 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   64 
 1 file changed, 39 insertions(+), 25 deletions(-)

New commits:
commit 9d238724fbe68f7732477898a32b55f7cc970923
Author: Caolán McNamara 
Date:   Thu Jan 19 16:56:34 2017 +

Resolves: ofz#424 guard against broken dxary length

ofz#424 vcl: reset nLen too
(cherry picked from commit 7f5a10a3aaf8b48156aeab168afb7648dae1e020)

Change-Id: Ia2569e963edd75cd6c27399d33e73bafe8b3f073
Reviewed-on: https://gerrit.libreoffice.org/33321
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 3a6e961..81e04b9 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -906,6 +906,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 OUString aStr(OStringToOUString(aByteStr, 
eActualCharSet));
 
 std::unique_ptr pDXAry;
+sal_Int32 nDXAryLen = 0;
 if (nAryLen > 0)
 {
 const size_t nMinRecordSize = sizeof(sal_Int32);
@@ -919,36 +920,49 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 sal_Int32 nStrLen( aStr.getLength() );
 
-pDXAry.reset(new long[ std::max( nAryLen, nStrLen 
) ]);
+nDXAryLen = std::max(nAryLen, nStrLen);
+pDXAry.reset(new long[nDXAryLen]);
 
-for (sal_Int32 j = 0; j < nAryLen; ++j)
-rIStm.ReadInt32( nTmp ), pDXAry[ j ] = nTmp;
-
-// #106172# Add last DX array elem, if missing
-if( nAryLen != nStrLen )
+if (nDXAryLen < nLen)
+{
+//MetaTextArrayAction ctor expects pDXAry to 
be >= nLen if set, so if this can't
+//be achieved, don't read it, it's utterly 
broken.
+SAL_WARN("vcl.gdi", "dxary too short, 
discarding completely");
+rIStm.SeekRel(sizeof(sal_Int32) * nDXAryLen);
+nLen = 0;
+nIndex = 0;
+}
+else
 {
-if( nAryLen+1 == nStrLen )
+for (sal_Int32 j = 0; j < nAryLen; ++j)
+rIStm.ReadInt32( nTmp ), pDXAry[ j ] = 
nTmp;
+
+// #106172# Add last DX array elem, if missing
+if( nAryLen != nStrLen )
 {
-std::unique_ptr pTmpAry(new 
long[nStrLen]);
-
-aFontVDev->GetTextArray( aStr, 
pTmpAry.get(), nIndex, nLen );
-
-// now, the difference between the
-// last and the second last DX array
-// is the advancement for the last
-// glyph. Thus, to complete our meta
-// action's DX array, just add that
-// difference to last elem and store
-// in very last.
-if( nStrLen > 1 )
-pDXAry[ nStrLen-1 ] = pDXAry[ 
nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
+if( nAryLen+1 == nStrLen )
+{
+std::unique_ptr pTmpAry(new 
long[nStrLen]);
+
+aFontVDev->GetTextArray( aStr, 
pTmpAry.get(), nIndex, nLen );
+
+// now, the difference between the
+// last and the second last DX array
+// is the advancement for the last
+// glyph. Thus, to complete our meta
+// action's DX array, just add that
+// difference to last elem and store
+// in very last.
+if( nStrLen > 1 )
+pDXAry[ nStrLen-1 ] = pDXAry[ 
nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
+else
+pDXAry[ nStrLen-1 ] = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-26 Thread Caolán McNamara
 vcl/source/filter/wmf/emfwr.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit cf730cae337d06ac4efa72c9248b194d60d91c88
Author: Caolán McNamara 
Date:   Wed Jan 25 16:51:00 2017 +

Resolves: tdf#94457 our EmfPlusSetPageTransform is malformed

we write a single short, resulting in a record of 0x000C in length 
MS-EMFPLUS
spec has EmfPlusSetPageTransform as 0x0010 in length because we're not 
writing
the 4 byte PageScale value.

the previous pageunit unit we are writing is of value 1, which is
UnitTypeDisplay, the same spec says...

"The unit of measure for page space coordinates, from the UnitType 
enumeration.
This value SHOULD NOT be UnitTypeDisplay or UnitTypeWorld"

and footnotes that with...

"Windows never writes those values to the PageUnit field, but they are 
accepted
with undefined results."

Change-Id: Ic8b5ec463b59aab28ae9897947dfcdbd35b22048
Reviewed-on: https://gerrit.libreoffice.org/33560
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 5ac14fb..10f6a07 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -239,7 +239,6 @@ void EMFWriter::WriteEMFPlusHeader( const Size 
, const Size 
 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();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-26 Thread Caolán McNamara
 vcl/source/filter/wmf/winmtf.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4f8205659a810e4f89ff1fc0148393aefec53f97
Author: Caolán McNamara 
Date:   Sat Jan 21 17:13:47 2017 +

ofz#439 protect against 0 len text

Change-Id: Ib67284636235b0d43df626a4aeed67f2bc64b491
Reviewed-on: https://gerrit.libreoffice.org/33376
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 2228bbc..09b0521 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1442,9 +1442,9 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& 
rText, long* pDXArry, b
 sal_Int32 nTextWidth;
 pVDev->SetMapMode( MapMode( MAP_100TH_MM ) );
 pVDev->SetFont( maFont );
-if( pDXArry )
+const sal_uInt32 nLen = pDXArry ? rText.getLength() : 0;
+if (nLen)
 {
-sal_uInt32 nLen = rText.getLength();
 nTextWidth = pVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
 if( nLen > 1 )
 nTextWidth += pDXArry[ nLen - 2 ];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-25 Thread Caolán McNamara
 vcl/source/gdi/metaact.cxx  |2 +-
 vcl/source/gdi/svmconverter.cxx |9 +
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6872899cc1716f251988dfb3c86aa04c716cfda4
Author: Caolán McNamara 
Date:   Wed Jan 25 09:21:25 2017 +

ofz#463 unable to mmap

Reviewed-on: https://gerrit.libreoffice.org/33519
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit f6c465bc8e7583a8321f5c881cb008b980e0e3fa)

Change-Id: I509faeda019f42bbe7cdc5fc249f2ea2076bb702
Reviewed-on: https://gerrit.libreoffice.org/33522
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 7bfa151..ac229f0 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1114,7 +1114,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& 
rStartPt,
 {
 const sal_Int32 nAryLen = pDXAry ? mnLen : 0;
 
-if( nAryLen )
+if (nAryLen > 0)
 {
 mpDXAry = new long[ nAryLen ];
 memcpy( mpDXAry, pDXAry, nAryLen * sizeof(long) );
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index b1a1c7a..3a6e961 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -908,6 +908,15 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 std::unique_ptr pDXAry;
 if (nAryLen > 0)
 {
+const size_t nMinRecordSize = sizeof(sal_Int32);
+const size_t nMaxRecords = rIStm.remainingSize() / 
nMinRecordSize;
+if (static_cast(nAryLen) > nMaxRecords)
+{
+SAL_WARN("vcl.gdi", "Parsing error: " << 
nMaxRecords <<
+ " max possible entries, but " << 
nAryLen << " claimed, truncating");
+nAryLen = nMaxRecords;
+}
+
 sal_Int32 nStrLen( aStr.getLength() );
 
 pDXAry.reset(new long[ std::max( nAryLen, nStrLen 
) ]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-18 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 237e4d7c6349f8a97657e055b7479158460d6ac8
Author: Caolán McNamara 
Date:   Wed Jan 18 09:03:23 2017 +

ofz#419 same problem as wmf and emf

this is the *third* effective copy of this, see

the other two uses of LF_FACESIZE in wmf parsing

Change-Id: I475b18314784ad072fe58730c361fc5ca6e65819
Reviewed-on: https://gerrit.libreoffice.org/33257
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 80a5104..b1a1c7a 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -464,6 +464,8 @@ SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& 
rMtf, sal_uLong nConver
 }
 }
 
+#define LF_FACESIZE 32
+
 void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
 {
 const sal_uLong nPos = rIStm.Tell();
@@ -823,7 +825,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 case GDI_FONT_ACTION:
 {
 vcl::Font   aFont;
-charaName[ 32 ];
+charaName[LF_FACESIZE+1];
 sal_Int32   nWidth, nHeight;
 sal_Int16   nCharSet, nFamily, nPitch, nAlign, nWeight, 
nUnderline, nStrikeout;
 sal_Int16   nCharOrient, nLineOrient;
@@ -831,7 +833,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 ImplReadColor( rIStm, aActionColor ); aFont.SetColor( 
aActionColor );
 ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( 
aActionColor );
-rIStm.Read( aName, 32 );
+size_t nRet = rIStm.Read(aName, LF_FACESIZE);
+aName[nRet] = 0;
 aFont.SetFamilyName( OUString( aName, strlen(aName), 
rIStm.GetStreamCharSet() ) );
 rIStm.ReadInt32( nWidth ).ReadInt32( nHeight );
 rIStm.ReadInt16( nCharOrient ).ReadInt16( nLineOrient );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-18 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

New commits:
commit 4afd555fe234ca2c784bb9c2ee7c79d592d82eb6
Author: Caolán McNamara 
Date:   Wed Jan 18 09:43:17 2017 +

ofz: reduce scope, check stream, validate nActions

(cherry picked from commit bd78b28a1233e26c023a52df6b119d60a61d53ad)

Change-Id: Ie420ad40b0d852708828620cd26c2f746398f5a8
Reviewed-on: https://gerrit.libreoffice.org/33260
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index f28daa6..80a5104 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -473,12 +473,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 charaCode[ 5 ];
 SizeaPrefSz;
-sal_Int16   nSize;
-sal_Int16   nVersion;
 
 // read header
 rIStm.Read( aCode, sizeof( aCode ) );  // Identifier
+sal_Int16 nSize(0);
 rIStm.ReadInt16( nSize ); // Size
+sal_Int16 nVersion(0);
 rIStm.ReadInt16( nVersion );  // Version
 sal_Int32 nTmp32(0);
 rIStm.ReadInt32( nTmp32 );
@@ -510,24 +510,37 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 Point   aPt, aPt1;
 SizeaSz;
 Color   aActionColor;
-sal_Int32   nTmp, nTmp1, nActionSize;
-sal_Int32   nActions;
-sal_Int16   nType;
 
 sal_uInt32  nUnicodeCommentStreamPos = 0;
 sal_Int32   nUnicodeCommentActionNumber = 0;
 
 ImplReadMapMode( rIStm, aMapMode ); // MapMode
-rIStm.ReadInt32( nActions );  // Action 
count
+sal_Int32 nActions(0);
+rIStm.ReadInt32( nActions );// Action count
+if (nActions < 0)
+{
+SAL_WARN("vcl.gdi", "svm claims negative action count (" << 
nActions << ")");
+nActions = 0;
+}
+
+const size_t nMinActionSize = sizeof(sal_uInt16) + sizeof(sal_Int32);
+const size_t nMaxPossibleActions = rIStm.remainingSize() / 
nMinActionSize;
+if (static_cast(nActions) > nMaxPossibleActions)
+{
+SAL_WARN("vcl.gdi", "svm claims more actions (" << nActions << ") 
than stream could provide, truncating");
+nActions = nMaxPossibleActions;
+}
 
 rMtf.SetPrefSize( aPrefSz );
 rMtf.SetPrefMapMode( aMapMode );
 size_t nLastPolygonAction(0);
 
-for (sal_Int32 i = 0; i < nActions; ++i)
+for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
 {
+sal_Int16 nType(0);
 rIStm.ReadInt16( nType );
 sal_Int32 nActBegin = rIStm.Tell();
+sal_Int32 nActionSize(0);
 rIStm.ReadInt32( nActionSize );
 
 DBG_ASSERT( ( nType <= 33 ) || ( nType >= 1024 ), "Unknown 
GDIMetaAction while converting!" );
@@ -664,6 +677,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 case GDI_RECT_ACTION:
 {
 ImplReadRect( rIStm, aRect );
+sal_Int32 nTmp(0), nTmp1(0);
 rIStm.ReadInt32( nTmp ).ReadInt32( nTmp1 );
 
 if( nTmp || nTmp1 )
@@ -855,7 +869,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_TEXT_ACTION:
 {
-sal_Int32   nIndex, nLen;
+sal_Int32 nIndex(0), nLen(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp );
 if (nTmp > 0)
@@ -876,7 +890,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_TEXTARRAY_ACTION:
 {
-sal_Int32   nIndex, nLen, nAryLen;
+sal_Int32 nIndex(0), nLen(0), nAryLen(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp ).ReadInt32( nAryLen );
 if (nTmp > 0)
@@ -935,7 +949,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_STRETCHTEXT_ACTION:
 {
-sal_Int32   nIndex, nLen, nWidth;
+sal_Int32 nIndex(0), nLen(0), nWidth(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp ).ReadInt32( nWidth );
 if (nTmp > 0)
@@ -1088,6 +1102,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_MOVECLIPREGION_ACTION:

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-17 Thread Caolán McNamara
 vcl/source/filter/ixpm/xpmread.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 3c4e7d1eaf18de200560f13cc0b84673507deb5c
Author: Caolán McNamara 
Date:   Tue Jan 17 12:35:24 2017 +

ofz#411: XPMReader::ImplGetColKey short read

Change-Id: I2e47ef6478b8349a562b294d0fbdad65c2a3b543
Reviewed-on: https://gerrit.libreoffice.org/33218
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index bca7f11e0..264139a 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -66,7 +66,7 @@ private:
 sal_uLong   mnWidth;
 sal_uLong   mnHeight;
 sal_uLong   mnColors;
-sal_uLong   mnCpp;  // characters 
per pix
+sal_uInt32  mnCpp;  // characters 
per pix
 boolmbTransparent;
 boolmbStatus;
 sal_uLong   mnStatus;
@@ -305,9 +305,12 @@ bool XPMReader::ImplGetColor( sal_uLong nNumb )
 sal_uInt8*  pPtr =  ( mpColMap + nNumb * ( 4 + mnCpp ) );
 boolbStatus = ImplGetString();
 
-if ( bStatus )
+if (bStatus && mnStringSize < mnCpp)
+bStatus = false;
+
+if (bStatus)
 {
-for ( sal_uLong i = 0; i < mnCpp; i++ )
+for (sal_uInt32 i = 0; i < mnCpp; ++i)
 *pPtr++ = *pString++;
 bStatus = ImplGetColSub ( pPtr );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-13 Thread Caolán McNamara
 vcl/source/filter/ixpm/xpmread.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit fc342c44c46287bbeb8bfb76d93fe601c87b8c5f
Author: Caolán McNamara 
Date:   Fri Jan 13 11:41:55 2017 +

ofz: ensure all not explicitly set indexes are zero

Change-Id: Idbe6ceeb61d3dfe26f281349181e7a60f7e59000
(cherry picked from commit 14d9b3519adac8543b52ddb84e49eecbdd1d9eb2)
Reviewed-on: https://gerrit.libreoffice.org/33036
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index b757709..bca7f11e0 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -223,7 +223,9 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
 // using 2 charakters per pixel and less than 257 
Colors we speed up
 if ( mnCpp == 2 )   // by using a 64kb indexing 
table
 {
-mpFastColorTable = new sal_uInt8[ 256 * 256 ];
+const size_t nSize = 256 * 256;
+mpFastColorTable = new sal_uInt8[nSize];
+memset(mpFastColorTable, 0, nSize);
 for ( pPtr = mpColMap, i = 0; i < mnColors; 
i++, pPtr += mnCpp + 4 )
 {
 sal_uLong   j =  pPtr[ 0 ] << 8;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-09 Thread Caolán McNamara
 vcl/source/filter/ixbm/xbmread.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 864e59042bf4475428e182aa93256aaef2ac4e2e
Author: Caolán McNamara 
Date:   Mon Jan 9 09:05:12 2017 +

ofz#394 xbm ParseDefine problem

Change-Id: I75fb761d23fdb3780088a9d209200429edb57a26
Reviewed-on: https://gerrit.libreoffice.org/32878
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/vcl/source/filter/ixbm/xbmread.cxx 
b/vcl/source/filter/ixbm/xbmread.cxx
index a8a59a7..96e7ae3 100644
--- a/vcl/source/filter/ixbm/xbmread.cxx
+++ b/vcl/source/filter/ixbm/xbmread.cxx
@@ -174,11 +174,11 @@ long XBMReader::ParseDefine( const sal_Char* pDefine )
 cTmp = *pTmp--;
 
 // search last digit
-while( pHexTable[ cTmp ] == -1 )
+while (pHexTable[ cTmp ] == -1 && pTmp >= pDefine)
 cTmp = *pTmp--;
 
 // move before number
-while( pHexTable[ cTmp ] != -1 )
+while (pHexTable[ cTmp ] != -1 && pTmp >= pDefine)
 cTmp = *pTmp--;
 
 // move to start of number
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-09 Thread Michael Meeks
 vcl/source/window/window2.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 62b77a31119c23a8617e161a2d4f4d4e1e97eb2c
Author: Michael Meeks 
Date:   Fri Jan 6 15:23:30 2017 +

tdf#105151 - be more conservative about EndTracking / Tracking calls.

We really shouldn't be emitting these into widgets after they are
disposed - it serves only to confuse things. Restore behaviour to how
it was before the VclPtr change for this.

Change-Id: Ife666929f8aac0e4431a5e43970769692c11888c
Reviewed-on: https://gerrit.libreoffice.org/32785
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit d788d37a16d382d7ff32a19e8d65e5c605ac55dd)
Reviewed-on: https://gerrit.libreoffice.org/32819
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 79ae5c5..5d427cc 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -371,7 +371,11 @@ void Window::EndTracking( TrackingEventFlags nFlags )
mpWindowImpl->mpFrameData->mnMouseCode,
mpWindowImpl->mpFrameData->mnMouseCode );
 TrackingEvent   aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
-Tracking( aTEvt );
+// CompatTracking effectively
+if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+return Window::Tracking( aTEvt );
+else
+return Tracking( aTEvt );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-04 Thread Caolán McNamara
 vcl/source/filter/wmf/enhwmf.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit f84516a348ea8e05bbf89816505a6041e711ebfd
Author: Caolán McNamara 
Date:   Thu Dec 22 13:35:31 2016 +

Resolves: ofz#313 cbBmiSrc > getDIBV5HeaderSize

Change-Id: I67fb67dc0a4cb609b8f1391c1eb6dd395755a933
(cherry picked from commit 7485fc2a1484f31631f62f97e5c64c0ae74c6416)
(cherry picked from commit 371f0f6770add78ae81e0f769d0490874bca353c)
Reviewed-on: https://gerrit.libreoffice.org/32338
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index ebb42cf..9faca40 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1252,13 +1252,22 @@ bool EnhWMFReader::ReadEnhWMF()
 else
 {
 const sal_uInt32 nSourceSize = cbBmiSrc + cbBitsSrc + 
14;
-if ( nSourceSize <= ( nEndPos - nStartPos ) )
+bool bSafeRead = nSourceSize <= (nEndPos - nStartPos);
+sal_uInt32 nDeltaToDIB5HeaderSize(0);
+const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
+if (bSafeRead && bReadAlpha)
 {
 // we need to read alpha channel data if 
AlphaFormat of BLENDFUNCTION is
 // AC_SRC_ALPHA (==0x01). To read it, create a 
temp DIB-File which is ready
 // for DIB-5 format
-const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
-const sal_uInt32 nDeltaToDIB5HeaderSize(bReadAlpha 
? getDIBV5HeaderSize() - cbBmiSrc : 0);
+const sal_uInt32 nHeaderSize = 
getDIBV5HeaderSize();
+if (cbBmiSrc > nHeaderSize)
+bSafeRead = false;
+else
+nDeltaToDIB5HeaderSize = nHeaderSize - 
cbBmiSrc;
+}
+if (bSafeRead)
+{
 const sal_uInt32 nTargetSize(cbBmiSrc + 
nDeltaToDIB5HeaderSize + cbBitsSrc + 14);
 char* pBuf = new char[ nTargetSize ];
 SvMemoryStream aTmp( pBuf, nTargetSize, 
StreamMode::READ | StreamMode::WRITE );
@@ -1277,7 +1286,7 @@ bool EnhWMFReader::ReadEnhWMF()
 pWMF->Seek( nStart + offBmiSrc );
 pWMF->Read( pBuf + 14, cbBmiSrc );
 
-if(bReadAlpha)
+if (bReadAlpha)
 {
 // need to add values for all stuff that 
DIBV5Header is bigger
 // than DIBInfoHeader, all values are 
correctly initialized to zero,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-02 Thread Caolán McNamara
 vcl/source/control/edit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a6eecb4ee85148d8a6a1697d794f9f8acc3d1562
Author: Caolán McNamara 
Date:   Mon Dec 19 11:15:06 2016 +

Related: rhbz#1405521 abrt reported crash in dnd

Change-Id: I8d8f9379d36dd3dd1a8973cd9f9c14860765630b
Reviewed-on: https://gerrit.libreoffice.org/32178
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 6b6f002..5966c0d 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2903,7 +2903,7 @@ void Edit::dragDropEnd( const 
css::datatransfer::dnd::DragSourceDropEvent& rDSDE
 {
 SolarMutexGuard aVclGuard;
 
-if ( rDSDE.DropSuccess && ( rDSDE.DropAction & 
datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
+if (rDSDE.DropSuccess && (rDSDE.DropAction & 
datatransfer::dnd::DNDConstants::ACTION_MOVE) && mpDDInfo)
 {
 Selection aSel( mpDDInfo->aDndStartSel );
 if ( mpDDInfo->bDroppedInMe )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-02 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 03b6eff8ba1d7102608221e6bf94f581aba2ee9d
Author: Caolán McNamara 
Date:   Thu Dec 22 11:09:08 2016 +

valgrind: stick 0 at end of successfully read data

(cherry picked from commit 0dfc6f70ab53a773ee05664235d7c8927ab20f2c)
(cherry picked from commit 3ea598f65bed096dbf4bda5fe4105b57c58b5310)

Change-Id: Id79f68c9095ab313ac05d2c8b55df71788df81d3
Reviewed-on: https://gerrit.libreoffice.org/32335
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index c4f7e78..0b7b207 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -886,7 +886,6 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 {
 Size aFontSize;
 char lfFaceName[LF_FACESIZE+1];
-lfFaceName[LF_FACESIZE] = 0;
 sal_Int16 lfEscapement = 0;
 sal_Int16 lfOrientation = 0;
 sal_Int16 lfWeight = 0;
@@ -904,7 +903,8 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 pWMF->ReadUChar( aLogFont.lfClipPrecision );
 pWMF->ReadUChar( aLogFont.lfQuality );
 pWMF->ReadUChar( aLogFont.lfPitchAndFamily );
-pWMF->Read( lfFaceName, LF_FACESIZE );
+size_t nRet = pWMF->Read( lfFaceName, LF_FACESIZE );
+lfFaceName[nRet] = 0;
 aLogFont.lfWidth = aFontSize.Width();
 aLogFont.lfHeight = aFontSize.Height();
 aLogFont.lfEscapement = lfEscapement;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2017-01-02 Thread Caolán McNamara
 vcl/source/gdi/dibtools.cxx |   64 +---
 1 file changed, 48 insertions(+), 16 deletions(-)

New commits:
commit 18c7f4fbb156455f74564d16ff807c2242ffe761
Author: Caolán McNamara 
Date:   Thu Dec 22 10:51:39 2016 +

Resolves: ofz#310: Sanitize 1 bit bitmap palette indexes too

(cherry picked from commit b08e48166310ab8a53f06f4fee227a948416cf4a)
(cherry picked from commit 3bff2da31ed580817f6b5b653f48727e38078af5)

crashtesting: fix bmp->odg failure...

id:000178,src:00,op:havoc,rep:16.bmp
id:000383,src:47,op:flip2,pos:18,+cov.bmp
id:000403,src:47,op:arith32,pos:22,val:-33.bmp
id:000317,src:25,op:havoc,rep:8.bmp
id:000119,src:00,op:havoc,rep:16.bmp
id:000167,src:00,op:havoc,rep:8.bmp

revealed since

commit 81e3ca4f60e6ac0823c1233841c22a759cfe937f
Author: Tor Lillqvist 
Date:   Tue Jun 21 10:34:21 2016 +0300

Use real assert() instead of DBG_ASSERT()

sanitize invalid palette entry indexes at the outer perimeter on initial 
load
to try and avoid having to do it in all sort of places in the interior.

we load the palette before getting here, so we should always know the 
palette size here

(cherry picked from commit 92cee94a262a3a2f43c87bb940c50cb90a2ebd89)

Change-Id: Ied2b71eb1c9088bbbff5fed97f7a04b43f4b4827
Reviewed-on: https://gerrit.libreoffice.org/32333
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 75e39e6..f45fa3d 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -331,6 +331,22 @@ bool ImplReadDIBPalette( SvStream& rIStm, 
BitmapWriteAccess& rAcc, bool bQuad )
 return( rIStm.GetError() == 0UL );
 }
 
+namespace
+{
+sal_uInt8 SanitizePaletteIndex(sal_uInt8 nIndex, bool bHasPalette, 
sal_uInt16 nPaletteEntryCount)
+{
+if (bHasPalette && nIndex >= nPaletteEntryCount)
+{
+auto nSanitizedIndex = nIndex % nPaletteEntryCount;
+SAL_WARN_IF(nIndex != nSanitizedIndex, "vcl", "invalid colormap 
index: "
+<< static_cast(nIndex) << ", colormap 
len is: "
+<< nPaletteEntryCount);
+nIndex = nSanitizedIndex;
+}
+return nIndex;
+}
+}
+
 bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, 
BitmapWriteAccess& rAcc, bool bRLE4 )
 {
 Scanline pRLE = pBuffer;
@@ -342,6 +358,8 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& 
rHeader, BitmapWriteAccess&
 sal_uLong   nX = 0UL;
 sal_uInt8   cTmp;
 boolbEndDecoding = false;
+const bool bHasPalette = rAcc.HasPalette();
+const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount();
 
 do
 {
@@ -367,10 +385,10 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& 
rHeader, BitmapWriteAccess&
 cTmp = *pRLE++;
 
 if( nX < nWidth )
-rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
+rAcc.SetPixelIndex(nY, nX++, 
SanitizePaletteIndex(cTmp >> 4, bHasPalette, nPaletteEntryCount));
 
 if( nX < nWidth )
-rAcc.SetPixelIndex( nY, nX++, cTmp & 0x0f );
+rAcc.SetPixelIndex(nY, nX++, 
SanitizePaletteIndex(cTmp & 0x0f, bHasPalette, nPaletteEntryCount));
 }
 
 if( nRunByte & 1 )
@@ -379,7 +397,7 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& 
rHeader, BitmapWriteAccess&
 return false;
 
 if( nX < nWidth )
-rAcc.SetPixelIndex( nY, nX++, *pRLE >> 4 );
+rAcc.SetPixelIndex(nY, nX++, 
SanitizePaletteIndex(*pRLE >> 4, bHasPalette, nPaletteEntryCount));
 
 pRLE++;
 }
@@ -400,7 +418,7 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& 
rHeader, BitmapWriteAccess&
 return false;
 
 if( nX < nWidth )
-rAcc.SetPixelIndex( nY, nX++, *pRLE );
+rAcc.SetPixelIndex(nY, nX++, 
SanitizePaletteIndex(*pRLE, bHasPalette, nPaletteEntryCount));
 
 pRLE++;
 }
@@ -447,19 +465,19 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& 
rHeader, BitmapWriteAccess&
 for( sal_uLong i = 0UL; i < nRunByte; i++ )
 {
 if( nX < nWidth )
-rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
+rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp 
>> 4, bHasPalette, nPaletteEntryCount));
 
 if( nX 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-12-09 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6715b5730e3373bcb55a4fba504d88b89f5ec917
Author: Caolán McNamara 
Date:   Fri Dec 9 15:26:59 2016 +

oss-fuzz we don't want this stream to automatically resize on seeks past end

Change-Id: Ie42b2e173cd3ed9faaf17c3c978227613129fa84
(cherry picked from commit f212bd45a7c7d97fb16380cd9fa7c6abbfb71e05)
(cherry picked from commit b832d7019f7e7499f5fb3da5d5f49ddbf0f35585)
Reviewed-on: https://gerrit.libreoffice.org/31803
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index ae5cc87..1c65342 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -1092,7 +1092,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 {   // first EMF comment
 nEMFRecCount= nComRecCount;
 nEMFSize= nEMFTotalSize;
-pEMFStream = 
o3tl::make_unique( nEMFSize );
+pEMFStream = 
o3tl::make_unique(nEMFSize, 0);
 }
 else if( ( nEMFRecCount != nComRecCount ) || ( 
nEMFSize != nEMFTotalSize ) ) // add additional checks here
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-12-07 Thread Julien Nabet
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b35798df2c1f6a05d8a3a28843c64c6da548f741
Author: Julien Nabet 
Date:   Thu Oct 13 21:22:55 2016 +0200

tdf#34212: Accented Characters and Umlauts are missing with Type1 fonts

Following the revert of previous patch:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=297b22bd49ea11a90063ab8503fb83090f351668
Gilbert Röhrbein proposed this patch
See https://bugs.documentfoundation.org/show_bug.cgi?id=34212#c14

Change-Id: I1a30427cd88f5602e7633894ba35307104c2ed8d
Reviewed-on: https://gerrit.libreoffice.org/29792
Tested-by: Jenkins 
Reviewed-by: jan iversen 
(cherry picked from commit 52040395e3046ac42b8c3dd385c7b1cb26b929f3)
Reviewed-on: https://gerrit.libreoffice.org/30852
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 3891303..458ecba 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3539,7 +3539,7 @@ std::map< sal_Int32, sal_Int32 > 
PDFWriterImpl::emitEmbeddedFont( const Physical
 "IsSymbolFont() && ( pEncoding == nullptr || 
pFont->GetCharSet() == RTL_TEXTENCODING_MS_1252 ))
 aLine.append( "/Encoding/WinAnsiEncoding\n" );
 if( nToUnicodeStream )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-11-30 Thread Marco Cecchetti
 vcl/source/gdi/pdfextoutdevdata.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 1fd5c8080c47e75fff4aa377540ced29142da146
Author: Marco Cecchetti 
Date:   Fri Nov 25 10:23:31 2016 +0100

tdf#101458 - check PNG for adequate compression

Change-Id: I7131d3b721ebb4d47b0bb43f09fcb9767f8ac6d8
Reviewed-on: https://gerrit.libreoffice.org/31190
Reviewed-by: Marco Cecchetti 
Tested-by: Marco Cecchetti 
(cherry picked from commit d96781383747299443f61e027285d54ffd5bc5c8)
Reviewed-on: https://gerrit.libreoffice.org/31412

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index 1a58c90..811d618 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -420,9 +420,10 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, 
sal_uInt32& rCurGDIMtfAc
 if ( !mbGroupIgnoreGDIMtfActions )
 mCurrentGraphic = rGraphic;
 }
-else if ( eType == GFX_LINK_TYPE_NATIVE_PNG )
+else if ( eType == GFX_LINK_TYPE_NATIVE_PNG && 
mParaRects.size() >= 2 )
 {
-mCurrentGraphic = rGraphic;
+if ( 
rOutDevData.HasAdequateCompression(rGraphic, mParaRects[0], mParaRects[1]) )
+mCurrentGraphic = rGraphic;
 }
 }
 break;
@@ -805,7 +806,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const 
Graphic ,
 {
 bool bReduceResolution = false;
 
-assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == 
GFX_LINK_TYPE_NATIVE_JPG );
+assert( rGraphic.IsLink() && (rGraphic.GetLink().GetType() == 
GFX_LINK_TYPE_NATIVE_JPG || rGraphic.GetLink().GetType() == 
GFX_LINK_TYPE_NATIVE_PNG));
 
 // small items better off as PNG anyway
 if ( rGraphic.GetSizePixel().Width() < 32 &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-11-28 Thread Michael Meeks
 vcl/source/window/window.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 77b65e3e7ae04f6f00f2cadda9fd80176fe0dec1
Author: Michael Meeks 
Date:   Sat Nov 26 15:47:15 2016 +

tdf#101327 - tolerate exceptions during window construction better.

It appears we can end up being a frame window, which is not added
into the list of frames; so tolerate that.

Change-Id: I7696e79636f7794f327027f0ca73363eef1937e5
Reviewed-on: https://gerrit.libreoffice.org/31235
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit 115671bf929a82709c535b475bf19f4967a666c8)
Reviewed-on: https://gerrit.libreoffice.org/31255
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f00022e..472b0f6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -539,12 +539,22 @@ void Window::dispose()
 pSVData->maWinData.mpFirstFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
 else
 {
+sal_Int32 nWindows = 0;
 vcl::Window* pSysWin = pSVData->maWinData.mpFirstFrame;
-while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != 
this )
+while ( pSysWin && 
pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != this )
+{
 pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
+nWindows++;
+}
 
-assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != pSysWin);
-pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
+if ( pSysWin )
+{
+assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != 
pSysWin);
+pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
+}
+else // if it is not in the list, we can't remove it.
+SAL_WARN("vcl", "Window " << this << " marked as frame window, 
"
+ "is missing from list of " << nWindows << " frames");
 }
 mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
 pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source vcl/unx

2016-11-23 Thread Caolán McNamara
 vcl/source/window/syswin.cxx  |4 
 vcl/unx/gtk3/gtk3gtkframe.cxx |4 +++-
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 37ded4ac7b1fe91bb08eaada29d3514570432073
Author: Caolán McNamara 
Date:   Tue Nov 15 15:05:44 2016 +

Resolves: tdf#102957 revert SetMinOutputSizePixel workaround

of

commit afeddaf7e0d11ad9b1df0c80bcc3f50caa87e21a
Author: Caolán McNamara 
Date:   Wed Dec 16 10:46:10 2015 +

Related: rhbz#1281906 set a min size on un-resizeable non-layout dialogs

and using a mixture of gtk_window_set_default_size before its visible, and
gtk_window_set_default_size + gtk_window_resize after its shown now works 
for
me under wayland so the original problem can be solved that way

Change-Id: Iaf8fd3019a7e902ad07b6825f919c6f25288e9b7
(cherry picked from commit 7e2ef433d29fca84ed27a9203b5761dc8dbd8bf8)
Reviewed-on: https://gerrit.libreoffice.org/30875
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 660328b..6603de2 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1113,10 +1113,6 @@ void SystemWindow::DoInitialLayout()
 mbIsCalculatingInitialLayoutSize = false;
 mbInitialLayoutDone = true;
 }
-else if (IsDialog() && !(GetStyle() & WB_SIZEABLE))
-{
-SetMinOutputSizePixel(GetSizePixel());
-}
 }
 
 void SystemWindow::doDeferredInit(WinBits /*nBits*/)
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index ecd77ee..d74f7b8 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -884,7 +884,9 @@ void GtkSalFrame::window_resize(long nWidth, long nHeight)
 {
 m_nWidthRequest = nWidth;
 m_nHeightRequest = nHeight;
-gtk_window_resize(GTK_WINDOW(m_pWindow), nWidth, nHeight);
+gtk_window_set_default_size(GTK_WINDOW(m_pWindow), nWidth, nHeight);
+if (gtk_widget_get_visible(m_pWindow))
+gtk_window_resize(GTK_WINDOW(m_pWindow), nWidth, nHeight);
 }
 
 void GtkSalFrame::resizeWindow( long nWidth, long nHeight )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-11-23 Thread Caolán McNamara
 vcl/source/window/floatwin.cxx   |   11 ---
 vcl/source/window/menufloatingwindow.cxx |6 +++---
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 5210e1ba38bfe996a888f21673640de13b49508b
Author: Caolán McNamara 
Date:   Mon Nov 14 11:33:24 2016 +

Resolves: tdf#103914 if menu no longer has focus, leave focus where it is

In the normal course of events, the menu, or its children, has focus when 
its
popped down, in this case continue to restored the focus to the previous 
focus
window which had it when the menu appeared.

If some other non-child window of the menu has focus as popdown time, leave
the focus where it is.

Change-Id: Ia860f90350653ad4d8056738dacbc434fb364989
(cherry picked from commit 616bc7b854e237aea1962a6750abd7f139e38ac2)
Reviewed-on: https://gerrit.libreoffice.org/30862
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index c24706b..e1fb623 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -793,12 +793,17 @@ void FloatingWindow::ImplEndPopupMode( 
FloatWinPopupEndFlags nFlags, const VclPt
 {
 Show( false, ShowFlags::NoFocusChange );
 
-// maybe pass focus on to a suitable FloatingWindow
-if ( xFocusId != nullptr )
-Window::EndSaveFocus( xFocusId );
+if (HasChildPathFocus() && xFocusId != nullptr)
+{
+// restore focus to previous focus window if we still have the 
focus
+Window::EndSaveFocus(xFocusId);
+}
 else if ( pSVData->maWinData.mpFocusWin && 
pSVData->maWinData.mpFirstFloat &&
   ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) )
+{
+// maybe pass focus on to a suitable FloatingWindow
 pSVData->maWinData.mpFirstFloat->GrabFocus();
+}
 mbPopupModeTearOff = false;
 }
 else
diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index 52ccac0..0602461 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -403,11 +403,11 @@ void MenuFloatingWindow::End()
 if (GetParent() && !GetParent()->IsDisposed())
 GetParent()->ImplDecModalCount();
 
-// restore focus
+// restore focus to previous window if we still have the focus
 VclPtr xFocusId(xSaveFocusId);
-if (xFocusId != nullptr)
+xSaveFocusId = nullptr;
+if (HasChildPathFocus() && xFocusId != nullptr)
 {
-xSaveFocusId = nullptr;
 ImplGetSVData()->maWinData.mbNoDeactivate = false;
 Window::EndSaveFocus(xFocusId);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-11-17 Thread Thorsten Behrens
 vcl/source/gdi/mapmod.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit cbac26485f1456b70c51969a1df11bf08643d894
Author: Thorsten Behrens 
Date:   Tue Nov 15 04:11:08 2016 +0100

fix tdf#101832 and tdf#100617

OutDev mapmode takes shortcuts for 'simple' mappings, so clear that flag
once we set scale/origin away from defaults.

Change-Id: I00321e27322d9cb8b86e6cc8400f6396d03328cc
Reviewed-on: https://gerrit.libreoffice.org/30855
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 5d1a788468ef94cd1de4400d3c1e38d768f7bf8d)
Reviewed-on: https://gerrit.libreoffice.org/30876
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index 70b2065..7d304be 100644
--- a/vcl/source/gdi/mapmod.cxx
+++ b/vcl/source/gdi/mapmod.cxx
@@ -115,18 +115,21 @@ void MapMode::SetMapUnit( MapUnit eUnit )
 void MapMode::SetOrigin( const Point& rLogicOrg )
 {
 mpImplMapMode->maOrigin = rLogicOrg;
+mpImplMapMode->mbSimple = false;
 }
 
 void MapMode::SetScaleX( const Fraction& rScaleX )
 {
 mpImplMapMode->maScaleX = rScaleX;
 mpImplMapMode->maScaleX.ReduceInaccurate(32);
+mpImplMapMode->mbSimple = false;
 }
 
 void MapMode::SetScaleY( const Fraction& rScaleY )
 {
 mpImplMapMode->maScaleY = rScaleY;
 mpImplMapMode->maScaleY.ReduceInaccurate(32);
+mpImplMapMode->mbSimple = false;
 }
 
 double MapMode::GetUnitMultiplier() const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-10-27 Thread Julien Nabet
 vcl/source/gdi/pdfextoutdevdata.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 873929d14aa4013eb3dac216db9b828ff01e8d8f
Author: Julien Nabet 
Date:   Sat Oct 22 20:06:26 2016 +0200

tdf#99723: target ratio must be reached

to be sure we can avoid decompressing/recompressing

Regression from 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=76ec54e8c9f3580450bca85236a4f5af0c328588

Change-Id: Iacd7b2419ea85756f936b17f04c4e495d15e5b81
Reviewed-on: https://gerrit.libreoffice.org/30163
Tested-by: Jenkins 
Reviewed-by: Björn Michaelsen 
(cherry picked from commit 88fb9d8f0aae0030fac75156f78818affae4298f)
Reviewed-on: https://gerrit.libreoffice.org/30265
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index 34d0c1b..1a58c90 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -830,14 +830,18 @@ bool PDFExtOutDevData::HasAdequateCompression( const 
Graphic ,
 { 80, 1500 }, { 75, 1700 }
 };
 sal_Int32 nTargetRatio = 1;
+bool bIsTargetRatioReached = false;
 for (auto & rRatio : aRatios)
 {
 if ( mnCompressionQuality > rRatio.mnQuality )
+{
+bIsTargetRatioReached = true;
 break;
+}
 nTargetRatio = rRatio.mnRatio;
 }
 
-return nCurrentRatio > nTargetRatio;
+return ((nCurrentRatio > nTargetRatio) && bIsTargetRatioReached);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-10-18 Thread Caolán McNamara
 vcl/source/control/spinfld.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 1b1a2703aeea3c81e2153b04e2f4685f9840819a
Author: Caolán McNamara 
Date:   Tue Oct 18 12:01:44 2016 +0100

Resolves: tdf#97065 gtk3: Date field displayed incomplete

a spinfield with a dropdown is sort of weird, we should
probably revisit this and see if SPIN and DROPDOWN
are mutually exclusive and for DROPDOWN use ComboBox styles

(cherry picked from commit 276732f3068cac65dd607b4f78abdcd918ed30ad)

Change-Id: Id7f5c54974dc2dfd63ab30df18e14f6a67a8ea90
Reviewed-on: https://gerrit.libreoffice.org/30005
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index c8a601d..246f5a6 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -738,7 +738,9 @@ void SpinField::Resize()
 
 // adjust position and size of the edit field
 if (GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT, aArea, 
ControlState::NONE,
-   aControlValue, OUString(), aBound, 
aContent))
+   aControlValue, OUString(), aBound, 
aContent) &&
+// there is just no useful native support for spinfields with 
dropdown
+!(GetStyle() & WB_DROPDOWN))
 {
 // convert back from border space to local coordinates
 aPoint = 
pBorder->ScreenToOutputPixel(OutputToScreenPixel(aPoint));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-10-18 Thread Caolán McNamara
 vcl/source/gdi/pdfwriter_impl.cxx |   36 +---
 1 file changed, 33 insertions(+), 3 deletions(-)

New commits:
commit ac245ef35b6a70474909a66e8988ee225321e9b4
Author: Caolán McNamara 
Date:   Thu Oct 13 20:14:03 2016 +0100

Resolves: tdf#103051 pdf export assumed 1bit bitmaps were N1BitMsbPal

Change-Id: I2268d8b74f187d07f161f42cc9530be3ebbc86d0
(cherry picked from commit 1c9096dad7dc2ee25d9ebe16ab02d5caba5f8a79)
Reviewed-on: https://gerrit.libreoffice.org/29794
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 3101d98..3891303 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11128,6 +11128,36 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject )
 }
 }
 
+namespace
+{
+unsigned char reverseByte(unsigned char b)
+{
+b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
+b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
+b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
+return b;
+}
+
+//tdf#103051 convert any N1BitLsbPal to N1BitMsbPal
+Bitmap getExportBitmap(const Bitmap )
+{
+Bitmap::ScopedReadAccess pAccess(const_cast(rBitmap));
+const ScanlineFormat eFormat = pAccess->GetScanlineFormat();
+if (eFormat != ScanlineFormat::N1BitLsbPal)
+return rBitmap;
+Bitmap aNewBmp(rBitmap);
+Bitmap::ScopedWriteAccess xWriteAcc(aNewBmp);
+const int nScanLineBytes = (pAccess->Width() + 7U) / 8U;
+for (long nY = 0L; nY < xWriteAcc->Height(); ++nY)
+{
+Scanline pBitSwap = xWriteAcc->GetScanline(nY);
+for (int x = 0; x < nScanLineBytes; ++x)
+pBitSwap[x] = reverseByte(pBitSwap[x]);
+}
+return aNewBmp;
+}
+}
+
 bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
 {
 CHECK_RETURN( updateObject( rObject.m_nObject ) );
@@ -11137,7 +11167,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& 
rObject, bool bMask )
 boolbWriteMask = false;
 if( ! bMask )
 {
-aBitmap = rObject.m_aBitmap.GetBitmap();
+aBitmap = getExportBitmap(rObject.m_aBitmap.GetBitmap());
 if( rObject.m_aBitmap.IsAlpha() )
 {
 if( m_aContext.Version >= PDFWriter::PDF_1_4 )
@@ -11166,13 +11196,13 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& 
rObject, bool bMask )
 {
 if( m_aContext.Version < PDFWriter::PDF_1_4 || ! 
rObject.m_aBitmap.IsAlpha() )
 {
-aBitmap = rObject.m_aBitmap.GetMask();
+aBitmap = getExportBitmap(rObject.m_aBitmap.GetMask());
 aBitmap.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
 DBG_ASSERT( aBitmap.GetBitCount() == 1, "mask conversion failed" );
 }
 else if( aBitmap.GetBitCount() != 8 )
 {
-aBitmap = rObject.m_aBitmap.GetAlpha().GetBitmap();
+aBitmap = 
getExportBitmap(rObject.m_aBitmap.GetAlpha().GetBitmap());
 aBitmap.Convert( BMP_CONVERSION_8BIT_GREYS );
 DBG_ASSERT( aBitmap.GetBitCount() == 8, "alpha mask conversion 
failed" );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-09-15 Thread Caolán McNamara
 vcl/source/window/taskpanelist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 436e616fead1c372827fd18fe388cfa6cf4049a3
Author: Caolán McNamara 
Date:   Mon Sep 12 17:08:28 2016 +0100

Resolves: tdf#101879 explicitly put menubars at the start of task lists

Change-Id: Ia6a36b08f84960b01472833504cd65bfbad473eb
(cherry picked from commit 830ac71eca425caf04764076e3064b5f1ad05c52)
Reviewed-on: https://gerrit.libreoffice.org/28878
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/taskpanelist.cxx 
b/vcl/source/window/taskpanelist.cxx
index 4e995a5..21b94d2 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -96,7 +96,7 @@ void TaskPaneList::AddWindow( vcl::Window *pWindow )
 {
 if( pWindow )
 {
-auto insertionPos = mTaskPanes.end();
+auto insertionPos = dynamic_cast(pWindow) ? 
mTaskPanes.begin() : mTaskPanes.end();
 for ( auto p = mTaskPanes.begin(); p != mTaskPanes.end(); ++p )
 {
 if ( *p == pWindow )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-08-09 Thread Caolán McNamara
 vcl/source/control/edit.cxx   |5 +
 vcl/source/edit/vclmedit.cxx  |7 +--
 vcl/source/window/window2.cxx |2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 1449d36eaf926ef321568253b68c546acee2f4db
Author: Caolán McNamara 
Date:   Thu Aug 4 12:12:40 2016 +0100

Resolves: tdf#97120 printing controls uses wrong font and font sizes

regression apparently since

commit 825b3df7f1d987021ec4a08ff8e7ed78e5772c97
Date:   Thu Oct 22 19:03:01 2015 +0200

tdf#94138 fix printing of edit form fields

revert the GetDrawPixelFont part of that so the font is pulled
from the control and not the device its printed to, this makes
tdf#97120 and tdf#97120 work properly again

then revert

commit 6c41727484a04ab89005ffb052937dae5d7dc223
Date:   Tue Dec 1 17:44:23 2015 +0100

tdf#94138 Use correct fonts for multiline edit when printing

because that replicates the original GetDrawPixelFont behaviour
so its not needed after the other revert.

Then, to solve the original tdf#94138, in the edit StateChanged handler call
ApplySettings(*this); like FixedText::StateChanged does to merge in the
controlfont setting to the underlying OutputDevice of the control, which
presumably is what is then retrieved from GetDrawPixelFont

Change-Id: I992a0e2011ffce7748d39f7f2bc49fbf6b8eaa79
(cherry picked from commit 5a5db03acc605a02c76c0f2977079b3dcf48de22)
Reviewed-on: https://gerrit.libreoffice.org/27879
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index aab72e8..33032c3 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2268,6 +2268,7 @@ void Edit::StateChanged( StateChangedType nType )
 {
 if (!mpSubEdit)
 {
+ApplySettings(*this);
 ImplShowCursor();
 Invalidate();
 }
@@ -2276,6 +2277,7 @@ void Edit::StateChanged( StateChangedType nType )
 {
 if (!mpSubEdit)
 {
+ApplySettings(*this);
 ImplShowCursor();
 Invalidate();
 }
@@ -2284,6 +2286,7 @@ void Edit::StateChanged( StateChangedType nType )
 {
 if (!mpSubEdit)
 {
+ApplySettings(*this);
 Invalidate();
 }
 }
@@ -2291,6 +2294,7 @@ void Edit::StateChanged( StateChangedType nType )
 {
 if (!mpSubEdit)
 {
+ApplySettings(*this);
 Invalidate();
 }
 }
@@ -2307,6 +2311,7 @@ void Edit::DataChanged( const DataChangedEvent& rDCEvt )
 {
 if ( !mpSubEdit )
 {
+ApplySettings(*this);
 ImplShowCursor();
 Invalidate();
 }
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 7f25066..cd1adb6 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -1365,12 +1365,7 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const 
Point& rPos, const Size&
 Point aPos = pDev->LogicToPixel( rPos );
 Size aSize = pDev->LogicToPixel( rSize );
 
-vcl::Font aFont = pImpVclMEdit->GetTextWindow()->GetPointFont(*this);
-Size aFontSize = aFont.GetFontSize();
-MapMode aPtMapMode(MAP_POINT);
-aFontSize = pDev->LogicToPixel(aFontSize, aPtMapMode);
-aFont.SetFontSize(aFontSize);
-
+vcl::Font aFont = pImpVclMEdit->GetTextWindow()->GetDrawPixelFont(pDev);
 aFont.SetTransparent( true );
 OutDevType eOutDevType = pDev->GetOutDevType();
 
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index cd67ca6..3cd36e24 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -654,7 +654,7 @@ Size Window::CalcOutputSize( const Size& rWinSz ) const
 
 vcl::Font Window::GetDrawPixelFont(OutputDevice* pDev) const
 {
-vcl::Font aFont = GetPointFont(*pDev);
+vcl::Font aFont = GetPointFont(*const_cast(this));
 Size aFontSize = aFont.GetFontSize();
 MapMode aPtMapMode(MAP_POINT);
 aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-08-08 Thread Markus Mohrhard
 vcl/source/filter/GraphicNativeMetadata.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 8452bef1c2cc7585582875fd3216ed4003b817cc
Author: Markus Mohrhard 
Date:   Mon Aug 8 04:52:28 2016 +0200

don't try to memcpy from and to a nullptr

See e.g.

http://crashreport.libreoffice.org/stats/crash_details/2218a489-b64c-4193-a7d4-cd01c6a607cb

Change-Id: I6c123d3e9e5c6dbcb7756a686503904cbfd944a4
Reviewed-on: https://gerrit.libreoffice.org/27948
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 
(cherry picked from commit 855df248c8a380e253a35feefec21ebc1dee1aca)
Reviewed-on: https://gerrit.libreoffice.org/27978
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx 
b/vcl/source/filter/GraphicNativeMetadata.cxx
index 532e2d4..8904577 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -37,7 +37,11 @@ bool GraphicNativeMetadata::read(Graphic& rGraphic)
 GfxLink aLink = rGraphic.GetLink();
 if ( aLink.GetType() != GFX_LINK_TYPE_NATIVE_JPG )
 return false;
+
 sal_uInt32 aDataSize = aLink.GetDataSize();
+if (!aDataSize)
+return false;
+
 std::unique_ptr aBuffer(new sal_uInt8[aDataSize]);
 
 memcpy(aBuffer.get(), aLink.GetData(), aDataSize);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-08-02 Thread Caolán McNamara
 vcl/source/window/menufloatingwindow.cxx |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit d013a5a38c6460a22434c6ba637c63d2118f12dc
Author: Caolán McNamara 
Date:   Tue Aug 2 13:08:39 2016 +0100

Related: tdf#92516 make menu accelerators always work even if...

keyboard not used yet.

The gtk2/3 menus appear to work this way. (And when not in gtk2/3
it shouldn't disable the accelerators for other platforms anyway)

(cherry picked from commit f6d0d92a5e249413df99a7f3677a28efe6d45426)

Change-Id: Ib7a99bd9039cd07120b3b77380f810b5b028fd57
Reviewed-on: https://gerrit.libreoffice.org/27794
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index c00a869..20cb2e5 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -1101,18 +1101,9 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& 
rKEvent )
 sal_Unicode nCharCode = rKEvent.GetCharCode();
 sal_uInt16 nPos = 0;
 sal_uInt16 nDuplicates = 0;
-MenuItemData* pData = (nCharCode && pMenu) ?
+MenuItemData* pData = (nCharCode && pMenu && 
ImplGetSVData()->maNWFData.mbEnableAccel) ?
 pMenu->GetItemList()->SearchItem(nCharCode, 
rKEvent.GetKeyCode(), nPos, nDuplicates, nHighlightedItem) : nullptr;
-bool bConsume = false;
-bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
-if (pData && accel)
-{
-Menu *men = pMenu;
-while (men && !men->IsMenuBar())
-men = men->pStartedFrom;
-bConsume = !men || 
(static_cast(men->pWindow.get()))->GetMBWMenuKey();
-}
-if (bConsume)
+if (pData)
 {
 if ( pData->pSubMenu || nDuplicates > 1 )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-07-25 Thread Caolán McNamara
 vcl/source/gdi/pdfextoutdevdata.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 8c04534c4a9272d3b35c619d18edb34ef16e63f2
Author: Caolán McNamara 
Date:   Fri Jul 22 16:30:14 2016 +0100

Resolves: tdf#100838 no transparency support on using original jpg data path

This became a problem since...

commit 76ec54e8c9f3580450bca85236a4f5af0c328588
Author: Michael Meeks 
Date:   Mon Feb 8 14:24:15 2016 +

tdf#97662 - Try to preserve original compressed JPEGs harder.

Avoiding de-compressing and re-compressing them saves lots of time too.

for the default JPEG Compress + Reduce Image resolution case

but appears to always be a problem with the Lossless - Reduce Image 
resolution
case.

Change-Id: I24c69a59a16d69817e402cd87f84e744ee146a66
(cherry picked from commit c72db36c7c791b1f92d3dd29fbc40c8ef168c609)
Reviewed-on: https://gerrit.libreoffice.org/27446
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index 03ed698..34d0c1b 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -442,7 +442,8 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, 
sal_uInt32& rCurGDIMtfAc
 Graphic   aGraphic( mGraphics.front() );
 
 mGraphics.pop_front();
-mParaInts.pop_front(); //Transparency
+sal_Int32 nTransparency = mParaInts.front();
+mParaInts.pop_front();
 aOutputRect = mParaRects.front();
 mParaRects.pop_front();
 aVisibleOutputRect = mParaRects.front();
@@ -463,7 +464,15 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, 
sal_uInt32& rCurGDIMtfAc

aVisibleOutputRect.Right(), aVisibleOutputRect.Bottom() ) ) );
 rWriter.SetClipRegion( aRect);
 }
+
 Bitmap aMask;
+if (nTransparency)
+{
+AlphaMask aAlphaMask(aGraphic.GetSizePixel());
+aAlphaMask.Erase(nTransparency);
+aMask = aAlphaMask.GetBitmap();
+}
+
 SvMemoryStream aTmp;
 const sal_uInt8* pData = aGfxLink.GetData();
 sal_uInt32 nBytes = aGfxLink.GetDataSize();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-07-25 Thread Caolán McNamara
 vcl/source/control/field2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 87aae2e900da3cc441497c6b1666a143108baf0e
Author: Caolán McNamara 
Date:   Thu Jul 21 12:18:36 2016 +0100

Resolves: tdf#100558 last 'section' of date field not incremented

presumably a regression from...

commit 3cad6c806e5247ce20b78eb688551aa5d872b934
Author: Chr. Rossmanith 
Date:   Fri Mar 1 21:47:10 2013 +0100

Replace (Xub)String with OUString in vcl(field)

where UniString::Search returned a max short on not-found
while OUString::indexOf returns a -1

Change-Id: Ia3ef80dd318375ccdb3bdcee9bed7b70bf67cae1
(cherry picked from commit 82913e694a4169f9ddeef399e659aec78cc9c8d6)
Reviewed-on: https://gerrit.libreoffice.org/27374
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index b3e7c8fb..0a136da 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1342,7 +1342,7 @@ void DateField::ImplDateSpinArea( bool bUp )
 for ( sal_Int8 i = 1; i <= 3; i++ )
 {
 nPos = aText.indexOf( aDateSep, nPos );
-if ( nPos >= (sal_Int32)aSelection.Max() )
+if (nPos < 0 || nPos >= (sal_Int32)aSelection.Max())
 {
 nDateArea = i;
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-07-15 Thread Caolán McNamara
 vcl/source/control/listbox.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 4dbcd1649d4be5366362cdbcb85c1f0566fa082d
Author: Caolán McNamara 
Date:   Wed Jul 13 16:32:43 2016 +0100

Related: rhbz#1343766 a11y queries during dispose trigger listbox crashes

though not able to reproduce, I have an in-house complaint similar to

commit f120abb446bf3f5230ed06a3b148654dde36bb94
Author: Caolán McNamara 
Date:   Wed Jun 8 11:35:15 2016 +0100

Resolves: rhbz#1343766 a11y queries during dispose trigger combobox 
crashes

except with a listbox in the bt

Change-Id: Id31561e009a1f0ec9272a0e7216296e4017e5688
(cherry picked from commit c615943bda57eadfa73c14a7314938aabe0bd16f)
Reviewed-on: https://gerrit.libreoffice.org/27188
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index f5d0dad..a5dbe99 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -1189,6 +1189,8 @@ void ListBox::EnableMultiSelection( bool bMulti, bool 
bStackSelection )
 
 bool ListBox::IsMultiSelectionEnabled() const
 {
+if (!mpImplLB)
+return false;
 return mpImplLB->IsMultiSelectionEnabled();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-07-11 Thread Caolán McNamara
 vcl/source/gdi/bitmap.cxx |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

New commits:
commit a1979c74cf072feac6c39399eee35ffba4319639
Author: Caolán McNamara 
Date:   Mon Jul 11 10:13:16 2016 +0100

Resolves: tdf#100463 tolerence in contour editor doesn't work

probably since

commit f51f03a46102333bac6a7fe06bc8538492f413a5
Author: Stephan Bergmann 
Date:   Wed Mar 5 12:24:14 2014 +0100

Do not needlessly truncate MinMax argument before comparison with bounds

Change-Id: I5c92f0af3e05ad68ed88fa860b36e8426e160bf9
(cherry picked from commit d5bd18ecac5806b7b4e39a1919b6b56df0f94ce3)
Reviewed-on: https://gerrit.libreoffice.org/27101
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index b30c71e..63425de 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1221,12 +1221,12 @@ Bitmap Bitmap::CreateMask( const Color& rTransColor, 
sal_uLong nTol ) const
 {
 BitmapColor aCol;
 longnR, nG, nB;
-const long  nMinR = MinMax( (long) rTransColor.GetRed() - 
nTol, 0, 255 );
-const long  nMaxR = MinMax( (long) rTransColor.GetRed() + 
nTol, 0, 255 );
-const long  nMinG = MinMax( (long) rTransColor.GetGreen() - 
nTol, 0, 255 );
-const long  nMaxG = MinMax( (long) rTransColor.GetGreen() + 
nTol, 0, 255 );
-const long  nMinB = MinMax( (long) rTransColor.GetBlue() - 
nTol, 0, 255 );
-const long  nMaxB = MinMax( (long) rTransColor.GetBlue() + 
nTol, 0, 255 );
+const long  nMinR = MinMax(rTransColor.GetRed() - nTol, 
0, 255);
+const long  nMaxR = MinMax(rTransColor.GetRed() + nTol, 
0, 255);
+const long  nMinG = MinMax(rTransColor.GetGreen() - 
nTol, 0, 255);
+const long  nMaxG = MinMax(rTransColor.GetGreen() + 
nTol, 0, 255);
+const long  nMinB = MinMax(rTransColor.GetBlue() - nTol, 
0, 255);
+const long  nMaxB = MinMax(rTransColor.GetBlue() + nTol, 
0, 255);
 
 if( pReadAcc->HasPalette() )
 {
@@ -1538,12 +1538,12 @@ bool Bitmap::Replace( const Color& rSearchColor, const 
Color& rReplaceColor, sal
 
 if( pAcc )
 {
-const long  nMinR = MinMax( (long) rSearchColor.GetRed() - nTol, 0, 
255 );
-const long  nMaxR = MinMax( (long) rSearchColor.GetRed() + nTol, 0, 
255 );
-const long  nMinG = MinMax( (long) rSearchColor.GetGreen() - nTol, 0, 
255 );
-const long  nMaxG = MinMax( (long) rSearchColor.GetGreen() + nTol, 0, 
255 );
-const long  nMinB = MinMax( (long) rSearchColor.GetBlue() - nTol, 0, 
255 );
-const long  nMaxB = MinMax( (long) rSearchColor.GetBlue() + nTol, 0, 
255 );
+const long  nMinR = MinMax(rSearchColor.GetRed() - nTol, 0, 255);
+const long  nMaxR = MinMax(rSearchColor.GetRed() + nTol, 0, 255);
+const long  nMinG = MinMax(rSearchColor.GetGreen() - nTol, 0, 
255);
+const long  nMaxG = MinMax(rSearchColor.GetGreen() + nTol, 0, 
255);
+const long  nMinB = MinMax(rSearchColor.GetBlue() - nTol, 0, 
255);
+const long  nMaxB = MinMax(rSearchColor.GetBlue() + nTol, 0, 
255);
 
 if( pAcc->HasPalette() )
 {
@@ -1622,12 +1622,12 @@ bool Bitmap::Replace( const Color* pSearchColors, const 
Color* pReplaceColors,
 const Color&rCol = pSearchColors[ i ];
 const long  nTol = pTols[ i ];
 
-pMinR[ i ] = MinMax( (long) rCol.GetRed() - nTol, 0, 255 );
-pMaxR[ i ] = MinMax( (long) rCol.GetRed() + nTol, 0, 255 );
-pMinG[ i ] = MinMax( (long) rCol.GetGreen() - nTol, 0, 255 );
-pMaxG[ i ] = MinMax( (long) rCol.GetGreen() + nTol, 0, 255 );
-pMinB[ i ] = MinMax( (long) rCol.GetBlue() - nTol, 0, 255 );
-pMaxB[ i ] = MinMax( (long) rCol.GetBlue() + nTol, 0, 255 );
+pMinR[ i ] = MinMax(rCol.GetRed() - nTol, 0, 255);
+pMaxR[ i ] = MinMax(rCol.GetRed() + nTol, 0, 255);
+pMinG[ i ] = MinMax(rCol.GetGreen() - nTol, 0, 255);
+pMaxG[ i ] = MinMax(rCol.GetGreen() + nTol, 0, 255);
+pMinB[ i ] = MinMax(rCol.GetBlue() - nTol, 0, 255);
+pMaxB[ i ] = MinMax(rCol.GetBlue() + nTol, 0, 255);
 }
 
 if( pAcc->HasPalette() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-06-09 Thread Caolán McNamara
 vcl/source/window/menufloatingwindow.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 7def34c0f013b0c9ac1b8ee39e800577bfa800e7
Author: Caolán McNamara 
Date:   Thu Jun 9 17:02:14 2016 +0100

Resolves: tdf#100248 vcl menu scroll timer still active post dispose

Change-Id: I8988a42e7e505c967661c4a5f3c1e4ef3fbc08e0
(cherry picked from commit f89b9d8b8064a2f323f5b3362f88cb873bad8fcc)

diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index 50c8f23..c00a869 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -98,6 +98,12 @@ void MenuFloatingWindow::doShutdown()
 }
 pMenu = nullptr;
 RemoveEventListener( LINK( this, MenuFloatingWindow, ShowHideListener 
) );
+
+aScrollTimer.Stop();
+aSubmenuCloseTimer.Stop();
+aSubmenuCloseTimer.Stop();
+aHighlightChangedTimer.Stop();
+aHighlightChangedTimer.Stop();
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-06-08 Thread Caolán McNamara
 vcl/source/control/combobox.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit f7b0cbf1df98a1c42fe25cfdbd9977fba78347c8
Author: Caolán McNamara 
Date:   Wed Jun 8 11:35:15 2016 +0100

Resolves: rhbz#1343766 a11y queries during dispose trigger combobox crashes

Change-Id: I29863ca95e64ccd31795f78c29c89ff35009d718
(cherry picked from commit f120abb446bf3f5230ed06a3b148654dde36bb94)

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 3bd8197..19cdfbc 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1015,11 +1015,15 @@ OUString ComboBox::GetEntry( sal_Int32 nPos ) const
 
 sal_Int32 ComboBox::GetEntryCount() const
 {
+if (!m_pImpl->m_pImplLB)
+return 0;
 return m_pImpl->m_pImplLB->GetEntryList()->GetEntryCount() - 
m_pImpl->m_pImplLB->GetEntryList()->GetMRUCount();
 }
 
 bool ComboBox::IsTravelSelect() const
 {
+if (!m_pImpl->m_pImplLB)
+return false;
 return m_pImpl->m_pImplLB->IsTravelSelect();
 }
 
@@ -1036,6 +1040,8 @@ void ComboBox::EnableMultiSelection( bool bMulti )
 
 bool ComboBox::IsMultiSelectionEnabled() const
 {
+if (!m_pImpl->m_pImplLB)
+return false;
 return m_pImpl->m_pImplLB->IsMultiSelectionEnabled();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-06-07 Thread Stephan Bergmann
 vcl/source/app/svmain.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1faaad816c7af25c692733e9651923ff18d82ac1
Author: Stephan Bergmann 
Date:   Sun May 29 20:56:20 2016 +0200

loplugin:simplifybool

Change-Id: I4a07ec3eb9ab3d01c6104346a9bd9654bdcb1efe
(cherry picked from commit cc6599137796797772b3395c79b35af48e368cce)
Reviewed-on: https://gerrit.libreoffice.org/26032
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 69ab53b..2ebb805 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -304,7 +304,7 @@ bool InitVCL()
 pSVData->maGDIData.mpScreenFontCache= new ImplFontCache;
 pSVData->maGDIData.mpGrfConverter   = new GraphicConverter;
 
-g_bIsLeanException = getenv("LO_LEAN_EXCEPTION") ? true : false;
+g_bIsLeanException = getenv("LO_LEAN_EXCEPTION") != nullptr;
 // Set exception handler
 pExceptionHandler = osl_addSignalHandler(VCLExceptionSignal_impl, nullptr);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-06-07 Thread Michael Stahl
 vcl/source/filter/igif/gifread.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4b1956ffeb82d3425bd041e6731be802b76c1d03
Author: Michael Stahl 
Date:   Thu Jun 2 14:11:40 2016 +0200

vcl: GIF import: don't use __LP64__ to check for a 64-bit system

__LP64__ is not defined in MSVC AMD64 builds, since it doesn't have
64-bit longs.  This caused the vcl_filters_test to fail because loading
the file for which that check is a work-around succeeded.

Change-Id: I4df48d4b196a1d08e9bd5ef61b64ec63501037c9
(cherry picked from commit f6ed2305abb0289ad51605ceeaee607a0bc8d7bd)
Reviewed-on: https://gerrit.libreoffice.org/25989
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index aac672f..f008b1b 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -172,7 +172,7 @@ void GIFReader::CreateBitmaps( long nWidth, long nHeight, 
BitmapPalette* pPal,
 {
 const Size aSize( nWidth, nHeight );
 
-#ifdef __LP64__
+#if SAL_TYPES_SIZEOFPOINTER == 8
 // Don't bother allocating a bitmap of a size that would fail on a
 // 32-bit system. We have at least one unit tests that is expected
 // to fail (loading a 65535*65535 size GIF
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-06-07 Thread Michael Stahl
 vcl/source/filter/sgvmain.cxx |  348 ++
 vcl/source/filter/sgvmain.hxx |1 
 2 files changed, 216 insertions(+), 133 deletions(-)

New commits:
commit 683d7260e1a193a82e5341700c253561ee3fee42
Author: Michael Stahl 
Date:   Thu Jun 2 12:54:36 2016 +0200

vcl: fix "sgv" import filter on 64-bit MSVC

This filter reads entire structs at a time from the SvStream, including
structs that are derived from other structs.  This happens to work fine
with GCC by chance, but MSVC AMD64 by default aligns structs to 8 bytes,
and that means if sizeof(super-stuct) = 20 then 4 bytes of padding are
inserted and that ruins the import.

This causes vcl_filters_test to go into an infinite loop reading
SaveAsPicture.sgv.

Fix this by reading each member of the structs separately, which also
means that the filter doesn't need to byte-swap every member on
big-endian platforms since SvStream methods already do that.

Change-Id: I237725dbcde5232006728179e645776fcb79cac3
(cherry picked from commit af8509fa194e6747c82a9df9a1c465be82a32637)
Reviewed-on: https://gerrit.libreoffice.org/25988
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index 18e2d2c..73a3b0d 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -35,52 +35,6 @@
 p.x=OSL_SWAPWORD(p.x); \
 p.y=OSL_SWAPWORD(p.y); }
 
-#define SWAPPAGE(p) { \
-p.Next   =OSL_SWAPDWORD (p.Next   );   \
-p.nList  =OSL_SWAPDWORD (p.nList  );   \
-p.ListEnd=OSL_SWAPDWORD (p.ListEnd);   \
-p.Paper.Size.x=OSL_SWAPWORD(p.Paper.Size.x); \
-p.Paper.Size.y=OSL_SWAPWORD(p.Paper.Size.y); \
-p.Paper.RandL =OSL_SWAPWORD(p.Paper.RandL ); \
-p.Paper.RandR =OSL_SWAPWORD(p.Paper.RandR ); \
-p.Paper.RandO =OSL_SWAPWORD(p.Paper.RandO ); \
-p.Paper.RandU =OSL_SWAPWORD(p.Paper.RandU ); \
-SWAPPOINT(p.U);   \
-sal_uInt16 iTemp; \
-for (iTemp=0;iTemp<20;iTemp++) {  \
-rPage.HlpLnH[iTemp]=OSL_SWAPWORD(rPage.HlpLnH[iTemp]);   \
-rPage.HlpLnV[iTemp]=OSL_SWAPWORD(rPage.HlpLnV[iTemp]);  }}
-
-#define SWAPOBJK(o) { \
-o.Last=OSL_SWAPDWORD (o.Last); \
-o.Next=OSL_SWAPDWORD (o.Next); \
-o.MemSize =OSL_SWAPWORD(o.MemSize ); \
-SWAPPOINT(o.ObjMin);  \
-SWAPPOINT(o.ObjMax);  }
-
-#define SWAPLINE(l) { \
-l.LMSize=OSL_SWAPWORD(l.LMSize); \
-l.LDicke=OSL_SWAPWORD(l.LDicke); }
-
-#define SWAPAREA(a) {   \
-a.FDummy2=OSL_SWAPWORD(a.FDummy2); \
-a.FMuster=OSL_SWAPWORD(a.FMuster); }
-
-#define SWAPTEXT(t) {   \
-SWAPLINE(t.L);  \
-SWAPAREA(t.F);  \
-t.FontLo =OSL_SWAPWORD(t.FontLo ); \
-t.FontHi =OSL_SWAPWORD(t.FontHi ); \
-t.Grad   =OSL_SWAPWORD(t.Grad   ); \
-t.Breite =OSL_SWAPWORD(t.Breite ); \
-t.Schnitt=OSL_SWAPWORD(t.Schnitt); \
-t.LnFeed =OSL_SWAPWORD(t.LnFeed ); \
-t.Slant  =OSL_SWAPWORD(t.Slant  ); \
-SWAPLINE(t.ShdL);   \
-SWAPAREA(t.ShdF);   \
-SWAPPOINT(t.ShdVers);   \
-SWAPAREA(t.BackF);  }
-
 #endif
 
 //  Restrictions:
@@ -148,13 +102,63 @@ PageType::PageType()
 
 SvStream& ReadPageType(SvStream& rIStream, PageType& rPage)
 {
-rIStream.Read(, PageSize);
-#if defined OSL_BIGENDIAN
-SWAPPAGE(rPage);
-#endif
+sal_uInt64 const nOldPos(rIStream.Tell());
+rIStream.ReadUInt32(rPage.Next);
+rIStream.ReadUInt32(rPage.nList);
+rIStream.ReadUInt32(rPage.ListEnd);
+rIStream.ReadInt16(rPage.Paper.Size.x);
+rIStream.ReadInt16(rPage.Paper.Size.y);
+rIStream.ReadInt16(rPage.Paper.RandL);
+rIStream.ReadInt16(rPage.Paper.RandR);
+rIStream.ReadInt16(rPage.Paper.RandO);
+rIStream.ReadInt16(rPage.Paper.RandU);
+rIStream.ReadUChar(rPage.Paper.PColor);
+rIStream.ReadUChar(rPage.Paper.PIntens);
+rIStream.ReadCharAsBool(rPage.BorderClip);
+rIStream.ReadUChar(rPage.StdPg);
+rIStream.ReadInt16(rPage.U.x);
+rIStream.ReadInt16(rPage.U.y);
+for (int i = 0; i < 20; ++i)
+{
+rIStream.ReadInt16(rPage.HlpLnH[i]);
+}
+for (int i = 0; i < 20; ++i)
+{
+rIStream.ReadInt16(rPage.HlpLnV[i]);
+}
+rIStream.ReadUChar(rPage.LnAnzH);
+rIStream.ReadUChar(rPage.LnAnzV);
+for (int i = 0; i < 32; ++i)
+{
+rIStream.ReadUChar(rPage.PgName[i]);
+}
+assert(rIStream.GetError() || rIStream.Tell() == nOldPos + PageSize);
+(void) nOldPos;
 return rIStream;
 }
 
+void ReadObjLineType(SvStream & rInp, ObjLineType & rLine)
+{
+// reads 8 bytes
+rInp.ReadUChar(rLine.LFarbe);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - vcl/source

2016-05-27 Thread Caolán McNamara
 vcl/source/outdev/bitmap.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 6fb88a0c67150a751f59ebcba5f5419b24e6f4a7
Author: Caolán McNamara 
Date:   Fri May 27 09:23:03 2016 +0100

Related: tdf#87967 valgrind reported invalid reads on 1 pixel wide bitmap

Change-Id: Iddd18280c780d8b9f5e11fcc2af80749917192c4
(cherry picked from commit a9d2302d4d0732a0c1203bbb7c0182b8de59403d)

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index a3e0571..a07b32c 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -811,7 +811,7 @@ public:
 const long nMapY  = mpMapY[nY];
 const long nMapFY = mpMapYOffset[nY];
 
- pLine0 = pSource->GetScanline(nMapY);
+pLine0 = pSource->GetScanline(nMapY);
 // tdf#95481 guard nMapY + 1 to be within bounds
 pLine1 = (nMapY + 1 < pSource->Height()) ? 
pSource->GetScanline(nMapY + 1) : pLine0;
 
@@ -827,7 +827,7 @@ public:
 const long nMapFX = mpMapXOffset[nX];
 
 pColorSample1 = pLine0 + 3L * nMapX;
-pColorSample2 = pColorSample1  + 3L;
+pColorSample2 = (nMapX + 1 < pSource->Width()) ? pColorSample1 
+ 3L : pColorSample1;
 nColor1Line1 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 pColorSample1++;
@@ -839,7 +839,7 @@ public:
 nColor3Line1 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 pColorSample1 = pLine1 + 3L * nMapX;
-pColorSample2 = pColorSample1  + 3L;
+pColorSample2 = (nMapX + 1 < pSource->Width()) ? pColorSample1 
+ 3L : pColorSample1;
 nColor1Line2 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 pColorSample1++;
@@ -851,11 +851,11 @@ public:
 nColor3Line2 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 pColorSample1 = pLineAlpha0 + nMapX;
-pColorSample2 = pColorSample1  + 1L;
+pColorSample2 = (nMapX + 1 < pSourceAlpha->Width()) ? 
pColorSample1 + 1L : pColorSample1;
 nAlphaLine1 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 pColorSample1 = pLineAlpha1 + nMapX;
-pColorSample2 = pColorSample1  + 1L;
+pColorSample2 = (nMapX + 1 < pSourceAlpha->Width()) ? 
pColorSample1 + 1L : pColorSample1;
 nAlphaLine2 = (static_cast(*pColorSample1) << 7) + 
nMapFX * (static_cast(*pColorSample2) - *pColorSample1);
 
 nColor1 = (nColor1Line1 + nMapFY * ((nColor1Line2 >> 7) - 
(nColor1Line1 >> 7))) >> 7;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits