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

2013-11-27 Thread Stephan Bergmann
 binaryurp/source/reader.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 289e54feabc936b8175327355a159073830a326a
Author: Stephan Bergmann 
Date:   Wed Nov 27 14:49:22 2013 +0100

binaryurp: silently ignore superfluous MUSTREPLY/SYNCHRONOUS flags

...in a non-oneway call.  This can happen when a pre LO 4 entity is calling 
a
LO 4 entity post 90eac3e69749a9227c4b6902b1f3cef1e338c6d1
"API CHANGE remove [oneway] method attributes."  (See mail thread starting 
at


"hi, code in Java.")

Change-Id: I9f800a979d84a95cc5cd96f75ee7472e8cf6cf4b

diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
index 522b165..184f037 100644
--- a/binaryurp/source/reader.cxx
+++ b/binaryurp/source/reader.cxx
@@ -238,12 +238,10 @@ void Reader::readMessage(Unmarshal & unmarshal) {
 {
 synchronous = forceSynchronous;
 } else {
-if (forceSynchronous) {
-throw css::uno::RuntimeException(
-("URP: synchronous request message with non-oneway function ID"
- " received"),
-css::uno::Reference< css::uno::XInterface >());
-}
+SAL_INFO_IF(
+forceSynchronous, "binaryurp",
+("superfluous MUSTREPLY/SYNCHRONOUS ignored in request message 
with"
+ " non-oneway function ID"));
 synchronous = true;
 }
 bool setter = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-11-27 Thread Stephan Bergmann
 binaryurp/source/reader.cxx |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 70fe99d01944e51fd2a9d5eaf007bd3ee8967832
Author: Stephan Bergmann 
Date:   Thu Nov 28 08:25:50 2013 +0100

Minor simplification

Change-Id: I031409043f12bdfe4b8c838d74db8a60576fd507

diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
index 184f037..17a8863 100644
--- a/binaryurp/source/reader.cxx
+++ b/binaryurp/source/reader.cxx
@@ -230,20 +230,16 @@ void Reader::readMessage(Unmarshal & unmarshal) {
 *static_cast< uno_Interface ** >(
 unmarshal.readValue(t).getValue(t)));
 }
-bool synchronous;
-if (memberTd.get()->eTypeClass == typelib_TypeClass_INTERFACE_METHOD &&
+bool oneWay =
+memberTd.get()->eTypeClass == typelib_TypeClass_INTERFACE_METHOD &&
 (reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
 memberTd.get())->
- bOneWay))
-{
-synchronous = forceSynchronous;
-} else {
-SAL_INFO_IF(
-forceSynchronous, "binaryurp",
-("superfluous MUSTREPLY/SYNCHRONOUS ignored in request message 
with"
- " non-oneway function ID"));
-synchronous = true;
-}
+ bOneWay);
+SAL_INFO_IF(
+!oneWay && forceSynchronous, "binaryurp",
+("superfluous MUSTREPLY/SYNCHRONOUS ignored in request message with"
+ " non-oneway function ID"));
+bool synchronous = !oneWay || forceSynchronous;
 bool setter = false;
 std::vector< BinaryAny > inArgs;
 switch (memberTd.get()->eTypeClass) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-13 Thread Julien Nabet
 binaryurp/source/lessoperators.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 059f041dfdffe0630ec573fb444c51cc463b90b1
Author: Julien Nabet 
Date:   Thu Jun 13 21:27:26 2013 +0200

cppcheck: fix duplicateExpression

Change-Id: If3b7b1faab858afa82d4c665ee1a5036190e69aa
Reviewed-on: https://gerrit.libreoffice.org/4278
Reviewed-by: Tomáš Chvátal 
Tested-by: Tomáš Chvátal 

diff --git a/binaryurp/source/lessoperators.cxx 
b/binaryurp/source/lessoperators.cxx
index 55f3a49..3a515f5 100644
--- a/binaryurp/source/lessoperators.cxx
+++ b/binaryurp/source/lessoperators.cxx
@@ -36,7 +36,7 @@ bool operator<( const TypeDescription& rLeft, const 
TypeDescription& rRight) {
assert( rLeft.is() && rRight.is());
const typelib_TypeDescription& rA = *rLeft.get();
const typelib_TypeDescription& rB = *rRight.get();
-   if( rA.eTypeClass != rA.eTypeClass)
+if( rA.eTypeClass != rB.eTypeClass)
return (rA.eTypeClass < rB.eTypeClass);
const sal_Int32 nCmp = rtl_ustr_compare_WithLength(
rA.pTypeName->buffer, rA.pTypeName->length,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-14 Thread Stephan Bergmann
 binaryurp/source/lessoperators.cxx |   18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 12dc490c3af9ec0f34b513609f3b14effd5a2906
Author: Stephan Bergmann 
Date:   Fri Jun 14 14:18:11 2013 +0200

No need for a buggy rewrite

... see 08bb8fca4144608237418d64b1479840c408256f "#i122208# replace the
binaryurp cache for improved C++ compatibility" and
059f041dfdffe0630ec573fb444c51cc463b90b1 "cppcheck: fix 
duplicateExpression,"
when the only improvement is to not needlessly acquire/release raw 
rtl_uString
instances.

Change-Id: I734304b231d69f8089cbf1d35a3deda75f771c78

diff --git a/binaryurp/source/lessoperators.cxx 
b/binaryurp/source/lessoperators.cxx
index 3a515f5..6d8952d 100644
--- a/binaryurp/source/lessoperators.cxx
+++ b/binaryurp/source/lessoperators.cxx
@@ -32,16 +32,14 @@
 
 namespace com { namespace sun { namespace star { namespace uno {
 
-bool operator<( const TypeDescription& rLeft, const TypeDescription& rRight) {
-   assert( rLeft.is() && rRight.is());
-   const typelib_TypeDescription& rA = *rLeft.get();
-   const typelib_TypeDescription& rB = *rRight.get();
-if( rA.eTypeClass != rB.eTypeClass)
-   return (rA.eTypeClass < rB.eTypeClass);
-   const sal_Int32 nCmp = rtl_ustr_compare_WithLength(
-   rA.pTypeName->buffer, rA.pTypeName->length,
-   rB.pTypeName->buffer, rB.pTypeName->length);
-   return (nCmp < 0);
+bool operator <(TypeDescription const & left, TypeDescription const & right) {
+assert(left.is() && right.is());
+typelib_TypeClass tc1 = left.get()->eTypeClass;
+typelib_TypeClass tc2 = right.get()->eTypeClass;
+return tc1 < tc2 ||
+(tc1 == tc2 &&
+ (OUString::unacquired(&left.get()->pTypeName) <
+  OUString::unacquired(&right.get()->pTypeName)));
 }
 
 bool TypeDescEqual::operator()( const TypeDescription& rLeft, const 
TypeDescription& rRight) const
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-19 Thread Stephan Bergmann
 binaryurp/source/bridgefactory.cxx |   31 +++
 binaryurp/source/bridgefactory.hxx |2 ++
 2 files changed, 33 insertions(+)

New commits:
commit 184e4ef35641403fd293262ee413ceee37b3761a
Author: Stephan Bergmann 
Date:   Mon May 19 18:06:16 2014 +0200

rhbz#1016758: Dispose bridges when disposing bridge factory

... (which happens when the service manager is disposed), so that no 
bridges can
still run during exit.  But this is so glaring that I wonder whether I 
missed
the obvious when I originally wrote that code, or whether I rather miss the
obvious now.  So better let this rest for a while on master before deciding
about any backports.

Change-Id: I7c9ad6c8a53dfd1a7b702640920dcb0a9a2c3007

diff --git a/binaryurp/source/bridgefactory.cxx 
b/binaryurp/source/bridgefactory.cxx
index 93cd22b..c397255 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -116,6 +116,11 @@ css::uno::Reference< css::bridge::XBridge > 
BridgeFactory::createBridge(
 rtl::Reference< Bridge > b;
 {
 osl::MutexGuard g(m_aMutex);
+if (rBHelper.bDisposed) {
+throw css::lang::DisposedException(
+"BridgeFactory disposed",
+static_cast< cppu::OWeakObject * >(this));
+}
 if (named_.find(sName) != named_.end()) {
 throw css::bridge::BridgeExistsException(
 sName, static_cast< cppu::OWeakObject * >(this));
@@ -173,6 +178,32 @@ BridgeFactory::getExistingBridges() throw 
(css::uno::RuntimeException, std::exce
 return s;
 }
 
+void BridgeFactory::disposing() {
+BridgeList l1;
+BridgeMap l2;
+{
+osl::MutexGuard g(m_aMutex);
+l1.swap(unnamed_);
+l2.swap(named_);
+}
+for (BridgeList::iterator i(l1.begin()); i != l1.end(); ++i) {
+try {
+css::uno::Reference(
+*i, css::uno::UNO_QUERY_THROW)->dispose();
+} catch (css::uno::Exception & e) {
+SAL_WARN("binaryurp", "ignoring Exception " << e.Message);
+}
+}
+for (BridgeMap::iterator i(l2.begin()); i != l2.end(); ++i) {
+try {
+css::uno::Reference(
+i->second, css::uno::UNO_QUERY_THROW)->dispose();
+} catch (css::uno::Exception & e) {
+SAL_WARN("binaryurp", "ignoring Exception " << e.Message);
+}
+}
+}
+
 }
 
 namespace {
diff --git a/binaryurp/source/bridgefactory.hxx 
b/binaryurp/source/bridgefactory.hxx
index cb8f9f3..8607626 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -117,6 +117,8 @@ private:
 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
 SAL_CALL getExistingBridges() throw 
(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+void SAL_CALL disposing() SAL_OVERRIDE;
+
 typedef
 std::list<
 com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-09-24 Thread Stephan Bergmann
 binaryurp/source/reader.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5045400eb3ae5622d18e9a9b1b928d4ecc78bbf2
Author: Stephan Bergmann 
Date:   Wed Sep 24 12:44:55 2014 +0200

Replace use of o3tl::heap_ptr with std::unique_ptr

Change-Id: Idbcb1be271ccda1885728ec5a6a75cfaec15f6f5

diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
index 92da485..3accf57 100644
--- a/binaryurp/source/reader.cxx
+++ b/binaryurp/source/reader.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "boost/scoped_ptr.hpp"
@@ -35,7 +36,6 @@
 #include "com/sun/star/uno/XCurrentContext.hpp"
 #include "com/sun/star/uno/XInterface.hpp"
 #include "cppu/unotype.hxx"
-#include "o3tl/heap_ptr.hxx"
 #include "rtl/byteseq.h"
 #include "rtl/ustring.hxx"
 #include "sal/types.h"
@@ -328,7 +328,7 @@ void Reader::readMessage(Unmarshal & unmarshal) {
 }
 break;
 }
-o3tl::heap_ptr< IncomingRequest > req(
+std::unique_ptr< IncomingRequest > req(
 new IncomingRequest(
 bridge_, tid, oid, obj, type, functionId, synchronous, 
memberTd,
 setter, inArgs, ccMode, cc));
@@ -441,7 +441,7 @@ void Reader::readReplyMessage(Unmarshal & unmarshal, 
sal_uInt8 flags1) {
 switch (req.kind) {
 case OutgoingRequest::KIND_NORMAL:
 {
-o3tl::heap_ptr< IncomingReply > resp(
+std::unique_ptr< IncomingReply > resp(
 new IncomingReply(exc, ret, outArgs));
 uno_threadpool_putJob(
 bridge_->getThreadPool(), tid.getHandle(), resp.get(), 0,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-09-25 Thread Stephan Bergmann
 binaryurp/source/cache.hxx |   58 ++---
 1 file changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 11311b9216b61c7c7baa1d223726520fe2ad2264
Author: Stephan Bergmann 
Date:   Thu Sep 25 11:49:23 2014 +0200

untabify

Change-Id: Iad53e9cea28c3c7f3a8a2eaa1186d1e1be72affc

diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
index a580c5e..7cbb303 100644
--- a/binaryurp/source/cache.hxx
+++ b/binaryurp/source/cache.hxx
@@ -49,35 +49,35 @@ public:
 }
 
 IdxType add( const T& rContent, bool* pbFound) {
-   assert( pbFound != NULL);
-   if( !size_) {
-   *pbFound = false;
-   return cache::ignore;
-   }
-   // try to insert into the map
-   list_.push_front( rContent); // create a temp entry
-   typedef std::pair MappedType;
-   typedef std::pair MapPair;
-   MapPair aMP = map_.insert( MappedType( list_.begin(), 0));
-   *pbFound = !aMP.second;
-
-   if( !aMP.second) { // insertion not needed => found the entry
-   list_.pop_front(); // remove the temp entry
-   list_.splice( list_.begin(), list_, aMP.first->first); // the 
found entry is moved to front
-   return aMP.first->second;
-   }
-
-   // test insertion successful => it was new so we keep it
-   IdxType n = static_cast( map_.size() - 1);
-   if( n >= size_) { // cache full => replace the LRU entry
-   // find the least recently used element in the map
-   typename LruItMap::iterator it = map_.find( --list_.end());
-   n = it->second;
-   map_.erase( it); // remove it from the map
-   list_.pop_back(); // remove from the list
-   }
-   aMP.first->second = n;
-   return n;
+assert( pbFound != NULL);
+if( !size_) {
+*pbFound = false;
+return cache::ignore;
+}
+// try to insert into the map
+list_.push_front( rContent); // create a temp entry
+typedef std::pair MappedType;
+typedef std::pair MapPair;
+MapPair aMP = map_.insert( MappedType( list_.begin(), 0));
+*pbFound = !aMP.second;
+
+if( !aMP.second) { // insertion not needed => found the entry
+list_.pop_front(); // remove the temp entry
+list_.splice( list_.begin(), list_, aMP.first->first); // the 
found entry is moved to front
+return aMP.first->second;
+}
+
+// test insertion successful => it was new so we keep it
+IdxType n = static_cast( map_.size() - 1);
+if( n >= size_) { // cache full => replace the LRU entry
+// find the least recently used element in the map
+typename LruItMap::iterator it = map_.find( --list_.end());
+n = it->second;
+map_.erase( it); // remove it from the map
+list_.pop_back(); // remove from the list
+}
+aMP.first->second = n;
+return n;
 }
 
 private:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-13 Thread Stephan Bergmann
 binaryurp/source/bridge.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit afb9d333ebf83715558fb07e9f0e64b7443a195d
Author: Stephan Bergmann 
Date:   Thu Feb 13 11:56:00 2014 +0100

cid#706247 wrong exception type

Change-Id: Idc83f827b90eedcc4345345a77efbda35e08bff0

diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index c2d604d..435df53 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -879,7 +879,7 @@ css::uno::Reference< css::uno::XInterface > 
Bridge::getInstance(
 }
 for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) {
 if (sInstanceName[i] > 0x7F) {
-throw css::io::IOException(
+throw css::uno::RuntimeException(
 ("XBridge::getInstance sInstanceName contains non-ASCII"
  " character"),
 css::uno::Reference< css::uno::XInterface >());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-13 Thread Stephan Bergmann
 binaryurp/source/bridgefactory.cxx |3 ++-
 binaryurp/source/bridgefactory.hxx |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

New commits:
commit ee585cc86d975c6ed987cc4d83101d0928f725c5
Author: Stephan Bergmann 
Date:   Thu Feb 13 12:10:21 2014 +0100

cid#983607 unexpected std::exception

Change-Id: I0de931d79548505ca7d26ffdfb560cfd5c6105a9

diff --git a/binaryurp/source/bridgefactory.cxx 
b/binaryurp/source/bridgefactory.cxx
index 34182b3..06adb3a 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 
 #include "com/sun/star/connection/XConnection.hpp"
 #include "com/sun/star/uno/Exception.hpp"
@@ -110,7 +111,7 @@ css::uno::Reference< css::bridge::XBridge > 
BridgeFactory::createBridge(
 anInstanceProvider)
 throw (
 css::bridge::BridgeExistsException, 
css::lang::IllegalArgumentException,
-css::uno::RuntimeException)
+css::uno::RuntimeException, std::exception)
 {
 rtl::Reference< Bridge > b;
 {
diff --git a/binaryurp/source/bridgefactory.hxx 
b/binaryurp/source/bridgefactory.hxx
index a949e63..79150bc 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -22,6 +22,7 @@
 
 #include "sal/config.h"
 
+#include 
 #include 
 #include 
 
@@ -102,7 +103,7 @@ private:
 throw (
 com::sun::star::bridge::BridgeExistsException,
 com::sun::star::lang::IllegalArgumentException,
-com::sun::star::uno::RuntimeException);
+com::sun::star::uno::RuntimeException, std::exception);
 
 virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
 SAL_CALL getBridge(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-02-25 Thread Alexander Wilms
 binaryurp/source/cache.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 598243b2d8e8bd3496d88affdbccee6c11566c69
Author: Alexander Wilms 
Date:   Tue Feb 25 17:43:38 2014 +0100

Remove visual noise from binaryurp

Change-Id: I863499cccfe586b570d0021e143718bd3e4e1181
Reviewed-on: https://gerrit.libreoffice.org/8236
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
index 7e5ba89..a580c5e 100644
--- a/binaryurp/source/cache.hxx
+++ b/binaryurp/source/cache.hxx
@@ -60,7 +60,7 @@ public:
typedef std::pair MapPair;
MapPair aMP = map_.insert( MappedType( list_.begin(), 0));
*pbFound = !aMP.second;
-   
+
if( !aMP.second) { // insertion not needed => found the entry
list_.pop_front(); // remove the temp entry
list_.splice( list_.begin(), list_, aMP.first->first); // the 
found entry is moved to front
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-05-27 Thread Herbert Dürr
 binaryurp/source/cache.hxx |  112 +
 binaryurp/source/lessoperators.cxx |   44 +++---
 binaryurp/source/lessoperators.hxx |4 +
 3 files changed, 79 insertions(+), 81 deletions(-)

New commits:
commit 08bb8fca4144608237418d64b1479840c408256f
Author: Herbert Dürr 
Date:   Wed May 8 17:26:08 2013 +

#i122208# replace the binaryurp cache for improved C++ compatibility

Failing to instantiatie incomplete types like the Map::iterator in
binaryurp Cache's Entry members is allowed by the C++ standard.
The rewrite makes it more compliant with other C++ compilers/STLs.
And interesting alternative would be to use boost's multi_index_container.

git-svn-id: 
http://svn.apache.org/repos/asf/openoffice/branches/rejuvenate01@1480367 
13f79535-47bb-0310-9956-ffa450edef68

diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
index 05c0069..7e5ba89 100644
--- a/binaryurp/source/cache.hxx
+++ b/binaryurp/source/cache.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "boost/noncopyable.hpp"
 #include "sal/types.h"
@@ -37,88 +38,57 @@ enum { size = 256, ignore = 0x };
 
 }
 
-template< typename T > class Cache: private boost::noncopyable {
+template< typename T > class Cache : private boost::noncopyable {
 public:
+typedef sal_uInt16 IdxType;
+
 explicit Cache(std::size_t size):
-size_(size), first_(map_.end()), last_(map_.end())
+size_(size)
 {
 assert(size < cache::ignore);
 }
 
-sal_uInt16 add(T const & content, bool * found) {
-assert(found != 0);
-typename Map::iterator i(map_.find(content));
-*found = i != map_.end();
-if (i == map_.end()) {
-typename Map::size_type n = map_.size();
-if (n < size_) {
-i =
-(map_.insert(
-typename Map::value_type(
-content,
-Entry(
-static_cast< sal_uInt16 >(n), map_.end(),
-first_.
-first;
-if (first_ == map_.end()) {
-last_ = i;
-} else {
-first_->second.prev = i;
-}
-first_ = i;
-} else if (last_ != map_.end()) {
-i =
-(map_.insert(
-typename Map::value_type(
-content,
-Entry(last_->second.index, map_.end(), first_.
-first;
-first_->second.prev = i;
-first_ = i;
-typename Map::iterator j(last_);
-last_ = last_->second.prev;
-last_->second.next = map_.end();
-map_.erase(j);
-} else {
-// Reached iff size_ == 0:
-return cache::ignore;
-}
-} else if (i != first_) {
-// Move to front (reached only if size_ > 1):
-i->second.prev->second.next = i->second.next;
-if (i->second.next == map_.end()) {
-last_ = i->second.prev;
-} else {
-i->second.next->second.prev = i->second.prev;
-}
-i->second.prev = map_.end();
-i->second.next = first_;
-first_->second.prev = i;
-first_ = i;
-}
-return i->second.index;
+IdxType add( const T& rContent, bool* pbFound) {
+   assert( pbFound != NULL);
+   if( !size_) {
+   *pbFound = false;
+   return cache::ignore;
+   }
+   // try to insert into the map
+   list_.push_front( rContent); // create a temp entry
+   typedef std::pair MappedType;
+   typedef std::pair MapPair;
+   MapPair aMP = map_.insert( MappedType( list_.begin(), 0));
+   *pbFound = !aMP.second;
+   
+   if( !aMP.second) { // insertion not needed => found the entry
+   list_.pop_front(); // remove the temp entry
+   list_.splice( list_.begin(), list_, aMP.first->first); // the 
found entry is moved to front
+   return aMP.first->second;
+   }
+
+   // test insertion successful => it was new so we keep it
+   IdxType n = static_cast( map_.size() - 1);
+   if( n >= size_) { // cache full => replace the LRU entry
+   // find the least recently used element in the map
+   typename LruItMap::iterator it = map_.find( --list_.end());
+   n = it->second;
+   map_.erase( it); // remove it from the map
+   list_.pop_back(); // remove from the list
+   }
+   aMP.first->second = n;
+   return n;
 }
 
 private:
-struct Entry;
-
-typedef std::map< T, Entry > Map;
-
-struct Entry {
-sal_uInt16 ind

[Libreoffice-commits] core.git: binaryurp/source bridges/source

2013-02-19 Thread Krisztian Pinter
 binaryurp/source/bridge.cxx   |2 +-
 bridges/source/cpp_uno/cc50_solaris_intel/except.cxx  |3 +--
 bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx |4 ++--
 bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx  |3 +--
 bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx |4 ++--
 5 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit f6edfefd53caf7e4aa6c2b39cdaf666ad54884c3
Author: Krisztian Pinter 
Date:   Mon Feb 18 15:10:30 2013 +0100

RTL_CONSTASCII_USTRINGPARAM removals

Change-Id: Ib483f271d3c826a2b7192b22a174ff9f7b18c3f8
Reviewed-on: https://gerrit.libreoffice.org/2241
Reviewed-by: Olivier Hallot 
Tested-by: Olivier Hallot 

diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index 5b463f5..31fc342 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -182,7 +182,7 @@ Bridge::Bridge(
 protPropTid_(
 reinterpret_cast< sal_Int8 const * >(".UrpProtocolPropertiesTid"),
 RTL_CONSTASCII_LENGTH(".UrpProtocolPropertiesTid")),
-protPropOid_(RTL_CONSTASCII_USTRINGPARAM("UrpProtocolProperties")),
+protPropOid_("UrpProtocolProperties"),
 protPropType_(
 cppu::UnoType<
 css::uno::Reference< css::bridge::XProtocolProperties > >::get()),
diff --git a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx 
b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
index f7c5514..36bd7a6 100644
--- a/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_intel/except.cxx
@@ -408,8 +408,7 @@ void cc50_solaris_intel_fillUnoException(
 if (pExcTypeDescr == 0) // the thing that should not be
 {
 RuntimeException aRE(
-OUString( RTL_CONSTASCII_USTRINGPARAM(
-  "exception type not found: ") ) + aName,
+"exception type not found: " + aName,
 Reference< XInterface >() );
 Type const & rType = ::getCppuType( &aRE );
 uno_type_any_constructAndConvert(
diff --git a/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx 
b/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
index 32330cc..85a5965 100644
--- a/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_intel/uno2cpp.cxx
@@ -321,7 +321,7 @@ void unoInterfaceProxyDispatch(
 aParam.bOut = sal_False;
 
 typelib_TypeDescriptionReference * pReturnTypeRef = 0;
-OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
+OUString aVoidName( "void" );
 typelib_typedescriptionreference_new(
 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
 
@@ -394,7 +394,7 @@ void unoInterfaceProxyDispatch(
 default:
 {
 ::com::sun::star::uno::RuntimeException aExc(
-OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type 
description!") ),
+"illegal member type description!",
 ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface >() );
 
 Type const & rExcType = ::getCppuType( &aExc );
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx 
b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
index 56de9c4..ebb0918 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/except.cxx
@@ -401,8 +401,7 @@ void cc50_solaris_sparc_fillUnoException(
 if (pExcTypeDescr == 0) // the thing that should not be
 {
 RuntimeException aRE(
-OUString( RTL_CONSTASCII_USTRINGPARAM(
-  "exception type not found: ") ) + aName,
+"exception type not found: " + aName,
 Reference< XInterface >() );
 Type const & rType = ::getCppuType( &aRE );
 uno_type_any_constructAndConvert(
diff --git a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx 
b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
index 20142dc..6fad40b 100644
--- a/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/cc50_solaris_sparc/uno2cpp.cxx
@@ -299,7 +299,7 @@ void unoInterfaceProxyDispatch(
 aParam.bOut = sal_False;
 
 typelib_TypeDescriptionReference * pReturnTypeRef = 0;
-OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
+OUString aVoidName( "void" );
 typelib_typedescriptionreference_new(
 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
 
@@ -372,7 +372,7 @@ void unoInterfaceProxyDispatch(
 default:
 {
 ::com::sun::star::uno::RuntimeException aExc(
-OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type 
description!") ),
+"illegal member type description!",
 ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface >() );
 
 Type const & rExcType = ::getCppuTyp

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

2014-04-16 Thread Stephan Bergmann
 binaryurp/source/incomingrequest.cxx  |9 +---
 binaryurp/source/writer.cxx   |4 -
 package/source/xstor/ocompinstream.cxx|   62 ++--
 package/source/xstor/oseekinstream.cxx|   12 ++---
 package/source/xstor/owriteablestream.cxx |   66 +++---
 vcl/unx/generic/printer/ppdparser.cxx |   18 
 6 files changed, 85 insertions(+), 86 deletions(-)

New commits:
commit c3e84d4c74847271f88e1f83369d0b55b2fd6037
Author: Stephan Bergmann 
Date:   Wed Apr 16 22:42:40 2014 +0200

sal/log.hxx functionality also includes the equivalent of OSL_LOG_PREFIX

Change-Id: I1bb0115a378003b5cc5b1cfc59c474a1f100d894

diff --git a/binaryurp/source/incomingrequest.cxx 
b/binaryurp/source/incomingrequest.cxx
index 1ac6e10..ff30a8e 100644
--- a/binaryurp/source/incomingrequest.cxx
+++ b/binaryurp/source/incomingrequest.cxx
@@ -101,16 +101,16 @@ void IncomingRequest::execute() const {
 return;
 } catch (const css::uno::RuntimeException & e) {
 OSL_TRACE(
-OSL_LOG_PREFIX "caught UNO runtime exception '%s'",
+"caught UNO runtime exception '%s'",
 (OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).
  getStr()));
 } catch (const std::exception & e) {
-OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+OSL_TRACE("caught C++ exception '%s'", e.what());
 }
 bridge_->terminate(false);
 } else {
 if (isExc) {
-OSL_TRACE(OSL_LOG_PREFIX "oneway method raised exception");
+OSL_TRACE("oneway method raised exception");
 }
 bridge_->decrementCalls();
 }
@@ -148,8 +148,7 @@ bool IncomingRequest::execute_throw(
 ifc = prov->getInstance(oid_);
 } catch (const css::container::NoSuchElementException & e) {
 OSL_TRACE(
-(OSL_LOG_PREFIX "initial element '%s':"
- " NoSuchElementException '%s'"),
+"initial element '%s': NoSuchElementException '%s'",
 OUStringToOString(oid_, 
RTL_TEXTENCODING_UTF8).getStr(),
 (OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).
  getStr()));
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index edcb0f5..46198b9 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -171,10 +171,10 @@ void Writer::execute() {
 }
 } catch (const css::uno::Exception & e) {
 OSL_TRACE(
-OSL_LOG_PREFIX "caught UNO exception '%s'",
+"caught UNO exception '%s'",
 OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
 } catch (const std::exception & e) {
-OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+OSL_TRACE("caught C++ exception '%s'", e.what());
 }
 bridge_->terminate(false);
 bridge_.clear();
diff --git a/package/source/xstor/ocompinstream.cxx 
b/package/source/xstor/ocompinstream.cxx
index 3693364..0165d0a 100644
--- a/package/source/xstor/ocompinstream.cxx
+++ b/package/source/xstor/ocompinstream.cxx
@@ -115,13 +115,13 @@ sal_Int32 SAL_CALL OInputCompStream::readBytes( 
uno::Sequence< sal_Int8 >& aData
 ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
 if ( m_bDisposed )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "Disposed!");
+SAL_INFO("package.xstor", "Disposed!");
 throw lang::DisposedException();
 }
 
 if ( !m_xStream.is() )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "No stream!");
+SAL_INFO("package.xstor", "No stream!");
 throw uno::RuntimeException();
 }
 
@@ -137,13 +137,13 @@ sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( 
uno::Sequence< sal_Int8 >& a
 ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
 if ( m_bDisposed )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "Disposed!");
+SAL_INFO("package.xstor", "Disposed!");
 throw lang::DisposedException();
 }
 
 if ( !m_xStream.is() )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "No stream!");
+SAL_INFO("package.xstor", "No stream!");
 throw uno::RuntimeException();
 }
 
@@ -160,13 +160,13 @@ void SAL_CALL OInputCompStream::skipBytes( sal_Int32 
nBytesToSkip )
 ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
 if ( m_bDisposed )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "Disposed!");
+SAL_INFO("package.xstor", "Disposed!");
 throw lang::DisposedException();
 }
 
 if ( !m_xStream.is() )
 {
-SAL_INFO("package.xstor", OSL_LOG_PREFIX "No stream!");
+SAL_INFO("package.xstor", "No stream!");
 throw uno::RuntimeException();
 }
 
@@ -182,13 +182,13 @@ sal_Int32 SAL_CALL OInputCompS