[Libreoffice-commits] core.git: chart2/source

2017-03-12 Thread Jochen Nitschke
 chart2/source/view/charttypes/PieChart.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 898f3541371a3fc59afb0907d3397a4876791789
Author: Jochen Nitschke 
Date:   Sun Mar 12 13:04:15 2017 +0100

cppcheck: unsignedLessThanZero

some stuff cppcheck missed in this file.
plus use empty() and front()

Change-Id: I612078d503c555afd681526f95d17502ffd585ba
Reviewed-on: https://gerrit.libreoffice.org/35094
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index f737a94..669143f 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -388,16 +388,16 @@ double PieChart::getMaxOffset()
 return m_fMaxOffset;
 
 m_fMaxOffset = 0.0;
-if( m_aZSlots.size()<=0 )
+if( m_aZSlots.empty() )
 return m_fMaxOffset;
-if( m_aZSlots[0].size()<=0 )
+if( m_aZSlots.front().empty() )
 return m_fMaxOffset;
 
-const std::vector< VDataSeries* >& rSeriesList( 
m_aZSlots[0][0].m_aSeriesVector );
-if(!rSeriesList.size())
+const std::vector< VDataSeries* >& rSeriesList( 
m_aZSlots.front().front().m_aSeriesVector );
+if(rSeriesList.empty())
 return m_fMaxOffset;
 
-VDataSeries* pSeries = rSeriesList[0];
+VDataSeries* pSeries = rSeriesList.front();
 uno::Reference< beans::XPropertySet > xSeriesProp( 
pSeries->getPropertiesOfSeries() );
 if( !xSeriesProp.is() )
 return m_fMaxOffset;
@@ -430,8 +430,8 @@ double PieChart::getMaxOffset()
 double PieChart::getMaximumX()
 {
 double fMaxOffset = getMaxOffset();
-if( m_aZSlots.size()>0 && m_bUseRings)
-return m_aZSlots[0].size()+0.5+fMaxOffset;
+if( !m_aZSlots.empty() && m_bUseRings)
+return m_aZSlots.front().size()+0.5+fMaxOffset;
 return 1.5+fMaxOffset;
 }
 double PieChart::getMinimumYInRange( double /* fMinimumX */, double /* 
fMaximumX */, sal_Int32 /* nAxisIndex */ )
@@ -510,8 +510,8 @@ void PieChart::createShapes()
 ///that the radius axis scale is the one with index 0 and the angle axis
 ///scale is the one with index 1.
 
-std::vector< VDataSeriesGroup >::iterator aXSlotIter = 
m_aZSlots[0].begin();
-const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = 
m_aZSlots[0].end();
+std::vector< VDataSeriesGroup >::iterator aXSlotIter = 
m_aZSlots.front().begin();
+const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = 
m_aZSlots.front().end();
 
 ///m_bUseRings == true if chart type is `donut`, == false if chart type is
 ///`pie`; if the chart is of `donut` type we have as many rings as many 
data
@@ -528,7 +528,7 @@ void PieChart::createShapes()
 ///such a case the `explodeable` ring is the last one.
 std::vector< VDataSeriesGroup >::size_type nExplodeableSlot = 0;
 if( m_pPosHelper->isMathematicalOrientationRadius() && m_bUseRings )
-nExplodeableSlot = m_aZSlots[0].size()-1;
+nExplodeableSlot = m_aZSlots.front().size()-1;
 
 m_aLabelInfoList.clear();
 ::rtl::math::setNan(&m_fMaxOffset);
@@ -552,9 +552,9 @@ void PieChart::createShapes()
 ShapeParam aParam;
 
 std::vector< VDataSeries* >* pSeriesList = 
&(aXSlotIter->m_aSeriesVector);
-if(!pSeriesList->size())//there should be only one series in each x 
slot
+if(pSeriesList->empty())//there should be only one series in each x 
slot
 continue;
-VDataSeries* pSeries = (*pSeriesList)[0];
+VDataSeries* pSeries = pSeriesList->front();
 if(!pSeries)
 continue;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2017-03-12 Thread Jochen Nitschke
 vcl/source/gdi/bmpacc2.cxx |   36 
 1 file changed, 24 insertions(+), 12 deletions(-)

New commits:
commit b8261a99ae537078e0bc1c62154fc6c66c7556b4
Author: Jochen Nitschke 
Date:   Sun Mar 12 15:22:18 2017 +0100

improve readability

and make it easier to debug.
top crasher in 5.3.0.3 is around this area:
https://cgit.freedesktop.org/libreoffice/core/tree/vcl/source/gdi/
bmpacc2.cxx?h=libreoffice-5.3.0.3#n235

http://crashreport.libreoffice.org/stats/signature/
BitmapReadAccess::GetPixelForN32BitTcRgba(
unsigned%20char%20const%20*,long,ColorMask%20const%20&)#summary

in case someone wonders suffix increment '++' precedes dereference '*'

Change-Id: I15876711db569d55739da3514f61ef1b981269ab
Reviewed-on: https://gerrit.libreoffice.org/35099
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 83391d1..ab67ddd 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -127,7 +127,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN24BitTcBgr(ConstScanline pScanline, lo
 {
 BitmapColor aBitmapColor;
 
-aBitmapColor.SetBlue( *( pScanline = pScanline + nX * 3 )++ );
+pScanline = pScanline + nX * 3;
+aBitmapColor.SetBlue( *pScanline++ );
 aBitmapColor.SetGreen( *pScanline++ );
 aBitmapColor.SetRed( *pScanline );
 
@@ -136,7 +137,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN24BitTcBgr(ConstScanline pScanline, lo
 
 void BitmapReadAccess::SetPixelForN24BitTcBgr(Scanline pScanline, long nX, 
const BitmapColor& rBitmapColor, const ColorMask&)
 {
-*( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue();
+pScanline = pScanline + nX * 3;
+*pScanline++ = rBitmapColor.GetBlue();
 *pScanline++ = rBitmapColor.GetGreen();
 *pScanline = rBitmapColor.GetRed();
 }
@@ -145,7 +147,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN24BitTcRgb(ConstScanline pScanline, lo
 {
 BitmapColor aBitmapColor;
 
-aBitmapColor.SetRed( *( pScanline = pScanline + nX * 3 )++ );
+pScanline = pScanline + nX * 3;
+aBitmapColor.SetRed( *pScanline++ );
 aBitmapColor.SetGreen( *pScanline++ );
 aBitmapColor.SetBlue( *pScanline );
 
@@ -154,7 +157,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN24BitTcRgb(ConstScanline pScanline, lo
 
 void BitmapReadAccess::SetPixelForN24BitTcRgb(Scanline pScanline, long nX, 
const BitmapColor& rBitmapColor, const ColorMask&)
 {
-*( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed();
+pScanline = pScanline + nX * 3;
+*pScanline++ = rBitmapColor.GetRed();
 *pScanline++ = rBitmapColor.GetGreen();
 *pScanline = rBitmapColor.GetBlue();
 }
@@ -163,7 +167,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, l
 {
 BitmapColor aBitmapColor;
 
-aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
+pScanline = pScanline + ( nX << 2 ) + 1;
+aBitmapColor.SetBlue( *pScanline++ );
 aBitmapColor.SetGreen( *pScanline++ );
 aBitmapColor.SetRed( *pScanline );
 
@@ -172,7 +177,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, l
 
 void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, 
const BitmapColor& rBitmapColor, const ColorMask&)
 {
-*( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+pScanline = pScanline + ( nX << 2 );
+*pScanline++ = 0xFF;
 *pScanline++ = rBitmapColor.GetBlue();
 *pScanline++ = rBitmapColor.GetGreen();
 *pScanline = rBitmapColor.GetRed();
@@ -182,7 +188,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, l
 {
 BitmapColor aBitmapColor;
 
-aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
+pScanline = pScanline + ( nX << 2 ) + 1;
+aBitmapColor.SetRed( *pScanline++ );
 aBitmapColor.SetGreen( *pScanline++ );
 aBitmapColor.SetBlue( *pScanline );
 
@@ -191,7 +198,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, l
 
 void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, long nX, 
const BitmapColor& rBitmapColor, const ColorMask&)
 {
-*( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+pScanline = pScanline + ( nX << 2 );
+*pScanline++ = 0xFF;
 *pScanline++ = rBitmapColor.GetRed();
 *pScanline++ = rBitmapColor.GetGreen();
 *pScanline = rBitmapColor.GetBlue();
@@ -201,7 +209,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, l
 {
 BitmapColor aBitmapColor;
 
-aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
+pScanline = pScanline + ( nX << 2 );
+aBitmapColor.SetBlue( *pScanline++ );
 aBitmapColor.SetGreen( *pScanline++ );
 aBitmapColor.SetRed( *pScanline );
 
@@ -210,7 +219,8 @@ BitmapColor 
BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanli

[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.cpp |3 ++
 wsd/LOOLWSD.cpp|   54 +
 2 files changed, 35 insertions(+), 22 deletions(-)

New commits:
commit 3d78e5f2a1a6c1369e6cdeddd39cb00a6e33d1bd
Author: Ashod Nakashian 
Date:   Sun Mar 12 22:31:50 2017 -0400

wsd: improved logging of extant DocBrokers after cleanup

Change-Id: I4de8fde607e9e94cbadd8e100d39e0e21f2f2bdc
Reviewed-on: https://gerrit.libreoffice.org/35126
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 25686bf..a53a7c1 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1274,6 +1274,9 @@ void 
DocumentBroker::terminateChild(std::unique_lock& lock, const st
 
 _childProcess->close(false);
 }
+
+// Stop the polling thread.
+_poll->stop();
 }
 
 void DocumentBroker::closeDocument(const std::string& reason)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 310d576..97cf845 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -261,38 +261,48 @@ bool cleanupDocBrokers()
 for (auto it = DocBrokers.begin(); it != DocBrokers.end(); )
 {
 auto docBroker = it->second;
+
+// If document busy at the moment, cleanup later.
 auto lock = docBroker->getDeferredLock();
-if (!lock.try_lock())
+if (lock.try_lock())
 {
-// Document busy at the moment, cleanup later.
-++it;
-continue;
-}
+// Remove idle documents after 1 hour.
+const bool idle = (docBroker->getIdleTimeSecs() >= 3600);
 
-// Remove idle documents after 1 hour.
-const bool idle = (docBroker->getIdleTimeSecs() >= 3600);
+// Cleanup used and dead entries.
+if ((docBroker->isLoaded() || docBroker->isMarkedToDestroy()) &&
+(docBroker->getSessionsCount() == 0 || !docBroker->isAlive() 
|| idle))
+{
+LOG_INF("Terminating " << (idle ? "idle" : "dead") <<
+" DocumentBroker for docKey [" << it->first << "].");
+docBroker->terminateChild(lock, idle ? "idle" : "");
 
-// Cleanup used and dead entries.
-if (docBroker->isLoaded() &&
-(docBroker->getSessionsCount() == 0 || !docBroker->isAlive() || 
idle))
-{
-LOG_INF("Removing " << (idle ? "idle" : "dead") <<
-" DocumentBroker for docKey [" << it->first << "].");
-it = DocBrokers.erase(it);
-docBroker->terminateChild(lock, idle ? "idle" : "");
-}
-else
-{
-++it;
+// Remove only when not alive.
+if (!docBroker->isAlive())
+{
+LOG_INF("Removing " << (idle ? "idle" : "dead") <<
+" DocumentBroker for docKey [" << it->first << 
"].");
+it = DocBrokers.erase(it);
+continue;
+}
+}
 }
+
+++it;
 }
 
 if (count != DocBrokers.size())
 {
-LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after cleanup.");
-for (auto& pair : DocBrokers)
+auto logger = Log::trace();
+if (logger.enabled())
 {
-LOG_TRC("DocumentBroker [" << pair.first << "].");
+logger << "Have " << DocBrokers.size() << " DocBrokers after 
cleanup.\n";
+for (auto& pair : DocBrokers)
+{
+logger << "DocumentBroker [" << pair.first << "].\n";
+}
+
+LOG_END(logger);
 }
 
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/Socket.hpp

2017-03-12 Thread Ashod Nakashian
 net/Socket.hpp |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 94051f21b5ebbbc5c410842df8a302f2e2ff0832
Author: Ashod Nakashian 
Date:   Sun Mar 12 22:30:30 2017 -0400

wsd: SocketPoll::startThread can be protected

Change-Id: Idd17f7314ac181e9a412e05a1287e15edf5047d2
Reviewed-on: https://gerrit.libreoffice.org/35125
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 01f985c..5cced5f 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -252,9 +252,6 @@ public:
 /// Default poll time - useful to increase for debugging.
 static int DefaultPollTimeoutMs;
 
-/// Start the polling thread (if desired)
-void startThread();
-
 /// Stop the polling thread.
 void stop()
 {
@@ -438,8 +435,11 @@ public:
 
 const std::string& name() const { return _name; }
 
-private:
+protected:
+/// Start the polling thread (if desired)
+void startThread();
 
+private:
 /// Initialize the poll fds array with the right events
 void setupPollFds(Poco::Timestamp &timeout)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/Socket.cpp

2017-03-12 Thread Ashod Nakashian
 net/Socket.cpp |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit c4d27fd060d93c61e9f475c63c34c828e84a55d6
Author: Ashod Nakashian 
Date:   Sun Mar 12 22:29:58 2017 -0400

wsd: prevent and warn when joining own thread

Change-Id: I8405a1aacb1281e52bbd07d32cdcf35bdc484d8b
Reviewed-on: https://gerrit.libreoffice.org/35124
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/Socket.cpp b/net/Socket.cpp
index de41e34..96734d0 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -56,7 +56,12 @@ SocketPoll::~SocketPoll()
 {
 stop();
 if (_threadStarted && _thread.joinable())
-_thread.join();
+{
+if (_thread.get_id() == std::this_thread::get_id())
+LOG_ERR("DEADLOCK PREVENTED: joining own thread!");
+else
+_thread.join();
+}
 
 ::close(_wakeup[0]);
 ::close(_wakeup[1]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/Socket.hpp

2017-03-12 Thread Ashod Nakashian
 net/Socket.hpp |   39 ---
 1 file changed, 24 insertions(+), 15 deletions(-)

New commits:
commit 862d7a07342f1caad5a9474c480b06585c813bea
Author: Ashod Nakashian 
Date:   Sun Mar 12 22:29:30 2017 -0400

wsd: write as many messages to socket as possible

Change-Id: Ie2702ea68dd1ae6200fcc304224dea34fc94544f
Reviewed-on: https://gerrit.libreoffice.org/35123
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 4fe334b..01f985c 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -682,26 +682,35 @@ protected:
 _socketHandler->handleIncomingMessage();
 }
 
-// If we have space for writing and that was requested
-if ((events & POLLOUT) && _outBuffer.empty())
-_socketHandler->performWrites();
+do
+{
+// If we have space for writing and that was requested
+if ((events & POLLOUT) && _outBuffer.empty())
+_socketHandler->performWrites();
 
-// perform the shutdown if we have sent everything.
-if (_shutdownSignalled && _outBuffer.empty())
-closeConnection();
+// perform the shutdown if we have sent everything.
+if (_shutdownSignalled && _outBuffer.empty())
+{
+closeConnection();
+closed = true;
+break;
+}
 
-// SSL might want to do handshake,
-// even if we have no data to write.
-if ((events & POLLOUT) || !_outBuffer.empty())
-{
-std::unique_lock lock(_writeMutex, std::defer_lock);
+oldSize = _outBuffer.size();
 
-// The buffer could have been flushed while we waited for the lock.
-if (lock.try_lock() && !_outBuffer.empty())
-writeOutgoingData();
+// Write if we can and have data to write.
+if ((events & POLLOUT) || !_outBuffer.empty())
+{
+std::unique_lock lock(_writeMutex, 
std::defer_lock);
 
-closed = closed || (errno == EPIPE);
+// The buffer could have been flushed while we waited for the 
lock.
+if (lock.try_lock() && !_outBuffer.empty())
+writeOutgoingData();
+
+closed = closed || (errno == EPIPE);
+}
 }
+while (oldSize != _outBuffer.size());
 
 if (closed)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/Socket.cpp net/Socket.hpp wsd/DocumentBroker.cpp

2017-03-12 Thread Ashod Nakashian
 net/Socket.cpp |3 ++-
 net/Socket.hpp |5 +
 wsd/DocumentBroker.cpp |   12 +---
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 9248107702745f37d321b5b31a22e9dc7a1963ec
Author: Ashod Nakashian 
Date:   Sun Mar 12 22:11:25 2017 -0400

wsd: SocketPoll reports thread isAlive and use in DocBroker

Now that DocumentBroker has SocketPoll thread,
it's isAlive() must be defined by the lifetime of
both the SocketPoll thread and the ChildProcess,
which it previously did.

Change-Id: I093f8774cf4374d01729a383f6c535de4143fec6
Reviewed-on: https://gerrit.libreoffice.org/35122
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/Socket.cpp b/net/Socket.cpp
index 48bc696..de41e34 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -35,7 +35,8 @@ namespace {
 SocketPoll::SocketPoll(const std::string& threadName)
 : _name(threadName),
   _stop(false),
-  _threadStarted(false)
+  _threadStarted(false),
+  _threadFinished(false)
 {
 // Create the wakeup fd.
 if (::pipe2(_wakeup, O_CLOEXEC | O_NONBLOCK) == -1)
diff --git a/net/Socket.hpp b/net/Socket.hpp
index c4badea..4fe334b 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -262,6 +262,8 @@ public:
 wakeup();
 }
 
+bool isAlive() const { return _threadStarted && !_threadFinished; }
+
 /// Check if we should continue polling
 virtual bool continuePolling()
 {
@@ -280,6 +282,8 @@ public:
 {
 poll(DefaultPollTimeoutMs);
 }
+
+_threadFinished = true;
 }
 
 /// Are we running in either shutdown, or the polling thread.
@@ -478,6 +482,7 @@ protected:
 /// The polling thread.
 std::thread _thread;
 std::atomic _threadStarted;
+std::atomic _threadFinished;
 std::thread::id _owner;
 };
 
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 9e2087f..25686bf 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -152,6 +152,7 @@ DocumentBroker::DocumentBroker(const std::string& uri,
 _cursorWidth(0),
 _cursorHeight(0),
 _poll(new DocumentBrokerPoll("docbrk_poll", *this)),
+_stop(false),
 _tileVersion(0),
 _debugRenderedTileCount(0)
 {
@@ -159,8 +160,6 @@ DocumentBroker::DocumentBroker(const std::string& uri,
 assert(!_childRoot.empty());
 
 LOG_INF("DocumentBroker [" << _uriPublic.toString() << "] created. DocKey: 
[" << _docKey << "]");
-
-_stop = false;
 }
 
 // The inner heart of the DocumentBroker - our poll loop.
@@ -248,12 +247,11 @@ void DocumentBroker::pollThread()
 
 bool DocumentBroker::isAlive() const
 {
-if (!_childProcess)
-return true; // waiting to get a child.
-if (_stop) // we're dead.
-return false;
+if (_poll->isAlive())
+return true; // Polling thread still running.
 
-return _childProcess->isAlive();
+// Shouldn't have live child process outside of the polling thread.
+return _childProcess && _childProcess->isAlive();
 }
 
 DocumentBroker::~DocumentBroker()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.hpp |6 ++
 wsd/LOOLWSD.cpp|6 +++---
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 8901fcf074da289bfc7063eff0e21175f439ae3a
Author: Ashod Nakashian 
Date:   Sun Mar 12 19:18:12 2017 -0400

wsd: ChildProcess doesn't need friends

Change-Id: I1911920c9b49adecac4ea4d8fc4b0830687b80c7
Reviewed-on: https://gerrit.libreoffice.org/35121
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 9836872..8d7eb2a 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -60,8 +60,6 @@ public:
 /// to host a document.
 class ChildProcess
 {
-// FIXME: urk ...
-friend class PrisonerRequestDispatcher;
 public:
 /// @param pid is the process ID of the child.
 /// @param socket is the underlying Sockeet to the child.
@@ -92,11 +90,11 @@ public:
 }
 
 void setDocumentBroker(const std::shared_ptr& docBroker);
+std::shared_ptr getDocumentBroker() const { return 
_docBroker.lock(); }
 
 void stop()
 {
-// FIXME: stop !?
-LOG_ERR("What do we do for stop?");
+// Request the child to exit.
 try
 {
 if (isAlive())
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index b8a2b9d..310d576 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1454,7 +1454,7 @@ public:
 {
 // Notify the broker that we're done.
 auto child = _childProcess.lock();
-auto docBroker = child ? child->_docBroker.lock() : nullptr;
+auto docBroker = child ? child->getDocumentBroker() : nullptr;
 if (docBroker)
 {
 // FIXME: No need to notify if asked to stop.
@@ -1587,7 +1587,7 @@ private:
 LOG_TRC("Prisoner message [" << getAbbreviatedMessage(&data[0], 
data.size()) << "].");
 
 auto child = _childProcess.lock();
-auto docBroker = child ? child->_docBroker.lock() : nullptr;
+auto docBroker = child ? child->getDocumentBroker() : nullptr;
 if (docBroker)
 {
 // We should never destroy the broker, since
@@ -1598,7 +1598,7 @@ private:
 return;
 }
 
-LOG_WRN("Child " << child->_pid <<
+LOG_WRN("Child " << child->getPid() <<
 " has no DocumentBroker to handle message: [" <<
 LOOLProtocol::getAbbreviatedMessage(data) << "].");
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/Socket.hpp net/WebSocketHandler.hpp

2017-03-12 Thread Ashod Nakashian
 net/Socket.hpp   |1 +
 net/WebSocketHandler.hpp |2 ++
 2 files changed, 3 insertions(+)

New commits:
commit c9a07a3087cced9c0ea8973a039b284bcb01a0e7
Author: Ashod Nakashian 
Date:   Sun Mar 12 19:04:52 2017 -0400

wsd: assert socket is in correct thread

Change-Id: I22c3f62bdf45188641326774dd86b7cacfce9198
Reviewed-on: https://gerrit.libreoffice.org/35120
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 6929938..c4badea 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -555,6 +555,7 @@ public:
 
 int getPollEvents() override
 {
+assert(isCorrectThread());
 if (!_outBuffer.empty() || _socketHandler->hasQueuedWrites() || 
_shutdownSignalled)
 return POLLIN | POLLOUT;
 else
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 7416586..d89f49b 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -255,6 +255,7 @@ public:
 if (socket == nullptr)
 return -1; // no socket == error.
 
+assert(socket->isCorrectThread());
 auto lock = socket->getWriteLock();
 std::vector& out = socket->_outBuffer;
 
@@ -287,6 +288,7 @@ protected:
 if (!socket || data == nullptr || len == 0)
 return -1;
 
+assert(socket->isCorrectThread());
 std::vector& out = socket->_outBuffer;
 
 out.push_back(flags);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/ServerSocket.hpp net/Socket.cpp net/Socket.hpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 net/ServerSocket.hpp   |2 +-
 net/Socket.cpp |   23 ---
 net/Socket.hpp |6 +++---
 wsd/DocumentBroker.cpp |   36 ++--
 wsd/DocumentBroker.hpp |2 +-
 wsd/LOOLWSD.cpp|   33 +++--
 6 files changed, 54 insertions(+), 48 deletions(-)

New commits:
commit 04bbb75200e5097429b119f2773f115a542cf823
Author: Ashod Nakashian 
Date:   Sun Mar 12 19:03:45 2017 -0400

wsd: dump state to generic ostream for flexiblity and to log

Change-Id: I4670ee2e90b7809ebc66a2b324a44334b3dbba2b
Reviewed-on: https://gerrit.libreoffice.org/35119
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp
index 8f98dc6..29381c1 100644
--- a/net/ServerSocket.hpp
+++ b/net/ServerSocket.hpp
@@ -83,7 +83,7 @@ public:
 return POLLIN;
 }
 
-void dumpState() override;
+void dumpState(std::ostream& os) override;
 
 HandleResult handlePoll(const Poco::Timestamp &/* now */, int events) 
override
 {
diff --git a/net/Socket.cpp b/net/Socket.cpp
index b64f904..48bc696 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -85,9 +85,9 @@ void SocketPoll::wakeupWorld()
 wakeup(fd);
 }
 
-void ServerSocket::dumpState()
+void ServerSocket::dumpState(std::ostream& os)
 {
-std::cerr << "\t" << getFD() << "\t\n";
+os << "\t" << getFD() << "\t\n";
 }
 
 namespace {
@@ -121,24 +121,25 @@ void dump_hex (const char *legend, const char *prefix, 
std::vector buffer)
 
 } // namespace
 
-void StreamSocket::dumpState()
+void StreamSocket::dumpState(std::ostream& os)
 {
-std::cerr << "\t" << getFD() << "\t" << getPollEvents() << "\t"
-  << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"
-  << "\n";
+os << "\t" << getFD() << "\t" << getPollEvents() << "\t"
+   << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"
+   << "\n";
 if (_inBuffer.size() > 0)
 dump_hex("\t\tinBuffer:\n", "\t\t", _inBuffer);
 if (_outBuffer.size() > 0)
 dump_hex("\t\toutBuffer:\n", "\t\t", _inBuffer);
 }
 
-void SocketPoll::dumpState()
+void SocketPoll::dumpState(std::ostream& os)
 {
-std::cerr << " Poll [" << _pollSockets.size() << "] - wakeup r: "
-  << _wakeup[0] << " w: " << _wakeup[1] << "\n";
-std::cerr << "\tfd\tevents\trsize\twsize\n";
+// FIXME: NOT thread-safe! _pollSockets is modified from the polling 
thread!
+os << " Poll [" << _pollSockets.size() << "] - wakeup r: "
+   << _wakeup[0] << " w: " << _wakeup[1] << "\n";
+os << "\tfd\tevents\trsize\twsize\n";
 for (auto &i : _pollSockets)
-i->dumpState();
+i->dumpState(os);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 7071acd..6929938 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -175,7 +175,7 @@ public:
 return rc;
 }
 
-virtual void dumpState() {}
+virtual void dumpState(std::ostream&) {}
 
 /// Set the thread-id we're bound to
 void setThreadOwner(const std::thread::id &id)
@@ -414,7 +414,7 @@ public:
 wakeup();
 }
 
-void dumpState();
+void dumpState(std::ostream& os);
 
 /// Removes a socket from this poller.
 /// NB. this must be called from the socket poll that
@@ -762,7 +762,7 @@ protected:
 return ::write(getFD(), buf, len);
 }
 
-void dumpState() override;
+void dumpState(std::ostream& os) override;
 
 /// Get the Write Lock.
 std::unique_lock getWriteLock() { return 
std::unique_lock(_writeMutex); }
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index aacdfae..9e2087f 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1292,31 +1292,31 @@ void DocumentBroker::updateLastActivityTime()
 Admin::instance().updateLastActivityTime(_docKey);
 }
 
-void DocumentBroker::dumpState()
+void DocumentBroker::dumpState(std::ostream& os)
 {
 std::unique_lock lock(_mutex);
 
-std::cerr << " Broker: " << _filename;
+os << " Broker: " << _filename;
 if (_markToDestroy)
-std::cerr << " *** Marked to destroy ***\n";
+os << " *** Marked to destroy ***";
 else
-std::cerr << " has live sessions\n";
+os << " has live sessions";
 if (_isLoaded)
-std::cerr << "  loaded in: " << _loadDuration.count() << "ms\n";
+os << "\n  loaded in: " << _loadDuration.count() << "ms";
 else
-std::cerr << "  still loading...\n";
-std::cerr << "  modified?: " << _isModified << "\n";
-std::cerr << "  jail id: " << _jailId << "\n";
-std::cerr << "  public uri: " << _uriPublic.toString() << "\n";
-std::cerr << "  jailed uri: " << _uriJailed.toString() << "\n";
-std::cerr << "  doc key: " << _docKey << "\n";
-std::cerr << "  num sessions: " << getSessionsCount() << "\n";
-std::cerr << "  new sessions: " << _newSessi

[Libreoffice-commits] online.git: kit/Kit.cpp net/loolnb.cpp net/Socket.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 kit/Kit.cpp |1 +
 net/Socket.hpp  |4 ++--
 net/loolnb.cpp  |2 +-
 wsd/LOOLWSD.cpp |   12 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 2e2f62eddeeb92761df1e1316aaa59687e2aac69
Author: Ashod Nakashian 
Date:   Sun Mar 12 18:34:06 2017 -0400

wsd: improved logging

Change-Id: I6c4a5bcd54c0748cc413afbfcfb34c365b347669
Reviewed-on: https://gerrit.libreoffice.org/35118
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index c14007a..9886a8c 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1754,6 +1754,7 @@ void lokit_main(const std::string& childRoot,
 // Open websocket connection between the child process and WSD.
 HTTPClientSession cs("127.0.0.1", MasterPortNumber);
 cs.setTimeout(Poco::Timespan(10, 0)); // 10 second
+LOG_DBG("Connecting to Master " << cs.getHost() << ':' << 
cs.getPort());
 HTTPRequest request(HTTPRequest::HTTP_GET, requestUrl);
 HTTPResponse response;
 auto ws = std::make_shared(cs, request, response);
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 88ef163..7071acd 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -427,9 +427,9 @@ public:
 auto it = std::find(_pollSockets.begin(), _pollSockets.end(), socket);
 assert(it != _pollSockets.end());
 
-LOG_TRC("Release socket #" << socket->getFD() << " from " << _name);
-
 _pollSockets.erase(it);
+LOG_TRC("Release socket #" << socket->getFD() << " from " << _name <<
+" leaving " << _pollSockets.size());
 }
 
 const std::string& name() const { return _name; }
diff --git a/net/loolnb.cpp b/net/loolnb.cpp
index 041397a..566ab1e 100644
--- a/net/loolnb.cpp
+++ b/net/loolnb.cpp
@@ -86,7 +86,7 @@ public:
 << "Connection: Closed\r\n"
 << "\r\n"
 << numberString;
-;
+
 std::string str = oss.str();
 socket->_outBuffer.insert(socket->_outBuffer.end(), 
str.begin(), str.end());
 return;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 98250b4..8444f07 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1466,13 +1466,13 @@ private:
 /// Keep our socket around ...
 void onConnect(const std::weak_ptr& socket) override
 {
-LOG_TRC("Prisoner - new socket\n");
+LOG_TRC("Prisoner - new socket");
 _socket = socket;
 }
 
 void onDisconnect() override
 {
-LOG_TRC("Prisoner connection disconnected\n");
+LOG_TRC("Prisoner connection disconnected");
 }
 
 /// Called after successful socket reads.
@@ -1510,7 +1510,7 @@ private:
 auto logger = Log::info();
 if (logger.enabled())
 {
-logger << "Prisoner HTTP Request: "
+logger << "Prisoner HTTP Request from #" << socket->getFD() << 
": "
<< request.getMethod() << ' '
<< request.getURI() << ' '
<< request.getVersion();
@@ -1641,8 +1641,8 @@ private:
 disposeSession();
 
 const size_t curConnections = --LOOLWSD::NumConnections;
-LOG_TRC("Disconnected connection #" << _connectionNum << " of " <<
-(curConnections + 1) << " existing as session [" << _id << 
"].");
+LOG_TRC("Disconnected connection #" << _connectionNum << " (of " <<
+(curConnections + 1) << ") as session [" << _id << "].");
 }
 
 /// Called after successful socket reads.
@@ -1683,7 +1683,7 @@ private:
 auto logger = Log::info();
 if (logger.enabled())
 {
-logger << "Client HTTP Request: "
+logger << "Client HTTP Request: #" << socket->getFD() << ": "
<< request.getMethod() << ' '
<< request.getURI() << ' '
<< request.getVersion();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: test/httpwstest.cpp

2017-03-12 Thread Ashod Nakashian
 test/httpwstest.cpp |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 851195215addd668fedb7cf476825689b80820b7
Author: Ashod Nakashian 
Date:   Sun Mar 12 18:32:31 2017 -0400

wsd: log testHandshake traffic

Change-Id: Iee79dfe2e7987838a528d5705cbb0d476f73dce7
Reviewed-on: https://gerrit.libreoffice.org/35117
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 9e9df3e..1e7c4f8 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -267,14 +267,17 @@ void HTTPWSTest::testHandshake()
 int flags = 0;
 char buffer[1024] = {0};
 int bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
+std::cerr << testname << "Got " << 
LOOLProtocol::getAbbreviatedFrameDump(buffer, bytes, flags) << std::endl;
 CPPUNIT_ASSERT_EQUAL(std::string("statusindicator: find"), 
std::string(buffer, bytes));
 
 bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
+std::cerr << testname << "Got " << 
LOOLProtocol::getAbbreviatedFrameDump(buffer, bytes, flags) << std::endl;
 if (bytes > 0 && !std::strstr(buffer, "error:"))
 {
 CPPUNIT_ASSERT_EQUAL(std::string("statusindicator: connect"), 
std::string(buffer, bytes));
 
 bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
+std::cerr << testname << "Got " << 
LOOLProtocol::getAbbreviatedFrameDump(buffer, bytes, flags) << std::endl;
 if (!std::strstr(buffer, "error:"))
 {
 CPPUNIT_ASSERT_EQUAL(std::string("statusindicator: ready"), 
std::string(buffer, bytes));
@@ -286,6 +289,7 @@ void HTTPWSTest::testHandshake()
 
 // close frame message
 bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
+std::cerr << testname << "Got " << 
LOOLProtocol::getAbbreviatedFrameDump(buffer, bytes, flags) << std::endl;
 CPPUNIT_ASSERT((flags & 
Poco::Net::WebSocket::FRAME_OP_BITMASK) == 
Poco::Net::WebSocket::FRAME_OP_CLOSE);
 }
 }
@@ -296,6 +300,7 @@ void HTTPWSTest::testHandshake()
 
 // close frame message
 bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
+std::cerr << testname << "Got " << 
LOOLProtocol::getAbbreviatedFrameDump(buffer, bytes, flags) << std::endl;
 CPPUNIT_ASSERT((flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == 
Poco::Net::WebSocket::FRAME_OP_CLOSE);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: net/SslSocket.hpp

2017-03-12 Thread Ashod Nakashian
 net/SslSocket.hpp |   28 ++--
 1 file changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 6f1191866133e85921ffa24efab9c2fed7abdebf
Author: Ashod Nakashian 
Date:   Sun Mar 12 14:33:16 2017 -0400

wsd: more informative SSL error logging

Change-Id: I32baadf995f6fc4c9b112d1a62fee2d618fc9e95
Reviewed-on: https://gerrit.libreoffice.org/35116
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/net/SslSocket.hpp b/net/SslSocket.hpp
index 1253b9f..6cf95b5 100644
--- a/net/SslSocket.hpp
+++ b/net/SslSocket.hpp
@@ -186,24 +186,33 @@ private:
 // Last operation failed. Find out if SSL was trying
 // to do something different that failed, or not.
 const int sslError = SSL_get_error(_ssl, rc);
-LOG_TRC("Socket #" << getFD() << " SSL error: " << sslError);
 switch (sslError)
 {
 case SSL_ERROR_ZERO_RETURN:
 // Shutdown complete, we're disconnected.
+LOG_TRC("Socket #" << getFD() << " SSL error: ZERO_RETURN (" << 
sslError << ").");
 return 0;
 
 case SSL_ERROR_WANT_READ:
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_READ (" << 
sslError << ").");
 _sslWantsTo = SslWantsTo::Read;
 return rc;
 
 case SSL_ERROR_WANT_WRITE:
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_WRITE (" << 
sslError << ").");
 _sslWantsTo = SslWantsTo::Write;
 return rc;
 
 case SSL_ERROR_WANT_CONNECT:
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_CONNECT (" << 
sslError << ").");
+return rc;
+
 case SSL_ERROR_WANT_ACCEPT:
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_ACCEPT (" << 
sslError << ").");
+return rc;
+
 case SSL_ERROR_WANT_X509_LOOKUP:
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_X509_LOOKUP (" 
<< sslError << ").");
 // Unexpected.
 return rc;
 
@@ -211,12 +220,24 @@ private:
 if (errno != 0)
 {
 // Posix API error, let the caller handle.
+LOG_SYS("Socket #" << getFD() << " SSL error: SYSCALL (" << 
sslError << ").");
 return rc;
 }
 
 // Fallthrough...
 default:
 {
+if (sslError == SSL_ERROR_SSL)
+LOG_TRC("Socket #" << getFD() << " SSL error: SSL (" << 
sslError << ").");
+#if 0 // Recent OpenSSL only
+else if (sslError == SSL_ERROR_WANT_ASYNC)
+LOG_TRC("Socket #" << getFD() << " SSL error: WANT_ASYNC 
(" << sslError << ").");
+else if (sslError == SSL_ERROR_WANT_ASYNC_JOB)
+LOG_TRC("Socket #" << getFD() << " SSL error: 
WANT_ASYNC_JOB (" << sslError << ").");
+#endif
+else
+LOG_TRC("Socket #" << getFD() << " SSL error: UKNOWN (" << 
sslError << ").");
+
 // The error is comming from BIO. Find out what happened.
 const long bioError = ERR_get_error();
 if (bioError == 0)
@@ -224,14 +245,17 @@ private:
 if (rc == 0)
 {
 // Socket closed.
+LOG_ERR("Socket #" << getFD() << " SSL BIO error: 
closed (0).");
 return 0;
 }
 else if (rc == -1)
 {
+LOG_SYS("Socket #" << getFD() << " SSL BIO error: 
closed unexpectedly (-1).");
 throw std::runtime_error("SSL Socket closed 
unexpectedly.");
 }
 else
 {
+LOG_SYS("Socket #" << getFD() << " SSL BIO error: 
unknown (" << rc << ").");
 throw std::runtime_error("SSL BIO reported error [" + 
std::to_string(rc) + "].");
 }
 }
@@ -239,7 +263,7 @@ private:
 {
 char buf[512];
 ERR_error_string_n(bioError, buf, sizeof(buf));
-LOG_ERR("Socket #" << getFD() << " BIO error: " << buf);
+LOG_SYS("Socket #" << getFD() << " SSL BIO error: " << 
buf);
 throw std::runtime_error(buf);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.cpp |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit c939eeab6837dd4151815da597acea6e6b36dd99
Author: Ashod Nakashian 
Date:   Sun Mar 12 14:13:48 2017 -0400

wsd: remove the last session immediately if no saving needed

Change-Id: I509c7a83f16caf0d55fcb6af9c7ce707b7a0e389
Reviewed-on: https://gerrit.libreoffice.org/35115
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index fa8ba94..aacdfae 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -601,7 +601,7 @@ bool DocumentBroker::autoSave(const bool force)
 {
 // Nothing to do.
 LOG_TRC("Nothing to autosave [" << _docKey << "].");
-return true;
+return false;
 }
 
 // Remember the last save time, since this is the predicate.
@@ -779,9 +779,7 @@ size_t DocumentBroker::removeSession(const std::string& id, 
bool destroyIfLast)
 LOG_INF("Removing session [" << id << "] on docKey [" << _docKey <<
 "]. Have " << _sessions.size() << " sessions.");
 
-if (_lastEditableSession)
-autoSave(true);
-else
+if (!_lastEditableSession || !autoSave(true))
 return removeSessionInternal(id);
 }
 catch (const std::exception& ex)
@@ -797,7 +795,8 @@ size_t DocumentBroker::removeSessionInternal(const 
std::string& id)
 try
 {
 // remove also from the _newSessions
-_newSessions.erase(std::remove_if(_newSessions.begin(), 
_newSessions.end(), [&id](NewSession& newSession) { return 
newSession._session->getId() == id; }),
+_newSessions.erase(std::remove_if(_newSessions.begin(), 
_newSessions.end(),
+  [&id](NewSession& newSession) { 
return newSession._session->getId() == id; }),
_newSessions.end());
 
 Admin::instance().rmDoc(_docKey, id);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.cpp |5 -
 wsd/DocumentBroker.hpp |8 
 wsd/LOOLWSD.cpp|6 +-
 3 files changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 388d7b1dbf1a5c2d155c0149247b3a319114f8b0
Author: Ashod Nakashian 
Date:   Sun Mar 12 14:12:36 2017 -0400

wsd: TerminatingPoll always starts its own thread

Since all TerminatingPoll instances need to fire
a thread, no reason to do it manually and risk
races. Now TerminatingPoll does it in the ctor.

Change-Id: I59850ad48b3789f3a23d01abb05a7f28e5717031
Reviewed-on: https://gerrit.libreoffice.org/35114
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 1b47d68..fa8ba94 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -163,11 +163,6 @@ DocumentBroker::DocumentBroker(const std::string& uri,
 _stop = false;
 }
 
-void DocumentBroker::startThread()
-{
-_poll->startThread();
-}
-
 // The inner heart of the DocumentBroker - our poll loop.
 void DocumentBroker::pollThread()
 {
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 2d30802..2a9c152 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -44,7 +44,10 @@ class TerminatingPoll : public SocketPoll
 {
 public:
 TerminatingPoll(const std::string &threadName) :
-SocketPoll(threadName) {}
+SocketPoll(threadName)
+{
+startThread();
+}
 
 bool continuePolling() override
 {
@@ -220,9 +223,6 @@ public:
 
 ~DocumentBroker();
 
-/// Start processing events
-void startThread();
-
 /// Loads a document from the public URI into the jail.
 bool load(std::shared_ptr& session, const std::string& 
jailId);
 bool isLoaded() const { return _isLoaded; }
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a459bf4..98250b4 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2167,7 +2167,6 @@ private:
 
 void handleClientWsUpgrade(const Poco::Net::HTTPRequest& request, const 
std::string& url)
 {
-// requestHandler = new ClientRequestHandler();
 LOG_INF("Client WS request" << request.getURI() << ", url: " << url);
 
 // First Upgrade.
@@ -2221,9 +2220,9 @@ private:
 _clientSession->onConnect(socket);
 docBroker->addSocketToPoll(socket);
 }
-docBroker->startThread();
 }
 }
+
 if (!docBroker || !_clientSession)
 LOG_WRN("Failed to connect DocBroker and Client Session.");
 }
@@ -2349,14 +2348,11 @@ public:
 void startPrisoners(const int port)
 {
 PrisonerPoll.insertNewSocket(findPrisonerServerPort(port));
-PrisonerPoll.startThread();
 }
 
 void start(const int port)
 {
 _acceptPoll.insertNewSocket(findServerPort(port));
-_acceptPoll.startThread();
-WebServerPoll.startThread();
 }
 
 void stop()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.cpp |   34 ++
 wsd/DocumentBroker.hpp |   10 +-
 wsd/LOOLWSD.cpp|4 ++--
 3 files changed, 13 insertions(+), 35 deletions(-)

New commits:
commit cbd00bf7c8600afb0f7ec09a8ad90f1b5ed2f298
Author: Ashod Nakashian 
Date:   Sun Mar 12 13:56:42 2017 -0400

wsd: simplify DocumentBroker construction

DocumentBrokerPoll is always owned by a
single DocumentBroker instance, so we
can hold a reference to it. This eliminates
the need to hold a shared_ptr to the owner
which, in turn, eliminates the need for
a create wrapper.

Change-Id: I954c9dddcc3b2cfdd5dfcc8248ab3d47a897f684
Reviewed-on: https://gerrit.libreoffice.org/35113
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index c4c3307..1b47d68 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -114,23 +114,22 @@ std::string DocumentBroker::getDocKey(const Poco::URI& 
uri)
 }
 
 /// The Document Broker Poll - one of these in a thread per document
-class DocumentBroker::DocumentBrokerPoll : public TerminatingPoll
+class DocumentBroker::DocumentBrokerPoll final : public TerminatingPoll
 {
-std::shared_ptr _docBroker;
+/// The DocumentBroker owning us.
+DocumentBroker& _docBroker;
+
 public:
-DocumentBrokerPoll(const std::string &threadName)
-: TerminatingPoll(threadName)
-{
-}
-void setDocumentBroker(const std::shared_ptr &docBroker)
+DocumentBrokerPoll(const std::string &threadName, DocumentBroker& 
docBroker) :
+TerminatingPoll(threadName),
+_docBroker(docBroker)
 {
-_docBroker = docBroker;
 }
 
 virtual void pollingThread()
 {
-assert (_docBroker);
-_docBroker->pollThread();
+// Delegate to the docBroker.
+_docBroker.pollThread();
 }
 };
 
@@ -152,7 +151,7 @@ DocumentBroker::DocumentBroker(const std::string& uri,
 _cursorPosY(0),
 _cursorWidth(0),
 _cursorHeight(0),
-_poll(new DocumentBrokerPoll("docbrk_poll")),
+_poll(new DocumentBrokerPoll("docbrk_poll", *this)),
 _tileVersion(0),
 _debugRenderedTileCount(0)
 {
@@ -164,19 +163,6 @@ DocumentBroker::DocumentBroker(const std::string& uri,
 _stop = false;
 }
 
-std::shared_ptr DocumentBroker::create(
-const std::string& uri,
-const Poco::URI& uriPublic,
-const std::string& docKey,
-const std::string& childRoot)
-{
-std::shared_ptr docBroker = 
std::make_shared(uri, uriPublic, docKey, childRoot);
-
-docBroker->_poll->setDocumentBroker(docBroker);
-
-return docBroker;
-}
-
 void DocumentBroker::startThread()
 {
 _poll->startThread();
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 0ca4ab7..2d30802 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -212,19 +212,11 @@ public:
 /// Dummy document broker that is marked to destroy.
 DocumentBroker();
 
-/// Use create - not this constructor ...
-/// FIXME: friend with make_shared etc.
+/// Construct DocumentBroker with URI, docKey, and root path.
 DocumentBroker(const std::string& uri,
const Poco::URI& uriPublic,
const std::string& docKey,
const std::string& childRoot);
-public:
-static std::shared_ptr create(
-   const std::string& uri,
-   const Poco::URI& uriPublic,
-   const std::string& docKey,
-   const std::string& childRoot);
-
 
 ~DocumentBroker();
 
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index eb06f5f..a459bf4 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1296,7 +1296,7 @@ static std::shared_ptr 
createDocBroker(WebSocketHandler& ws,
 
 // Set the one we just created.
 LOG_DBG("New DocumentBroker for docKey [" << docKey << "].");
-auto docBroker = DocumentBroker::create(uri, uriPublic, docKey, 
LOOLWSD::ChildRoot);
+auto docBroker = std::make_shared(uri, uriPublic, docKey, 
LOOLWSD::ChildRoot);
 DocBrokers.emplace(docKey, docBroker);
 LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after inserting [" << 
docKey << "].");
 
@@ -1958,7 +1958,7 @@ private:
 std::unique_lock 
docBrokersLock(DocBrokersMutex);
 
 LOG_DBG("New DocumentBroker for docKey [" << docKey << 
"].");
-auto docBroker = DocumentBroker::create(fromPath, 
uriPublic, docKey, LOOLWSD::ChildRoot);
+auto docBroker = 
std::make_shared(fromPath, uriPublic, docKey, 
LOOLWSD::ChildRoot);
 
 cleanupDocBrokers();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: test/integration-http-server.cpp

2017-03-12 Thread Ashod Nakashian
 test/integration-http-server.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d1f201c63ce8697ee9328c05f49deccbe51fbd00
Author: Ashod Nakashian 
Date:   Sun Mar 12 13:53:32 2017 -0400

wsd: testHandshake test doc filename includes test name

Change-Id: Id741daca14a7590ae66ee2206be99c35fe10fc33
Reviewed-on: https://gerrit.libreoffice.org/35112
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/test/integration-http-server.cpp b/test/integration-http-server.cpp
index 0882b39..3530ed5 100644
--- a/test/integration-http-server.cpp
+++ b/test/integration-http-server.cpp
@@ -229,7 +229,7 @@ void HTTPServerTest::testScriptsAndLinksPost()
 
 void HTTPServerTest::testConvertTo()
 {
-const auto srcPath = FileUtil::getTempFilePath(TDOC, "hello.odt");
+const auto srcPath = FileUtil::getTempFilePath(TDOC, "hello.odt", 
"convertTo_");
 std::unique_ptr 
session(helpers::createSession(_uri));
 session->setTimeout(Poco::Timespan(2, 0)); // 2 seconds.
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Makefile.fetch

2017-03-12 Thread Khaled Hosny
 Makefile.fetch |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 48670533998f078525f7dad94b89bc371a5b3947
Author: Khaled Hosny 
Date:   Sat Mar 11 04:09:21 2017 +0200

Ignore the checksum embedded in the file name

That is always MD5 sum, but we expect SHA256 now.

Change-Id: I8edf61b9a663f6f1ecc5cf23c93211e0b3201631
Reviewed-on: https://gerrit.libreoffice.org/35067
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/Makefile.fetch b/Makefile.fetch
index 3091c5e..de929d8 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -59,10 +59,7 @@ endef
 define fetch_Download_item
 $(if $(strip $($(2))),,$(error fetch__Download_item: $(2) is empty))
 $(if $(filter undefined,$(origin $(call fetch_Download__subst_var,$(2,\
-   $(if $(call fetch_Download__is_checksum,$(firstword $(subst -, 
,$($(2),\
-   $(call fetch__Download_item,$1,$($2),$(firstword $(subst -, 
,$($(2),\
-   $(error "fetch_Download_item: no checksum found for $($(2)). 
Please define $(call fetch_Download__subst_var,$(2)) in download.lst.") \
-   ),\
+   $(error "fetch_Download_item: no checksum found for $($(2)). Please 
define $(call fetch_Download__subst_var,$(2)) in download.lst."),\
$(call fetch__Download_item,$(1),$($2),$($(call 
fetch_Download__subst_var,$(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' - sc/source

2017-03-12 Thread Katarina Behrens
 sc/source/ui/view/preview.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b95ac4bac7ae43f3f3d60738f739a75f8f8e9b6e
Author: Katarina Behrens 
Date:   Wed Mar 1 17:45:16 2017 +0100

tdf#95612: Print preview: page numbering starts with 1 (not 0)

unless otherwise specified. It was okay for 1st page & broken
everywhere else. Possibly resolves tdf#95206 as well ...

Change-Id: Ie69f770a28dd69f90d4f04ad4fa9e701fa2d56e2
Reviewed-on: https://gerrit.libreoffice.org/34759
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit c07ac0d92ad830762906586164bab466a0f05531)
Reviewed-on: https://gerrit.libreoffice.org/35047

diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index a8dc240..f1ad586 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -243,18 +243,18 @@ void ScPreview::CalcPages()
 while (nStart > static_cast(nPages.size()))
 nPages.push_back(0);
 while (nStart > static_cast(nFirstAttr.size()))
-nFirstAttr.push_back(0);
+nFirstAttr.push_back(1);
 
 for (SCTAB i=nStart; i(nPages.size()))
 nPages.push_back(0);
 if ( i == static_cast(nFirstAttr.size()))
-nFirstAttr.push_back(0);
+nFirstAttr.push_back(1);
 if (!aOptions.GetAllSheets() && maSelectedTabs.count(i) == 0)
 {
 nPages[i] = 0;
-nFirstAttr[i] = 0;
+nFirstAttr[i] = 1;
 continue;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: android/source

2017-03-12 Thread aleksandar-stefanovic
 android/source/res/menu/view_menu.xml |   25 +-
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |  121 
+-
 2 files changed, 83 insertions(+), 63 deletions(-)

New commits:
commit 243476399e76fb5ad2ce8c7fbef9e224b330c706
Author: aleksandar-stefanovic 
Date:   Sat Feb 25 11:09:22 2017 +0100

Made sort menu use radio buttons

This makes it MUCH easier to see what sort option is currently
selected. Removed the mechanism of switching between labels when
the option is toggled, and instead put all the options into a menu.

Change-Id: I44142dc842d983d5438faeb06b67046bad235308
Reviewed-on: https://gerrit.libreoffice.org/34640
Tested-by: Jenkins 
Reviewed-by: Aleksandar Stefanović 

diff --git a/android/source/res/menu/view_menu.xml 
b/android/source/res/menu/view_menu.xml
index 2b99ad1..67f0596 100644
--- a/android/source/res/menu/view_menu.xml
+++ b/android/source/res/menu/view_menu.xml
@@ -35,12 +35,25 @@
 android:icon="@drawable/ic_sort_black_24dp"
 app:showAsAction="ifRoom">
 
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 ___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: chart2/Module_chart2.mk

2017-03-12 Thread Markus Mohrhard
 chart2/Module_chart2.mk |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 7f09093b8bbc119f50763e1b629424cc2669628a
Author: Markus Mohrhard 
Date:   Sun Mar 12 22:46:49 2017 +0100

the test seems to depend on the fonts

Fixes "Random Config" tb run #289

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

diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk
index 0061c0a..f39140d 100644
--- a/chart2/Module_chart2.mk
+++ b/chart2/Module_chart2.mk
@@ -37,10 +37,11 @@ $(eval $(call gb_Module_add_slowcheck_targets,chart2,\
 ))
 
 ifeq ($(ENABLE_CHART_TESTS),TRUE)
+ifeq ($(WITH_FONTS), TRUE)
 $(eval $(call gb_Module_add_slowcheck_targets,chart2,\
 CppunitTest_chart2_xshape \
 ))
-
+endif
 endif
 
 $(eval $(call gb_Module_add_subsequentcheck_targets,chart2,\
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'aoo/trunk' - solenv/bin

2017-03-12 Thread Matthias Seidel
 solenv/bin/modules/installer/patch/InstallationSet.pm |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 2bf0ec1ac35dec10af8b0beb52d9daac96e453f1
Author: Matthias Seidel 
Date:   Sun Mar 12 20:37:33 2017 +

Fixed typos

diff --git a/solenv/bin/modules/installer/patch/InstallationSet.pm 
b/solenv/bin/modules/installer/patch/InstallationSet.pm
index fecb94c..13b1f72 100644
--- a/solenv/bin/modules/installer/patch/InstallationSet.pm
+++ b/solenv/bin/modules/installer/patch/InstallationSet.pm
@@ -216,7 +216,7 @@ sub UnpackCab ($$$)
 ++$count;
 }
 
-# Cleanup.  Remove the temporary directory.  It should be empty by now.
+# Cleanup. Remove the temporary directory. It should be empty by now.
 rmdir($temporary_destination_path);
 }
 
@@ -227,9 +227,9 @@ sub UnpackCab ($$$)
 
 Unpack the flat file structure of the $cab_filename to $destination_path.
 
-In order to detect and handle an incomplete (arborted) previous
-extraction, the cab file is unpacked to a temprorary directory
-that after successful extraction is renamed to $destination_path.
+In order to detect and handle an incomplete (aborted) previous
+extraction, the cab file is unpacked to a temporary directory
+that, after successful extraction, is renamed to $destination_path.
 
 =cut
 sub UnpackCabFlat ($$$)
@@ -237,7 +237,7 @@ sub UnpackCabFlat ($$$)
 my ($cab_filename, $destination_path, $file_table) = @_;
 
 # Unpack the .cab file to a temporary path (note that
-# $destination_path may alreay bee a temporary path). Using a
+# $destination_path may already be a temporary path). Using a
 # second one prevents the lengthy flat unpacking to be repeated
 # when another step fails.
 
@@ -388,7 +388,7 @@ sub Download ($$$)
 my $digest = undef;
 if ( ! defined $checksum_value)
 {
-# No checksum available.  Skip test.
+# No checksum available. Skip test.
 }
 elsif ($checksum_type eq "sha256")
 {
@@ -592,7 +592,7 @@ sub ProvideUnpackedExe ($)
 
 if ($exe_is_unpacked)
 {
-# Yes, exe has already been unpacked.  There is nothing more to do.
+# Yes, exe has already been unpacked. There is nothing more to do.
 $installer::logger::Info->printf("downloadable installation set has 
already been unpacked to\n");
 $installer::logger::Info->printf("%s\n", $unpacked_exe_path);
 return 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: filter/source

2017-03-12 Thread Caolán McNamara
 filter/source/graphicfilter/ipict/ipict.cxx |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 4cde204c297ab122b1496444aa2e31c388f621d7
Author: Caolán McNamara 
Date:   Sun Mar 12 21:16:57 2017 +

ofz: pct oom, avoid allocation bitmap until after size checks are done

Change-Id: I12817adc50d45e2f08b3b5d4cb43daa527d274e9

diff --git a/filter/source/graphicfilter/ipict/ipict.cxx 
b/filter/source/graphicfilter/ipict/ipict.cxx
index 96fc7d8..749bfaf 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -703,8 +703,9 @@ sal_uLong PictReader::ReadAndDrawText()
 
 namespace
 {
-BitmapWriteAccess* initBitmap(Bitmap &rBitmap, const BitmapPalette 
&rPalette)
+BitmapWriteAccess* initBitmap(Bitmap &rBitmap, sal_uInt16 nWidth, 
sal_uInt16 nHeight, sal_uInt16 nDstBitCount, const BitmapPalette &rPalette)
 {
+rBitmap = Bitmap(Size(nWidth, nHeight), nDstBitCount);
 BitmapWriteAccess* pAcc = rBitmap.AcquireWriteAccess();
 if (!pAcc)
 return nullptr;
@@ -757,7 +758,6 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool 
bBaseAddr, bool bColo
 nDstBitCount = 24;
 else if ( nDstBitCount == 2 )
 nDstBitCount = 4;
-aBitmap = Bitmap( Size( nWidth, nHeight ), nDstBitCount );
 
 if ( bColorTable )
 {
@@ -788,7 +788,6 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool 
bBaseAddr, bool bColo
 nRowBytes &= 0x3fff;
 nPixelSize = nCmpCount = nCmpSize = 1;
 nDataSize += 10;
-aBitmap = Bitmap(Size(nWidth, nHeight), nDstBitCount);
 aPalette = BitmapPalette(2);
 aPalette[0] = BitmapColor(0xff, 0xff, 0xff);
 aPalette[1] = BitmapColor(0, 0, 0);
@@ -857,7 +856,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool 
bBaseAddr, bool bColo
 return 0x;
 }
 
-if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
+if ( ( pAcc = initBitmap(aBitmap, nWidth, nHeight, nDstBitCount, 
aPalette) ) == nullptr )
 return 0x;
 
 for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
@@ -940,7 +939,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool 
bBaseAddr, bool bColo
 return 0x;
 }
 
-if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
+if ( ( pAcc = initBitmap(aBitmap, nWidth, nHeight, nDstBitCount, 
aPalette) ) == nullptr )
 return 0x;
 
 for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
@@ -1037,7 +1036,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, 
bool bBaseAddr, bool bColo
 if (nWidth > nMaxCols)
 return 0x;
 
-if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
+if ( ( pAcc = initBitmap(aBitmap, nWidth, nHeight, nDstBitCount, 
aPalette) ) == nullptr )
 return 0x;
 
 for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
@@ -1061,7 +1060,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, 
bool bBaseAddr, bool bColo
 if (nWidth > nMaxCols)
 return 0x;
 
-if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
+if ( ( pAcc = initBitmap(aBitmap, nWidth, nHeight, nDstBitCount, 
aPalette) ) == nullptr )
 return 0x;
 
 for (sal_uInt16 ny = 0; ny < nHeight; ++ny)
@@ -1084,7 +1083,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, 
bool bBaseAddr, bool bColo
 if (nHeight > pPict->remainingSize() / nByteCountSize)
 return 0x;
 
-if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
+if ( ( pAcc = initBitmap(aBitmap, nWidth, nHeight, 
nDstBitCount, aPalette) ) == nullptr )
 return 0x;
 
 std::unique_ptr pScanline(new 
sal_uInt8[static_cast(nWidth) * nCmpCount]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

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

New commits:
commit 2a118816d90e8daa36a447db7cf4718830450099
Author: Caolán McNamara 
Date:   Sun Mar 12 21:06:23 2017 +

ofz#827 avoid oom in xpms

Change-Id: I323be5e042e0ccb21956def70a8c481833f43998

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index 6d348eb..19b3fd4 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -160,6 +160,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
 mbStatus = false;
 if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF )
 mbStatus = false;
+//xpms are a minimum of one character (one byte) per pixel, so if 
the file isn't
+//even that long, its not all there
+if (mrIStm.remainingSize() < static_cast(mnWidth) * 
mnHeight)
+mbStatus = false;
 if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp )
 {
 mnIdentifier = XPMCOLORS;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Ximeng Zu license statement

2017-03-12 Thread uznomis
All of my past & future contributions to LibreOffice may be licensed under the 
MPLv2/LGPLv3+ dual license.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: include/filter lotuswordpro/source odk/examples offapi/com officecfg/registry qadevOOo/tests shell/source

2017-03-12 Thread Andrea Gelmini
 include/filter/msfilter/svdfppt.hxx
 |2 -
 lotuswordpro/source/filter/xfilter/xfdrawobj.hxx   
 |2 -
 lotuswordpro/source/filter/xfilter/xfparastyle.hxx 
 |   14 +-
 odk/examples/DevelopersGuide/Database/CodeSamples.java 
 |2 -
 odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
 |2 -
 odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusView.java  
 |4 +-
 
odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
 |2 -
 odk/examples/DevelopersGuide/ScriptingFramework/SayHello/build.xml 
 |2 -
 odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/build.xml   
 |2 -
 offapi/com/sun/star/accessibility/AccessibleEventId.idl
 |2 -
 offapi/com/sun/star/chart/Diagram.idl  
 |2 -
 offapi/com/sun/star/util/PathSubstitution.idl  
 |2 -
 officecfg/registry/schema/org/openoffice/Office/Common.xcs 
 |2 -
 qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryComposer.java   
 |6 ++--
 shell/source/win32/spsupp/COMOpenDocuments.cxx 
 |2 -
 15 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 127b2e59995f3abcf1593138cd27af9f375d7b1b
Author: Andrea Gelmini 
Date:   Sun Mar 12 17:03:26 2017 +0100

Fix typos

Change-Id: I63da858b3f264cd099e60192633b44d362b6fad7
Reviewed-on: https://gerrit.libreoffice.org/35055
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/include/filter/msfilter/svdfppt.hxx 
b/include/filter/msfilter/svdfppt.hxx
index d83be89..f6f1c49 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -238,7 +238,7 @@ struct PptSlidePersistAtom
 sal_uInt32  nFlags;
 sal_uInt32  nNumberTexts;
 sal_uInt32  nSlideId;
-sal_uInt32  nReserved;  // we will use nReserved 
temporarly to set the offset to SSSlideInfoAtom ( if possible )
+sal_uInt32  nReserved;  // we will use nReserved 
temporarily to set the offset to SSSlideInfoAtom ( if possible )
 
 public:
 PptSlidePersistAtom() { Clear(); }
diff --git a/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx 
b/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
index 3c4292a..3d0760b 100644
--- a/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfdrawobj.hxx
@@ -74,7 +74,7 @@
  * Base class for all drawing object(ellipse,rect,circle,...).
  * I can set Positions,anchor,rotate,text style name here.
  *
- * Drawing objects can be rotated,scaled and skewed, drawing objects must have 
positions setted,
+ * Drawing objects can be rotated, scaled and skewed, drawing objects must 
have positions set,
  * you can use SetPosition(...).
  */
 class XFDrawObject : public XFFrame
diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.hxx 
b/lotuswordpro/source/filter/xfilter/xfparastyle.hxx
index 07f4c70..c73e346 100644
--- a/lotuswordpro/source/filter/xfilter/xfparastyle.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfparastyle.hxx
@@ -102,7 +102,7 @@ public:
 
 public:
 /**
- * @descr   Set layout for the paragraph.When such property was setted, 
this paragraph will
+ * @descr   Set layout for the paragraph. When such property was set, this 
paragraph will
  *  start at an new page.
  */
 voidSetMasterPage(const OUString& master);
@@ -111,7 +111,7 @@ public:
 
 /**
  * @descr   set the paragraph default font.
- * @param   font font object to be setted.Font object are deleted by 
font-factory,so
+ * @param   font object to be set. Font object is deleted by font-factory, 
so
  *  don't delete it in the destructure function of para style.
  */
 voidSetFont(rtl::Reference const & font);
@@ -122,14 +122,14 @@ public:
 const rtl::Reference& GetFont(){ return m_pFont; }
 
 /**
- * @descr   Set the indent of the paragraph.This is the indent for
+ * @descr   Set the indent of the paragraph. This is the indent for
 the first line.
  * @param   indent value of the first-line indent.
  */
 voidSetIndent(double indent );
 
 /**
- * @descr   Set the padding of the paragraph.This is the distance
+ * @descr   Set the padding of the paragraph. This is the distance
 between the border and the top of the text.
  * @param   indent value of the padding.
  */
@@ -149,7 +149,7 @@ public:
 voidSetAlignType(enumXFAlignType eAlign);
 
 /**
- 

[Libreoffice-commits] core.git: Changes to 'refs/tags/cp-5.1-22'

2017-03-12 Thread Andras Timar
Tag 'cp-5.1-22' created by Andras Timar  at 
2017-03-12 17:42 +

cp-5.1-22

Changes since cp-5.1-21-35:
---
 0 files changed
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] translations.git: Changes to 'refs/tags/cp-5.1-22'

2017-03-12 Thread jan Iversen
Tag 'cp-5.1-22' created by Andras Timar  at 
2017-03-12 17:42 +

cp-5.1-22

Changes since cp-5.1-9-2:
---
 0 files changed
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] help.git: Changes to 'refs/tags/cp-5.1-22'

2017-03-12 Thread Miklos Vajna
Tag 'cp-5.1-22' created by Andras Timar  at 
2017-03-12 17:42 +

cp-5.1-22

Changes since libreoffice-5-1-branch-point-11:
---
 0 files changed
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] dictionaries.git: Changes to 'refs/tags/cp-5.1-22'

2017-03-12 Thread Andras Timar
Tag 'cp-5.1-22' created by Andras Timar  at 
2017-03-12 17:42 +

cp-5.1-22

Changes since cp-5.1-17:
Andras Timar (1):
  tdf#105396 update German dictionaries

---
 de/README_extension_owner.txt |   11 
 de/README_hyph_de.txt |5 
 de/README_thesaurus.txt   |4 
 de/de_AT_frami.aff|4 
 de/de_AT_frami.dic|12602 -
 de/de_CH_frami.aff|4 
 de/de_CH_frami.dic|12460 -
 de/de_DE_frami.aff|4 
 de/de_DE_frami.dic|12574 -
 de/description.xml|2 
 de/hyph_de_AT.dic |74431 +++-
 de/hyph_de_CH.dic |74429 +++-
 de/hyph_de_DE.dic |74427 +++-
 de/th_de_CH_v2.dat|95202 ++---
 de/th_de_DE_v2.dat|95282 ++
 15 files changed, 360559 insertions(+), 90882 deletions(-)
---
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - configure.ac

2017-03-12 Thread Andras Timar
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 081188442b1f5ed22df150e620cc81f1cf43f7ff
Author: Andras Timar 
Date:   Sun Mar 12 18:41:58 2017 +0100

Bump version to 5.1-22

Change-Id: Ib9fb351996cd63280cc138f43c900b97b9beaf40

diff --git a/configure.ac b/configure.ac
index cc7599f..acfa086 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for 
the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no 
idea.
 
-AC_INIT([Collabora Office],[5.1.10.21],[],[],[https://collaboraoffice.com/])
+AC_INIT([Collabora Office],[5.1.10.22],[],[],[https://collaboraoffice.com/])
 
 AC_PREREQ([2.59])
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - desktop/CppunitTest_desktop_app.mk desktop/source

2017-03-12 Thread Mike Kaganski
 desktop/CppunitTest_desktop_app.mk |1 
 desktop/source/app/cmdlineargs.cxx |   90 -
 2 files changed, 90 insertions(+), 1 deletion(-)

New commits:
commit 731f073f1ff469e446da68c2c75f0ad8ff86c299
Author: Mike Kaganski 
Date:   Mon Mar 6 16:09:54 2017 +0300

tdf#106359: Open Web Query (.iqy) files

As per http://support.microsoft.com/kb/157482, the files are plain-text
files with an URL and optional GET and POST parameters (static and
dynamic).

This commit introduces basic support to open these files
(without support for POST and dynamic parameters).

Reviewed-on: https://gerrit.libreoffice.org/34928
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 099f9406b6657a03a37fbe5cedf7cb7da765d4aa)

Change-Id: Ib733c97780d363243644247196402f402c495cd1
Reviewed-on: https://gerrit.libreoffice.org/35011
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/desktop/CppunitTest_desktop_app.mk 
b/desktop/CppunitTest_desktop_app.mk
index 1275b6e..af036f8 100644
--- a/desktop/CppunitTest_desktop_app.mk
+++ b/desktop/CppunitTest_desktop_app.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_app, \
 cppu \
 cppuhelper \
 sal \
+ucbhelper \
 sofficeapp \
 ))
 
diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index 81704e7..dc7873c 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -36,7 +36,9 @@
 
 #include 
 
-#include 
+#include 
+#include 
+#include 
 
 using namespace com::sun::star::lang;
 using namespace com::sun::star::uri;
@@ -165,6 +167,89 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& 
arg, CommandLineEvent cur
 return curEvt;
 }
 
+// Skip single newline (be it *NIX LF, MacOS CR, of Win CRLF)
+// Changes the offset, and returns true if moved
+bool SkipNewline(const char* pStr, sal_Int32& rOffset)
+{
+if ((pStr[rOffset] != '\r') && (pStr[rOffset] != '\n'))
+return false;
+if (pStr[rOffset] == '\r')
+++rOffset;
+if (pStr[rOffset] == '\n')
+++rOffset;
+return true;
+}
+
+// Web query: http://support.microsoft.com/kb/157482
+CommandLineEvent CheckWebQuery(/* in,out */ OUString& arg, CommandLineEvent 
curEvt)
+{
+// Only handle files with extension .iqy
+if (!arg.endsWithIgnoreAsciiCase(".iqy"))
+return curEvt;
+
+static osl::Mutex aMutex;
+osl::MutexGuard aGuard(aMutex);
+
+try
+{
+OUString sFileURL;
+if (osl::FileBase::getFileURLFromSystemPath(arg, sFileURL) != 
osl::FileBase::RC::E_None)
+return curEvt;
+css::uno::Reference < css::ucb::XCommandEnvironment > xEnv;
+ucbhelper::Content aSourceContent(sFileURL, xEnv, 
comphelper::getProcessComponentContext());
+
+// the file can be opened readonly, no locking will be done
+css::uno::Reference< css::io::XInputStream > xInput = 
aSourceContent.openStream();
+if (!xInput.is())
+return curEvt;
+
+const sal_Int32 nBufLen = 32000;
+css::uno::Sequence< sal_Int8 > aBuffer(nBufLen);
+sal_Int32 nRead = xInput->readBytes(aBuffer, nBufLen);
+if (nRead < 8) // WEB\n1\n...
+return curEvt;
+
+const char* sBuf = reinterpret_cast(aBuffer.getConstArray());
+sal_Int32 nOffset = 0;
+if (strncmp(sBuf+nOffset, "WEB", 3) != 0)
+return curEvt;
+nOffset += 3;
+if (!SkipNewline(sBuf, nOffset))
+return curEvt;
+if (sBuf[nOffset] != '1')
+return curEvt;
+++nOffset;
+if (!SkipNewline(sBuf, nOffset))
+return curEvt;
+
+rtl::OStringBuffer aResult(nRead);
+do
+{
+// xInput->readBytes() can relocate buffer
+sBuf = reinterpret_cast(aBuffer.getConstArray());
+const char* sPos = sBuf + nOffset;
+const char* sPos1 = sPos;
+const char* sEnd = sBuf + nRead;
+while ((sPos1 < sEnd) && (*sPos1 != '\r') && (*sPos1 != '\n'))
+++sPos1;
+aResult.append(sPos, sPos1 - sPos);
+if (sPos1 < sEnd) // newline
+break;
+nOffset = 0;
+} while ((nRead = xInput->readBytes(aBuffer, nBufLen)) > 0);
+
+xInput->closeInput();
+
+arg = OUString::createFromAscii(aResult.getStr());
+}
+catch (...)
+{
+SAL_WARN("desktop.app", "An error processing Web Query file: " << arg);
+}
+
+return curEvt;
+}
+
 } // namespace
 
 CommandLineArgs::Supplier::Exception::Exception() {}
@@ -525,6 +610,9 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& 
supplier )
 // and put real URI to aArg
 CommandLineEvent eThisEvent = CheckOfficeURI(aArg, 
eCurrentEvent);
 
+// Now check if this is a Web Query file
+ 

[Libreoffice-commits] core.git: editeng/source include/editeng

2017-03-12 Thread Caolán McNamara
 editeng/source/items/frmitems.cxx |3 +--
 include/editeng/brushitem.hxx |2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 975bfbe29dc92de8d9e081685d2377ea8f7ce62e
Author: Caolán McNamara 
Date:   Sat Mar 11 21:21:15 2017 +

make this a member of SvxBrushItem

Change-Id: If1216b03a313885bb284ca5ddcd8a91167a3638b

diff --git a/editeng/source/items/frmitems.cxx 
b/editeng/source/items/frmitems.cxx
index 2f235b2..b10159b 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -45,7 +45,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -3801,7 +3800,7 @@ const GraphicObject* 
SvxBrushItem::GetGraphicObject(OUString const & referer) co
 if (bLoadAgain && !maStrLink.isEmpty() && !xGraphicObject)
 // when graphics already loaded, use as a cache
 {
-if (SvtSecurityOptions().isUntrustedReferer(referer)) {
+if (maSecOptions.isUntrustedReferer(referer)) {
 return nullptr;
 }
 
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
index 83d4467..149db46 100644
--- a/include/editeng/brushitem.hxx
+++ b/include/editeng/brushitem.hxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -49,6 +50,7 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
 mutable std::unique_ptr xGraphicObject;
 sal_Int8nGraphicTransparency; //contains a percentage value 
which is
   //copied to the GraphicObject 
when necessary
+SvtSecurityOptions  maSecOptions;
 OUStringmaStrLink;
 OUStringmaStrFilter;
 SvxGraphicPosition  eGraphicPos;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: bin/gbuild-to-ide

2017-03-12 Thread Gian Domenico Ceccarini
 bin/gbuild-to-ide |   45 +++--
 1 file changed, 23 insertions(+), 22 deletions(-)

New commits:
commit b9c1eb5d929061570c95f7438471e6c07097f40e
Author: Gian Domenico Ceccarini 
Date:   Sat Mar 11 15:51:13 2017 +0100

solution ProjectIDE-vs2013: Generate.5: only 1 .vcxproj and .filter pr 
module

change for cicle to generate only one .vcxproj and .filter pr module

Change-Id: I93f2279e368e11ef5b9d442c6dcdfa4bf39bd6c2
Reviewed-on: https://gerrit.libreoffice.org/35075
Tested-by: Jenkins 
Reviewed-by: jan iversen 

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index a123216..1cc449a 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -236,14 +236,11 @@ class testVS2013Ide(IdeIntegrationGenerator):
 projects = []
 module_directory = os.path.join(self.solution_directory, module)
 if module != 'include':  # FIXME
+project_path = os.path.join(module_directory, '%s.vcxproj' % 
module)
+project_guid = self.twrite_project(project_path, module)
+self.write_filters(project_path + '.filters', module, 
self.gbuildparser.modules[module]['headers'])
 for target in self.gbuildparser.modules[module]['targets']:
-
-project_path = os.path.join(module_directory, '%s.vcxproj' 
% target['target_name'])
-
-project_guid = self.twrite_project(project_path, target)
-#self.twrite_project(project_path,target)
-p = VisualStudioIntegrationGenerator.Project(project_guid, 
target, project_path)
-self.write_filters(project_path + 
'.filters',target,self.gbuildparser.modules[module]['headers'])
+p = self.Project(project_guid, target, project_path)
 projects.append(p)
 self.write_solution(os.path.join(module_directory, '%s.sln' % 
module), projects)
 all_projects += projects
@@ -418,7 +415,7 @@ class testVS2013Ide(IdeIntegrationGenerator):
 return project_guid
 
 
-def twrite_project(self, project_path, target):
+def twrite_project(self, project_path, module):
 folder = os.path.dirname(project_path)
 if not os.path.exists(folder):
 os.makedirs(folder)
@@ -442,7 +439,7 @@ class testVS2013Ide(IdeIntegrationGenerator):
 proj_guid_node = ET.SubElement(globals_node, '{%s}ProjectGuid' % ns)
 proj_guid_node.text = '{%s}' % project_guid
 proj_root_namespace=ET.SubElement(globals_node, '{%s}RootNamespace' % 
ns)
-proj_root_namespace.text = target['target_name']
+proj_root_namespace.text = module
 
 
 ET.SubElement(proj_node, '{%s}Import' % ns, 
Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
@@ -475,10 +472,12 @@ class testVS2013Ide(IdeIntegrationGenerator):
 opt_node.text='Disabled'
 sdl_check=ET.SubElement(cl_compile,'{%s}SDLCheck' % ns)
 sdl_check.text='true'
-
add_incl_dir=ET.SubElement(cl_compile,'{%s}AdditionalIncludeDirectories' % ns)
-add_incl_dir.text=self.get_include_dirs(target)
-add_incl_def_flag=ET.SubElement(cl_compile,'{%s}AdditionalOptions' 
% ns)
-add_incl_def_flag.text=self.get_flags_defs(target)
+for target in self.gbuildparser.modules[module]['targets']:
+
add_incl_dir=ET.SubElement(cl_compile,'{%s}AdditionalIncludeDirectories' % ns)
+add_incl_dir.text=self.get_include_dirs(target)
+
add_incl_def_flag=ET.SubElement(cl_compile,'{%s}AdditionalOptions' % ns)
+add_incl_def_flag.text=self.get_flags_defs(target)
+
 
dgb_info_form=ET.SubElement(cl_compile,'{%s}DebugInformationFormat' % ns)
 dgb_info_form.text='ProgramDatabase'
 warn_as_error=ET.SubElement(cl_compile,'{%s}TreatWarningAsError' % 
ns)
@@ -504,9 +503,10 @@ class testVS2013Ide(IdeIntegrationGenerator):
 
 #cxx files
 cxx_node=ET.SubElement(proj_node,'{%s}ItemGroup' % ns)
-for cxx_elem in target['CXXOBJECTS']:
-modulename=target['module']
-cxx_cl_node=ET.SubElement(cxx_node,'{%s}ClCompile' % 
ns,Include=os.path.join('../..', modulename, cxx_elem))
+for target in self.gbuildparser.modules[module]['targets']:
+for cxx_elem in target['CXXOBJECTS']:
+modulename=target['module']
+cxx_cl_node=ET.SubElement(cxx_node,'{%s}ClCompile' % 
ns,Include=os.path.join('../..', modulename, cxx_elem))
 #miss headers
 ET.SubElement(proj_node, '{%s}Import' % ns, 
Project='$(VCTargetsPath)\Microsoft.Cpp.targets')
 ET.SubElement(proj_node, '{%s}ImportGroup' % ns, 
Label='ExtensionTargets')
@@ -541,7 +541,7 @@ class testVS2013Ide(IdeIntegrationGenerator):
 with open(file_path, 'w') as f:
 f.write(pretty_str.decode())
 
-

[Libreoffice-commits] core.git: sc/source

2017-03-12 Thread Stephan Bergmann
 sc/source/ui/navipi/navipi.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f44deda8630fbe346cef5e1e93866c334c1c0818
Author: Stephan Bergmann 
Date:   Sun Mar 12 15:56:07 2017 +0100

nZoomId is already a ToolBox item ID, not an item position

...so doesn't need to be passed through GetItemId.  Apparent thinko in
e3bd10f8d5c7750dd0a700f738f4713519cde118 "adjust the hide of the zoom so its
dynamic on docking/undocking navigators".

Change-Id: I26c300522f048b8fd661856bfe2789ee7718ad15

diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index f955d54..b8c28fa 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -550,7 +550,7 @@ void ScNavigatorDlg::StateChanged(StateChangedType 
nStateChange)
 // When the navigator is displayed in the sidebar, or is otherwise
 // docked, it has the whole deck to fill. Therefore hide the button 
that
 // hides all controls below the top two rows of buttons.
-aTbxCmd->ShowItem(aTbxCmd->GetItemId(nZoomId), 
SfxChildWindowContext::GetFloatingWindow(GetParent()));
+aTbxCmd->ShowItem(nZoomId, 
SfxChildWindowContext::GetFloatingWindow(GetParent()));
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2017-03-12 Thread Stephan Bergmann
 vcl/source/window/toolbox2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c6d0dd62f7aa92be723317c8be518136eec26893
Author: Stephan Bergmann 
Date:   Sun Mar 12 14:07:14 2017 +0100

Better use 0 instead of TOOLBOX_ITEM_NOTFOUND for "no ID available"

...return value from ToolBox::GetItemId, as is done in all other places 
where
such is returned from one of the ToolBox::GetItemId overloads.  And
TOOLBOX_ITEM_NOTFOUND is otherwise only used for item positions, not item 
IDs.
(This lone odd use of TOOLBOX_ITEM_NOTFOUND was introduced with
ae5f75ab0515f8ee63813ec9284fbfb2124f0a5d "Allow a common op. on a disposed
toolbox", probably by accident.)

Change-Id: Id767b1d8d0b3cdfdc0ec525f165d75ae0cef7301

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 83eaffc..a4da7c3 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -789,7 +789,7 @@ Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) const
 sal_uInt16 ToolBox::GetItemId(const OUString &rCommand) const
 {
 if (!mpData)
-return TOOLBOX_ITEM_NOTFOUND;
+return 0;
 
 for (std::vector::const_iterator it = 
mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/toolkit odk/examples officecfg/registry

2017-03-12 Thread dennisroczek
 include/toolkit/controls/dialogcontrol.hxx  |  
  6 +++---
 odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx |  
  2 +-
 officecfg/registry/schema/org/openoffice/TypeDetection/Types.xcs|  
  2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ff414feabe5bb5b7504cd02c70fa4e708ca557c0
Author: dennisroczek 
Date:   Sun Mar 12 11:16:15 2017 +

fix typo: ambigous --> ambiguous

Change-Id: I4940fe7e51df19275ba42a572c7a7a35ac2079f4
Reviewed-on: https://gerrit.libreoffice.org/35090
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/include/toolkit/controls/dialogcontrol.hxx 
b/include/toolkit/controls/dialogcontrol.hxx
index 11b72c5..d166f30 100644
--- a/include/toolkit/controls/dialogcontrol.hxx
+++ b/include/toolkit/controls/dialogcontrol.hxx
@@ -85,7 +85,7 @@ public:
 // XModifyListener
 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) 
override;
 
-// resolve some ambigous methods
+// resolve some ambiguous methods
 virtual css::uno::Reference SAL_CALL getPeer() 
override
 { return UnoDialogControl_Base::ControlContainerBase::getPeer(); }
 virtual void SAL_CALL addWindowListener(const 
css::uno::Reference& p1) override
@@ -181,7 +181,7 @@ public:
 // XNamedContainer
 void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& 
aElement ) override;
 
-// Override the method of parent Class
+// Override the method of parent class
 virtual sal_Bool SAL_CALL getGroupControl(  ) override;
 protected:
 virtual css::uno::Any  ImplGetDefaultValue( sal_uInt16 nPropId ) 
const override;
@@ -254,7 +254,7 @@ public:
 virtual OUString SAL_CALL getServiceName() override;
 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL 
getPropertySetInfo(  ) override;
 
-// Override the method of parent Class
+// Override the method of parent class
 virtual sal_Bool SAL_CALL getGroupControl(  ) override;
 protected:
 virtual css::uno::Any  ImplGetDefaultValue( sal_uInt16 nPropId ) 
const override;
diff --git 
a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx 
b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx
index 23b2483..846295b 100644
--- 
a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx
+++ 
b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx
@@ -57,7 +57,7 @@ namespace connectivity
 // a constructor, which is required for returning objects:
 OResultSetMetaData(OConnection* _pConnection) : 
m_pConnection(_pConnection){}
 
-/// Avoid ambigous cast error from the compiler.
+/// Avoid ambiguous cast error from the compiler.
 inline operator ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSetMetaData > () throw()
 { return this; }
 
diff --git a/officecfg/registry/schema/org/openoffice/TypeDetection/Types.xcs 
b/officecfg/registry/schema/org/openoffice/TypeDetection/Types.xcs
index 0f59d8b..ee7df8a 100644
--- a/officecfg/registry/schema/org/openoffice/TypeDetection/Types.xcs
+++ b/officecfg/registry/schema/org/openoffice/TypeDetection/Types.xcs
@@ -64,7 +64,7 @@
   
   
 
-  In case of ambigous registrations (e.g. for extensions doc/txt)
+  In case of ambiguous registrations (e.g. for extensions 
doc/txt)
   it specify the preferred type.
 
 false
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Your email was not delivered.

2017-03-12 Thread proofpoint-pps
Your email was not delivered as expected. You are receiving this message 
because the system is configured to send a message to the sender when parts or 
all of an email is not delivered as planned. Please review the email and any 
attachments for content that may be seen as harmful and send again.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: chart2/source

2017-03-12 Thread Julien Nabet
 chart2/source/view/charttypes/PieChart.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c91c210188f202fadbeb04ca3e0a83b177b00062
Author: Julien Nabet 
Date:   Sun Mar 12 10:53:05 2017 +0100

cppcheck: unsignedLessThanZero

Change-Id: I5c41c06f9bfa6c23a6984d2f7f5b118a13065da9
Reviewed-on: https://gerrit.libreoffice.org/35088
Tested-by: Jenkins 
Reviewed-by: Julien Nabet 

diff --git a/chart2/source/view/charttypes/PieChart.cxx 
b/chart2/source/view/charttypes/PieChart.cxx
index a806923..f737a94 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -394,7 +394,7 @@ double PieChart::getMaxOffset()
 return m_fMaxOffset;
 
 const std::vector< VDataSeries* >& rSeriesList( 
m_aZSlots[0][0].m_aSeriesVector );
-if( rSeriesList.size()<=0 )
+if(!rSeriesList.size())
 return m_fMaxOffset;
 
 VDataSeries* pSeries = rSeriesList[0];
@@ -552,7 +552,7 @@ void PieChart::createShapes()
 ShapeParam aParam;
 
 std::vector< VDataSeries* >* pSeriesList = 
&(aXSlotIter->m_aSeriesVector);
-if( pSeriesList->size()<=0 )//there should be only one series in each 
x slot
+if(!pSeriesList->size())//there should be only one series in each x 
slot
 continue;
 VDataSeries* pSeries = (*pSeriesList)[0];
 if(!pSeries)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: android/source

2017-03-12 Thread brainbreaker
 android/source/res/layout/file_explorer_grid_item.xml |4 
 android/source/res/layout/file_list_item.xml  |8 
 android/source/res/values/arrays.xml  |1 
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |  153 
++
 4 files changed, 41 insertions(+), 125 deletions(-)

New commits:
commit 686651c30a9697463c9910f71736abe607efb270
Author: brainbreaker 
Date:   Mon Feb 27 18:02:56 2017 +0530

Combine List Item & Grid Item Adapters of File Explorer View

 This commit will combine the code of ListItemAdapter &
  GridItemAdapter in LibreOfficeUIActivity to one
  ExplorerItemAdapter which will handle both the view
  types.

Change-Id: I45c1f5124afee82ff0b78f13609acd37be87fde1
Reviewed-on: https://gerrit.libreoffice.org/34680
Tested-by: Jenkins 
Reviewed-by: Aleksandar Stefanović 
Tested-by: Aleksandar Stefanović 

diff --git a/android/source/res/layout/file_explorer_grid_item.xml 
b/android/source/res/layout/file_explorer_grid_item.xml
index 5604fe2..e64fdc2 100644
--- a/android/source/res/layout/file_explorer_grid_item.xml
+++ b/android/source/res/layout/file_explorer_grid_item.xml
@@ -14,7 +14,7 @@
 android:orientation="vertical" >
 
 
 
 
 
 
 
 0
 1
 
-
 
 Everything
 Documents
diff --git 
a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java 
b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 40726c3..a4daa45 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -268,13 +268,8 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 
 FileUtilities.sortFiles(filePaths, sortMode);
 // refresh view
-if (viewMode == GRID_VIEW) {
-fileRecyclerView.setLayoutManager(new GridLayoutManager(this, 3));
-fileRecyclerView.setAdapter(new GridItemAdapter(this, filePaths));
-} else {
-fileRecyclerView.setLayoutManager(new LinearLayoutManager(this));
-fileRecyclerView.setAdapter(new ListItemAdapter(this, filePaths));
-}
+fileRecyclerView.setLayoutManager(isViewModeList() ? new 
LinearLayoutManager(this) : new GridLayoutManager(this, 3));
+fileRecyclerView.setAdapter(new ExplorerItemAdapter(this, filePaths));
 // close drawer if it was open
 drawerLayout.closeDrawer(navigationDrawer);
 }
@@ -328,6 +323,10 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 }
 }
 
+private boolean isViewModeList(){
+return viewMode == LIST_VIEW;
+}
+
 private void switchToDocumentProvider(IDocumentProvider provider) {
 
 new AsyncTask() {
@@ -875,15 +874,14 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 }
 }
 
-
-class ListItemAdapter extends 
RecyclerView.Adapter {
+class ExplorerItemAdapter extends 
RecyclerView.Adapter {
 
 private Activity mActivity;
 private List filePaths;
 private final long KB = 1024;
 private final long MB = 1048576;
 
-ListItemAdapter(Activity activity, List filePaths) {
+ExplorerItemAdapter(Activity activity, List filePaths) {
 this.mActivity = activity;
 this.filePaths = filePaths;
 }
@@ -891,7 +889,7 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 @Override
 public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
 View item = LayoutInflater.from(parent.getContext())
-.inflate(R.layout.file_list_item, parent, false);
+.inflate(isViewModeList() ? R.layout.file_list_item : 
R.layout.file_explorer_grid_item, parent, false);
 return new ViewHolder(item);
 }
 
@@ -917,24 +915,6 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
 });
 
 holder.filenameView.setText(file.getName());
-
-if (!file.isDirectory()) {
-String size;
-long length = filePaths.get(position).getSize();
-if (length < KB){
-size = Long.toString(length) + "B";
-} else if (length < MB){
-size = Long.toString(length/KB) + "KB";
-} else {
-size = Long.toString(length/MB) + "MB";
-}
-holder.fileSizeView.setText(size);
-}
-SimpleDateFormat df = new SimpleDateFormat("dd MMM  hh:ss");
-Date date = file.getLastModified();
-//TODO format date
-holder.fileDateView.setText(df.format(date

[Libreoffice-commits] core.git: include/vcl vcl/source

2017-03-12 Thread Stephan Bergmann
 include/vcl/toolbox.hxx   |1 -
 vcl/source/window/toolbox.cxx |1 -
 2 files changed, 2 deletions(-)

New commits:
commit 6bf42c1cf0a4597fd2ef8034d6a5a4c5e1dd2ce8
Author: Stephan Bergmann 
Date:   Sun Mar 12 11:19:38 2017 +0100

ToolBox::mnFocusPos is unused

...ever since b8f7708176f56d6093405faf6f112004db359be9 "#96972# improved 
key and
focus handling"

Change-Id: I236143997f6e90eaa8cc28e10c17ff5a647da48c

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 52c3bc5..d9583e8 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -114,7 +114,6 @@ private:
 longmnActivateCount;
 longmnImagesRotationAngle;
 sal_uInt16  mnLastFocusItemId;
-sal_uInt16  mnFocusPos;
 sal_uInt16  mnOutStyle;
 sal_uInt16  mnHighItemId;
 sal_uInt16  mnCurItemId;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index af83d66..f398969 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1361,7 +1361,6 @@ void ToolBox::ImplInitToolBoxData()
 mnCurItemId   = 0;
 mnDownItemId  = 0;
 mnCurPos  = TOOLBOX_ITEM_NOTFOUND;
-mnFocusPos= TOOLBOX_ITEM_NOTFOUND;// current position during 
keyboard access
 mnLines   = 1;
 mnCurLine = 1;
 mnCurLines= 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: libreofficekit/UnoCommands.txt

2017-03-12 Thread Tomaž Vajngerl
 libreofficekit/UnoCommands.txt |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit ddf82cd0ed2b19752a946dc482249adb7cbb8f64
Author: Tomaž Vajngerl 
Date:   Sun Mar 12 09:32:21 2017 +0100

lok: start describing UNO commands used through LOK

Change-Id: I44ce5a8a7ef939cbe48f6164284fae88a090a724

diff --git a/libreofficekit/UnoCommands.txt b/libreofficekit/UnoCommands.txt
new file mode 100644
index 000..b949c4d
--- /dev/null
+++ b/libreofficekit/UnoCommands.txt
@@ -0,0 +1,15 @@
+This document describes UNO commands that are (know to be) used with LOK.
+
+Command: ".uno:InsertGraphic"
+
+JSON parameters:
+
+{
+"FileName" :
+{
+"type" : "string",
+"value" : ""
+}
+}
+
+where  is URL encoded string, e.g. file:///home/user/file.odt
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits