[Libreoffice-commits] .: sal/inc

2012-04-14 Thread Markus Mohrhard
 sal/inc/rtl/math.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4d804a0052fe661603bc8280bfa541a7b0a302ae
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Sun Apr 15 02:18:37 2012 +0200

fix ambiguous call on windows

diff --git a/sal/inc/rtl/math.hxx b/sal/inc/rtl/math.hxx
index 8f4991a..40eba50 100644
--- a/sal/inc/rtl/math.hxx
+++ b/sal/inc/rtl/math.hxx
@@ -274,7 +274,7 @@ inline bool approxEqual(double a, double b, sal_Int16 nPrec)
 return true;
 double x = a - b;
 return (x  0.0 ? -x : x)
- ((a  0.0 ? -a : a) * (1.0 / (pow(2, nPrec;
+ ((a  0.0 ? -a : a) * (1.0 / (pow(static_castdouble(2.0), 
nPrec;
 }
 /** Add two values.
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-04-13 Thread Tor Lillqvist
 sal/inc/osl/diagnose.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit dc4aec872426d95033610c9e6b6579387e5e6423
Author: Tor Lillqvist t...@iki.fi
Date:   Fri Apr 13 09:25:03 2012 +0300

WaE: unknown warning group '-Wreturn-type-c-linkage'

diff --git a/sal/inc/osl/diagnose.hxx b/sal/inc/osl/diagnose.hxx
index 95f5093..6463d8d 100644
--- a/sal/inc/osl/diagnose.hxx
+++ b/sal/inc/osl/diagnose.hxx
@@ -75,6 +75,9 @@ SAL_DLLPUBLIC void SAL_CALL 
osl_detail_ObjectRegistry_revokeObject(
 #if SUPD  400
 #ifdef __clang__
 #pragma clang diagnostic push
+// Guard against slightly older clang versions that don't have
+// -Wreturn-type-c-linkage...
+#pragma clang diagnostic ignored -Wunknown-pragmas
 #pragma clang diagnostic ignored -Wreturn-type-c-linkage
 #endif
 #endif
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-04-10 Thread Lubos Lunak
 sal/inc/osl/diagnose.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3082f7f06b261b951315f096afae34c6b571cc06
Author: Luboš Luňák l.lu...@suse.cz
Date:   Tue Apr 10 20:11:08 2012 +0200

make OSL_ASSERT print the failed expression, not just OSL_ASSERT

diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index 9a6112b..f094abe 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -150,7 +150,7 @@ SAL_DLLPUBLIC pfunc_osl_printDetailedDebugMessage SAL_CALL 
osl_setDetailedDebugM
 
 #if OSL_DEBUG_LEVEL  0
 #define OSL_ASSERT(c) \
-SAL_DETAIL_WARN_IF_FORMAT(!(c), legacy.osl, OSL_ASSERT)
+SAL_DETAIL_WARN_IF_FORMAT(!(c), legacy.osl, OSL_ASSERT: %s, #c)
 #define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), legacy.osl, %s, m)
 #define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, legacy.osl, %s, m)
 #else
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/qa sal/rtl

2012-04-06 Thread Lubos Lunak
 sal/inc/rtl/strbuf.hxx  |   54 +++
 sal/inc/rtl/string.h|3 
 sal/inc/rtl/string.hxx  |4 -
 sal/inc/rtl/ustrbuf.hxx |   69 
 sal/inc/rtl/ustring.h   |   15 +---
 sal/inc/rtl/ustring.hxx |   12 +--
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx  |6 +
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx |   21 +++---
 sal/rtl/source/strtmpl.cxx  |   11 ++-
 9 files changed, 162 insertions(+), 33 deletions(-)

New commits:
commit 066dbfd1970b8ea58ba16b07b2a57f61c0cb8e36
Author: Luboš Luňák l.lu...@suse.cz
Date:   Fri Apr 6 13:45:47 2012 +0200

string literal O(U)StringBuffer ctors too, after all

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 122eb4b..4500cf0 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -155,6 +155,60 @@ public:
 }
 
 /**
+@overload
+@since LibreOffice 3.6
+ */
+#ifdef HAVE_SFINAE_ANONYMOUS_BROKEN // see the OString ctors
+OStringBuffer( const char* value )
+: pData(NULL)
+{
+sal_Int32 length = rtl_str_getLength( value );
+nCapacity = length + 16;
+rtl_stringbuffer_newFromStr_WithLength( pData, value, length );
+}
+#else
+template typename T 
+OStringBuffer( const T value, typename internal::CharPtrDetector T, 
internal::Dummy ::Type = internal::Dummy())
+: pData(NULL)
+{
+sal_Int32 length = rtl_str_getLength( value );
+nCapacity = length + 16;
+rtl_stringbuffer_newFromStr_WithLength( pData, value, length );
+}
+
+template typename T 
+OStringBuffer( T value, typename internal::NonConstCharArrayDetector T, 
internal::Dummy ::Type = internal::Dummy())
+: pData(NULL)
+{
+sal_Int32 length = rtl_str_getLength( value );
+nCapacity = length + 16;
+rtl_stringbuffer_newFromStr_WithLength( pData, value, length );
+}
+
+/**
+  Constructs a string buffer so that it represents the same
+sequence of characters as the string literal.
+
+  If there are any embedded \0's in the string literal, the result is 
undefined.
+  Use the overload that explicitly accepts length.
+
+  @since LibreOffice 3.6
+
+  @paramliteral   a string literal
+*/
+template typename T 
+OStringBuffer( T literal, typename internal::ConstCharArrayDetector T, 
internal::Dummy ::Type = internal::Dummy())
+: pData(NULL)
+, nCapacity( internal::ConstCharArrayDetector T, void ::size - 1 + 
16 )
+{
+rtl_string_newFromLiteral( pData, literal, 
internal::ConstCharArrayDetector T, void ::size - 1, 16 );
+#ifdef RTL_STRING_UNITTEST
+rtl_string_unittest_const_literal = true;
+#endif
+}
+#endif // HAVE_SFINAE_ANONYMOUS_BROKEN
+
+/**
 Constructs a string buffer so that it represents the same
 sequence of characters as the string argument.
 
diff --git a/sal/inc/rtl/string.h b/sal/inc/rtl/string.h
index f695c12..f326abe 100644
--- a/sal/inc/rtl/string.h
+++ b/sal/inc/rtl/string.h
@@ -888,8 +888,9 @@ SAL_DLLPUBLIC void SAL_CALL 
rtl_string_newFromStr_WithLength( rtl_String ** newS
 
 /**
  @internal
+ @since LibreOffice 3.6
 */
-SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromLiteral( rtl_String ** newStr, 
const sal_Char * value, sal_Int32 len ) SAL_THROW_EXTERN_C();
+SAL_DLLPUBLIC void SAL_CALL rtl_string_newFromLiteral( rtl_String ** newStr, 
const sal_Char * value, sal_Int32 len, sal_Int32 allocExtra ) 
SAL_THROW_EXTERN_C();
 
 /** Assign a new value to a string.
 
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 0f6246b..9791a8c 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -206,7 +206,7 @@ public:
 OString( T literal, typename internal::ConstCharArrayDetector T, 
internal::Dummy ::Type = internal::Dummy() ) SAL_THROW(())
 {
 pData = 0;
-rtl_string_newFromLiteral( pData, literal, 
internal::ConstCharArrayDetector T, void ::size - 1 );
+rtl_string_newFromLiteral( pData, literal, 
internal::ConstCharArrayDetector T, void ::size - 1, 0 );
 #ifdef RTL_STRING_UNITTEST
 rtl_string_unittest_const_literal = true;
 #endif
@@ -285,7 +285,7 @@ public:
 typename internal::ConstCharArrayDetector T, OString ::Type operator=( 
T literal ) SAL_THROW(())
 {
 RTL_STRING_CONST_FUNCTION
-rtl_string_newFromLiteral( pData, literal, 
internal::ConstCharArrayDetector T, void ::size - 1 );
+rtl_string_newFromLiteral( pData, literal, 
internal::ConstCharArrayDetector T, void ::size - 1, 0 );
 return *this;
 }
 
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 02a507c..17deadd 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -149,6 +149,75 @@ 

[Libreoffice-commits] .: sal/inc

2012-04-06 Thread Lubos Lunak
 sal/inc/rtl/strbuf.hxx  |2 +-
 sal/inc/rtl/ustrbuf.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d91d98a53612a972de368186415aa48698e074d9
Author: Luboš Luňák l.lu...@suse.cz
Date:   Fri Apr 6 15:08:02 2012 +0200

fix gcc-4.0.1 and/or 32bit build for string literals

Plain 0 is ambiguous to convert to either long or const char*,
and just adding an overload next to sal_Int32 would be a dupe if
they actually are the same type, so just go with plain int, which
is the sensible thing to do anyway.

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 4500cf0..7711308 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -130,7 +130,7 @@ public:
 
 @param  length   the initial capacity.
  */
-explicit OStringBuffer(sal_Int32 length)
+explicit OStringBuffer(int length)
 : pData(NULL)
 , nCapacity( length )
 {
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 17deadd..a887107 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -125,7 +125,7 @@ public:
 
 @param  length   the initial capacity.
  */
-explicit OUStringBuffer(sal_Int32 length)
+explicit OUStringBuffer(int length)
 : pData(NULL)
 , nCapacity( length )
 {
@@ -155,7 +155,7 @@ public:
 : pData(NULL)
 , nCapacity( N - 1 + 16 )
 {
-rtl_uStringbuffer_newFromStr_WithLength( pData, literal, N - 1 );
+rtl_uString_newFromLiteral( pData, literal, N - 1, 16 );
 #ifdef RTL_STRING_UNITTEST
 rtl_string_unittest_const_literal = true;
 #endif
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-04-03 Thread Tor Lillqvist
 sal/inc/sal/types.h |   14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

New commits:
commit 61c5883f4cb35cbb1016b9abcf0718ca4d967f3d
Author: Tor Lillqvist t...@iki.fi
Date:   Tue Apr 3 18:22:42 2012 +0300

Simplify SAL_CONST_CAST and SAL_STATIC_CAST defns, mention they are obsolete

diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 52b008f..8d0bb7e 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -351,22 +351,12 @@ typedef struct _sal_Sequence
 #endif
 
 
-/** Wrap C++ const_cast, reinterpret_cast and static_cast expressions in
-macros to keep code portable to old compilers (since most compilers still
-lack RTTI support, dynamic_cast is not included here).
+/* Historical macros, no need to use, old use cases should be replaced
+ * by their expansions.
  */
 #ifdef __cplusplus
-#if defined SAL_W32 || defined SOLARIS || defined LINUX || defined MACOSX || \
-defined FREEBSD || defined NETBSD || defined AIX || \
-defined OPENBSD || defined DRAGONFLY
 #define SAL_CONST_CAST(type, expr) (const_cast type (expr))
-#define SAL_REINTERPRET_CAST(type, expr) (reinterpret_cast type (expr))
 #define SAL_STATIC_CAST(type, expr) (static_cast type (expr))
-#else /* SAL_W32, SOLARIS, LINUX */
-#define SAL_CONST_CAST(type, expr) ((type) (expr))
-#define SAL_REINTERPRET_CAST(type, expr) ((type) (expr))
-#define SAL_STATIC_CAST(type, expr) ((type) (expr))
-#endif /* SAL_W32, SOLARIS, LINUX */
 #endif /* __cplusplus */
 
 /** Definition of function throw clause macros.  These have been introduced
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-04-03 Thread Tor Lillqvist
 sal/inc/sal/types.h |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 9b9f70737e5133c8aa5a95fd2e49a0f9a5e091e6
Author: Tor Lillqvist tlillqv...@suse.com
Date:   Tue Apr 3 20:37:03 2012 +0300

SAL_REINTERPRET_CAST returns, for API stability (for 3rd-party extensions)

diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 8d0bb7e..288c2e7 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -356,6 +356,7 @@ typedef struct _sal_Sequence
  */
 #ifdef __cplusplus
 #define SAL_CONST_CAST(type, expr) (const_cast type (expr))
+#define SAL_REINTERPRET_CAST(type, expr) (reinterpret_cast type (expr))
 #define SAL_STATIC_CAST(type, expr) (static_cast type (expr))
 #endif /* __cplusplus */
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/rtl sal/util tools/inc

2012-04-02 Thread Michael Meeks
 sal/inc/rtl/ustrbuf.h  |   28 +
 sal/inc/rtl/ustrbuf.hxx|7 ++
 sal/rtl/source/strimp.hxx  |   18 
 sal/rtl/source/string.cxx  |5 
 sal/rtl/source/strtmpl.cxx |8 ---
 sal/rtl/source/uri.cxx |2 +
 sal/rtl/source/ustrbuf.cxx |   50 -
 sal/rtl/source/ustring.cxx |   15 -
 sal/util/sal.map   |2 +
 tools/inc/tools/string.hxx |4 ++-
 10 files changed, 89 insertions(+), 50 deletions(-)

New commits:
commit 1426d4432c59ef42f28642ec63e57517223eb32d
Author: Michael Meeks michael.me...@suse.com
Date:   Fri Mar 30 18:27:58 2012 +0100

sal: expose more stringbuffer related instrumentation points

Avoid ref/unref pair in makeStringAndClear, hook into the
stringbuffer-like 'String' class to expose it's conversion to
immutable strings, and fixup misc. missing instrumentation.

diff --git a/sal/inc/rtl/ustrbuf.h b/sal/inc/rtl/ustrbuf.h
index 0863da0..1051d0d 100644
--- a/sal/inc/rtl/ustrbuf.h
+++ b/sal/inc/rtl/ustrbuf.h
@@ -179,6 +179,34 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_remove(
sal_Int32 start,
sal_Int32 len );
 
+/**
+Returns an immutable rtl_uString object, while clearing the string buffer.
+
+This method is primarily used to allow these completed
+string allocation events to be traced.
+
+@param  ppThis  The string, on that the operation should take place
+@param  nCapacity   pointer to the capacity of the string buffer
+
+@since LibreOffice 3.6
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_makeStringAndClear(
+/*inout*/ rtl_uString ** ppThis,
+sal_Int32 *nCapacity );
+
+/**
+References and returns an immutable rtl_uString object, from a mutable
+string-buffer object.
+
+This method is primarily used to allow legacy 'String' class
+conversions to OUString to be accurately traced.
+
+@param  pThis  The string, on that the operation should take place
+
+@since LibreOffice 3.6
+ */
+SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_refReturn( rtl_uString 
*pThis );
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 99afe44..02a507c 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -181,10 +181,9 @@ public:
  */
 OUString makeStringAndClear()
 {
-OUString aRet( pData );
-rtl_uString_new(pData);
-nCapacity = 0;
-return aRet;
+return OUString(
+  rtl_uStringBuffer_makeStringAndClear( pData, nCapacity ),
+  SAL_NO_ACQUIRE );
 }
 
 /**
diff --git a/sal/rtl/source/strimp.hxx b/sal/rtl/source/strimp.hxx
index a9e5a38..82f7f41 100644
--- a/sal/rtl/source/strimp.hxx
+++ b/sal/rtl/source/strimp.hxx
@@ -54,6 +54,24 @@ sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix 
);
 
 sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
 
+// string lifetime instrumentation / diagnostics
+#if 0
+#  include rtl/ustring.hxx
+#  define RTL_LOG_STRING_NEW(s)  \
+  do { 
\
+  fprintf (stderr, +%s\n,
\
+   rtl::OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr()); 
\
+  } while (0)
+#  define RTL_LOG_STRING_DELETE(s)   \
+  do { 
\
+  fprintf (stderr, -%s\n,
\
+   rtl::OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr()); 
\
+  } while (0)
+#else
+#  define RTL_LOG_STRING_NEW(s)
+#  define RTL_LOG_STRING_DELETE(s)
+#endif
+
 #endif /* INCLUDED_RTL_SOURCE_STRIMP_HXX */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/string.cxx b/sal/rtl/source/string.cxx
index 9c5393f..42c8ae2 100644
--- a/sal/rtl/source/string.cxx
+++ b/sal/rtl/source/string.cxx
@@ -71,6 +71,11 @@ static rtl_String const aImplEmpty_rtl_String =
 #define IMPL_RTL_STRINGDATA rtl_String
 #define IMPL_RTL_EMPTYSTRINGaImplEmpty_rtl_String
 
+#undef RTL_LOG_STRING_NEW
+#define RTL_LOG_STRING_NEW(s)
+#undef RTL_LOG_STRING_DELETE
+#define RTL_LOG_STRING_DELETE(s)
+
 /* === */
 
 /* Include String/UString template code */
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
index 8e1de8b..2a33907 100644
--- a/sal/rtl/source/strtmpl.cxx
+++ b/sal/rtl/source/strtmpl.cxx
@@ -49,12 +49,6 @@ inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* pDest,
 }
 */
 
-// for instrumentation / diagnostics
-#ifndef 

[Libreoffice-commits] .: sal/inc

2012-04-02 Thread Lubos Lunak
 sal/inc/rtl/string.hxx  |3 +--
 sal/inc/rtl/ustring.hxx |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit d5c5800bffe97911497a0603567417dea15f295f
Author: Luboš Luňák l.lu...@suse.cz
Date:   Tue Apr 3 07:38:00 2012 +0200

I'm dumb, fromAscii() stops at \0.

diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index a00e186..0f6246b 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -196,8 +196,7 @@ public:
   New string from a string literal.
 
   If there are any embedded \0's in the string literal, the result is 
undefined.
-  Use the overload that explicitly accepts length or cast the literal
-  explicitly to const char*.
+  Use the overload that explicitly accepts length.
 
   @since LibreOffice 3.6
 
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 518ef3d..ee1ba7f 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -191,7 +191,7 @@ public:
   providing the encoding to use for the conversion.
 
   If there are any embedded \0's in the string literal, the result is 
undefined.
-  Use the overload that explicitly accepts length or fromAscii().
+  Use the overload that explicitly accepts length.
 
   @paramliteral the 8-bit ASCII string literal
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/qa sw/source

2012-03-29 Thread Lubos Lunak
 sal/inc/rtl/stringutils.hxx|9 +
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx |   19 ---
 sw/source/filter/ww8/rtfexport.cxx |4 ++--
 sw/source/filter/ww8/rtfexport.hxx |4 ++--
 4 files changed, 29 insertions(+), 7 deletions(-)

New commits:
commit 8aa60b51a9e48b33ba6f0cb27132c6a415de2358
Author: Luboš Luňák l.lu...@suse.cz
Date:   Thu Mar 29 11:03:47 2012 +0200

(const) char[] (i.e. size unknown) cannot be used with O(U)String

msvc can't handle the necessary template overload (and maybe it's
right, I'm not sure)

diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index 19c1bf4..3ed36a7 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -65,6 +65,12 @@ There are 2 cases:
 cast to const char*. Additionally (non-const) char[N] needs to be handled, 
but with the reference
 being const, it would also match const char[N], so another overload with a 
reference to non-const
 and NonConstCharArrayDetector are used to ensure the function is called 
only with (non-const) char[N].
+Additionally, char[] and const char[] (i.e. size unknown) are rather tricky. 
Their usage with 'T' would
+mean it would be 'char()[]', which seems to be invalid. But gcc and clang 
somehow manage when it is
+a template. while msvc complains about no conversion from char[] to char[1]. 
And the reference cannot
+be avoided, because 'const char[]' as argument type would match also 'const 
char[N]'
+So char[] and const char[] should always be used with their contents specified 
(which automatically
+turns them into char[N] or const char[N]), or char* and const char* should be 
used.
 */
 struct Dummy {};
 template typename T1, typename T2 
@@ -91,6 +97,8 @@ struct NonConstCharArrayDetector char[ N ], T 
 {
 typedef T Type;
 };
+#ifdef RTL_STRING_UNITTEST
+// never use, until all compilers handle this
 template typename T 
 struct NonConstCharArrayDetector char[], T 
 {
@@ -101,6 +109,7 @@ struct NonConstCharArrayDetector const char[], T 
 {
 typedef T Type;
 };
+#endif
 
 template typename T1, typename T2 
 struct ConstCharArrayDetector
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx 
b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index 0d5036a..d7e3cf5 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -66,6 +66,9 @@ private:
 
 void testcall( const char str[] );
 
+static const char bad5[];
+static char bad6[];
+
 CPPUNIT_TEST_SUITE(StringLiterals);
 CPPUNIT_TEST(checkCtors);
 CPPUNIT_TEST(checkUsage);
@@ -100,13 +103,20 @@ void test::ostring::StringLiterals::checkCtors()
 const char* bad4[] = { test1 };
 CPPUNIT_ASSERT( !CONST_CTOR_USED( bad4[ 0 ] ));
 testcall( good1 );
+#ifndef _MSC_VER
+// this is actually not supposed to work (see discussion in 
stringutils.hxx),
+// but gcc and clang somehow manage, so keep it used, just in case some 
other problem
+// shows up somewhen in the future
+CPPUNIT_ASSERT( !CONST_CTOR_USED( bad5 )); // size is not known here
+CPPUNIT_ASSERT( !CONST_CTOR_USED( bad6 ));
+#endif
 
 // This one is technically broken, since the first element is 6 characters 
test\0\0,
 // but there does not appear a way to detect this by compile time (runtime 
will complain).
 // RTL_CONSTASCII_USTRINGPARAM() has the same flaw.
-const char bad5[][ 6 ] = { test, test2 };
-CPPUNIT_ASSERT( CONST_CTOR_USED( bad5[ 0 ] ));
-CPPUNIT_ASSERT( CONST_CTOR_USED( bad5[ 1 ] ));
+const char bad7[][ 6 ] = { test, test2 };
+CPPUNIT_ASSERT( CONST_CTOR_USED( bad7[ 0 ] ));
+CPPUNIT_ASSERT( CONST_CTOR_USED( bad7[ 1 ] ));
 
 // Check that contents are correct and equal to the case when const char* ctor 
is used.
 CPPUNIT_ASSERT( rtl::OString( (const char*) ) == rtl::OString(  ));
@@ -128,6 +138,9 @@ void test::ostring::StringLiterals::checkCtors()
 #endif
 }
 
+const char test::ostring::StringLiterals::bad5[] = test;
+char test::ostring::StringLiterals::bad6[] = test;
+
 void test::ostring::StringLiterals::testcall( const char str[] )
 {
 #ifndef _MSC_VER
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index dda8b81..00b8e18 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -79,10 +79,10 @@ using rtl::OUStringBuffer;
 
 using sw::mark::IMark;
 
-#if defined(UNX)
+#if defined(UNX22)
 const sal_Char RtfExport::sNewLine = '\012';
 #else
-const sal_Char RtfExport::sNewLine[] = \015\012;
+const sal_Char* const RtfExport::sNewLine = \015\012;
 #endif
 
 // the default text encoding for the export, if it doesn't fit unicode will
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index 3759f31..9d395de 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ 

[Libreoffice-commits] .: sal/inc sal/qa

2012-03-28 Thread Lubos Lunak
 sal/inc/rtl/string.hxx |7 +++
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx |2 ++
 2 files changed, 9 insertions(+)

New commits:
commit 86a1e6de4fc3af897271bc5f7f04506261d4f286
Author: Luboš Luňák l.lu...@suse.cz
Date:   Wed Mar 28 17:37:19 2012 +0200

SFINAE workarounds for gcc-4.0.1

diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 39414e6..68f41bd 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -551,6 +551,12 @@ public:
   @return   sal_True if the strings are equal;
 sal_False, otherwise.
 */
+#ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
+sal_Bool equalsIgnoreAsciiCase( const sal_Char * asciiStr ) const 
SAL_THROW(())
+{
+return rtl_str_compareIgnoreAsciiCase( pData-buffer, asciiStr ) == 0;
+}
+#else
 template typename T 
 typename internal::CharPtrDetector T, bool ::Type equalsIgnoreAsciiCase( 
const T asciiStr ) const SAL_THROW(())
 {
@@ -577,6 +583,7 @@ public:
 return rtl_str_compareIgnoreAsciiCase_WithLength( pData-buffer, 
pData-length,
   literal, 
internal::ConstCharArrayDetector T, void ::size - 1 ) == 0;
 }
+#endif
 
 /**
   Perform a ASCII lowercase comparison of two strings.
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx 
b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index 4af152c..930b038 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -152,9 +152,11 @@ void test::ostring::StringLiterals::checkUsage()
 rtl_string_unittest_const_literal_function = false;
 CPPUNIT_ASSERT_EQUAL( foo, rtl::OString() = foo );
 CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
+#ifndef HAVE_SFINAE_ANONYMOUS_BROKEN
 rtl_string_unittest_const_literal_function = false;
 CPPUNIT_ASSERT( FoO.equalsIgnoreAsciiCase( fOo ));
 CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
+#endif
 rtl_string_unittest_const_literal_function = false;
 CPPUNIT_ASSERT( foobarfoo.match( bar, 3 ));
 CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/qa

2012-03-28 Thread Lubos Lunak
 sal/inc/rtl/strbuf.hxx |   14 ++
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx |4 
 2 files changed, 18 insertions(+)

New commits:
commit c9167bac18e1cca061d91f65d2dc91b9d09ef587
Author: Luboš Luňák l.lu...@suse.cz
Date:   Wed Mar 28 23:38:58 2012 +0200

gcc-4.0.1 SFINAE workarounds

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 54428d3..122eb4b 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -373,6 +373,12 @@ public:
 @param   str   the characters to be appended.
 @return  this string buffer.
  */
+#ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
+OStringBuffer  append( const sal_Char * str )
+{
+return append( str, rtl_str_getLength( str ) );
+}
+#else
 template typename T 
 typename internal::CharPtrDetector T, OStringBuffer ::Type append( 
const T str )
 {
@@ -397,6 +403,7 @@ public:
 rtl_stringbuffer_insert( pData, nCapacity, getLength(), literal, 
internal::ConstCharArrayDetector T, void ::size - 1 );
 return *this;
 }
+#endif
 
 /**
 Appends the string representation of the codechar/code array
@@ -555,6 +562,12 @@ public:
 @param  str  a character array.
 @return this string buffer.
  */
+#ifdef HAVE_SFINAE_ANONYMOUS_BROKEN
+OStringBuffer  insert( sal_Int32 offset, const sal_Char * str )
+{
+return insert( offset, str, rtl_str_getLength( str ) );
+}
+#else
 template typename T 
 typename internal::CharPtrDetector T, OStringBuffer ::Type insert( 
sal_Int32 offset, const T str )
 {
@@ -579,6 +592,7 @@ public:
 rtl_stringbuffer_insert( pData, nCapacity, offset, literal, 
internal::ConstCharArrayDetector T, void ::size - 1 );
 return *this;
 }
+#endif
 
 /**
 Inserts the string representation of the codechar/code array
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx 
b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index 3f2ed84..494c1da 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -257,6 +257,7 @@ void test::ostring::StringLiterals::checkNonConstUsage()
 void test::ostring::StringLiterals::checkBuffer()
 {
 rtl::OStringBuffer buf;
+#ifndef HAVE_SFINAE_ANONYMOUS_BROKEN
 rtl_string_unittest_const_literal_function = false;
 buf.append( foo );
 CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
@@ -269,6 +270,9 @@ void test::ostring::StringLiterals::checkBuffer()
 buf.insert( 3, baz );
 CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
 CPPUNIT_ASSERT_EQUAL( buf.toString(), rtl::OString( foobazbar ));
+#else
+buf.append( foobazbar );
+#endif
 
 rtl::OString foobazbard( foobazbard );
 rtl::OString foodbazbard( foodbazbard );
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-03-28 Thread Lubos Lunak
 sal/inc/rtl/stringutils.hxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 552ba413bc95b1a14638558d9436141825100c52
Author: Luboš Luňák l.lu...@suse.cz
Date:   Thu Mar 29 00:47:41 2012 +0200

fix SFINAE detection of const char[N] for msvc

diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index 55326ce..3bf72c5 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -114,6 +114,8 @@ struct ExceptConstCharArrayDetector const char[ N ] 
 };
 // this one is used to rule out only const char[N]
 // (const will be brought in by 'const T' in the function call)
+// msvc needs const char[N] here (not sure whether gcc or msvc
+// are right, it doesn't matter).
 template typename T 
 struct ExceptCharArrayDetector
 {
@@ -123,6 +125,10 @@ template int N 
 struct ExceptCharArrayDetector char[ N ] 
 {
 };
+template int N 
+struct ExceptCharArrayDetector const char[ N ] 
+{
+};
 
 } /* Namespace */
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-03-28 Thread Lubos Lunak
 sal/inc/rtl/stringutils.hxx |   13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit dbf238ba0a76c64643a28fc3fd9d0d3ede848dd7
Author: Luboš Luňák l.lu...@suse.cz
Date:   Thu Mar 29 07:39:03 2012 +0200

(const) char[] is a plain C string type too

and it's size is not known, so it cannot be taken as a string literal

diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx
index 3bf72c5..19c1bf4 100644
--- a/sal/inc/rtl/stringutils.hxx
+++ b/sal/inc/rtl/stringutils.hxx
@@ -50,7 +50,8 @@ namespace internal
 {
 /*
 These templates use SFINAE (Substitution failure is not an error) to help 
distinguish the various
-plain C string types: char*, const char*, char[N] and const char[N]. There are 
2 cases:
+plain C string types: char*, const char*, char[N], const char[N], char[] and 
const char[].
+There are 2 cases:
 1) Only string literal (i.e. const char[N]) is wanted, not any of the others.
 In this case it is necessary to distinguish between const char[N] and 
char[N], as the latter
 would be automatically converted to the const variant, which is not wanted 
(not a string literal
@@ -90,6 +91,16 @@ struct NonConstCharArrayDetector char[ N ], T 
 {
 typedef T Type;
 };
+template typename T 
+struct NonConstCharArrayDetector char[], T 
+{
+typedef T Type;
+};
+template typename T 
+struct NonConstCharArrayDetector const char[], T 
+{
+typedef T Type;
+};
 
 template typename T1, typename T2 
 struct ConstCharArrayDetector
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-03-12 Thread Josh Heidenreich
 sal/inc/osl/file.hxx |   16 
 1 file changed, 16 deletions(-)

New commits:
commit bde32dc95d33943e301bd165955655eb02e1e223
Author: Josh Heidenreich josh.sickm...@gmail.com
Date:   Tue Mar 13 16:02:18 2012 +1030

Removed FileStatus::isFile. Use ::isRegular instead.

See:
https://bugs.freedesktop.org/show_bug.cgi?id=44982#c6
https://bugs.freedesktop.org/show_bug.cgi?id=44982#c7

for why.

diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index 2cc43d0..16f7a06 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -733,22 +733,6 @@ public:
 return static_cast Type (_aStatus.eType);
 }
 
-/** Is it a file?
-This method returns True for both regular files, and links.
-
-@return
-True if it's a file, False otherwise.
-
-@see getFileType
-@see isRegular
-@see isLink
-@since LibreOffice 3.6
-*/
-inline sal_Bool isFile() const
-{
-return ( getFileType() == Regular || getFileType() == Link );
-}
-
 /** Is it a directory?
 This method returns True for both directories, and volumes.
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-03-09 Thread Stephan Bergmann
 sal/inc/osl/file.hxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8840765e2927d036b6c8b4481eabbd4f4fb460a9
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Mar 9 09:23:08 2012 +0100

Fixed @since tags

diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index 0ad8922..ee3ac1f 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -739,7 +739,7 @@ public:
 @see getFileType
 @see isRegular
 @see isLink
-@since 3.6
+@since LibreOffice 3.6
 */
 inline sal_Bool isFile() const
 {
@@ -753,7 +753,7 @@ public:
 True if it's a directory, False otherwise.
 
 @see getFileType
-@since 3.6
+@since LibreOffice 3.6
 */
 inline sal_Bool isDirectory() const
 {
@@ -768,7 +768,7 @@ public:
 @see getFileType
 @see isFile
 @see isLink
-@since 3.6
+@since LibreOffice 3.6
 */
 inline sal_Bool isRegular() const
 {
@@ -781,7 +781,7 @@ public:
 True if it's a link, False otherwise.
 
 @see getFileType
-@since 3.6
+@since LibreOffice 3.6
 */
 inline sal_Bool isLink() const
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc tools/source

2012-03-09 Thread Stephan Bergmann
 sal/inc/osl/file.hxx|   47 ++--
 tools/source/stream/strmunx.cxx |4 +--
 2 files changed, 29 insertions(+), 22 deletions(-)

New commits:
commit 608fe962cc649ad62c489811d3a8666e0e06e5e7
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Mar 9 11:52:09 2012 +0100

Let osl::FileStatus getters assert programming errors

...instead of arbitrarily returning certain values when the requested
information is not available.

This reveals a problem in strmunx.cxx that is apparently a regression 
introduced
with 4a086fca7b0a77c20bc9f1c97507966e2861f3da fix SvStream to not require a
custom open or lstat method.

diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index ee3ac1f..2cc43d0 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -29,14 +29,16 @@
 #ifndef _OSL_FILE_HXX_
 #define _OSL_FILE_HXX_
 
-#ifdef __cplusplus
+#include sal/config.h
+
+#include cassert
 
 #include osl/time.h
-#   include rtl/memory.h
-#   include rtl/ustring.hxx
+#include rtl/memory.h
+#include rtl/ustring.hxx
 
 #include osl/file.h
-#   include rtl/byteseq.hxx
+#include rtl/byteseq.hxx
 
 #include stdio.h
 
@@ -723,11 +725,12 @@ public:
 /** Get the file type.
 
 @return
-The file type if this information is valid, Unknown otherwise.
+The file type.
 */
 inline Type getFileType() const
 {
-return (_aStatus.uValidFields  osl_FileStatus_Mask_Type) ?  (Type) 
_aStatus.eType : Unknown;
+assert(isValid(osl_FileStatus_Mask_Type));
+return static_cast Type (_aStatus.eType);
 }
 
 /** Is it a file?
@@ -796,88 +799,93 @@ public:
 
 inline sal_uInt64 getAttributes() const
 {
+assert(isValid(osl_FileStatus_Mask_Attributes));
 return _aStatus.uAttributes;
 }
 
 /** Get the creation time of this file.
 
 @return
-The creation time if this information is valid,
-an uninitialized TimeValue otherwise.
+The creation time.
 */
 
 inline TimeValue getCreationTime() const
 {
+assert(isValid(osl_FileStatus_Mask_CreationTime));
 return _aStatus.aCreationTime;
 }
 
 /** Get the file access time.
 
 @return
-The last access time if this information is valid,
-an uninitialized TimeValue otherwise.
+The last access time.
 */
 
 inline TimeValue getAccessTime() const
 {
+assert(isValid(osl_FileStatus_Mask_AccessTime));
 return _aStatus.aAccessTime;
 }
 
 /** Get the file modification time.
 
 @return
-The last modified time if this information is valid,
-an uninitialized TimeValue otherwise.
+The last modified time.
 */
 
 inline TimeValue getModifyTime() const
 {
+assert(isValid(osl_FileStatus_Mask_ModifyTime));
 return _aStatus.aModifyTime;
 }
 
 /** Get the size of the file.
 
 @return
-The actual file size if this information is valid, 0 otherwise.
+The actual file size.
 */
 
 inline sal_uInt64 getFileSize() const
 {
+assert(isValid(osl_FileStatus_Mask_FileSize));
 return _aStatus.uFileSize;
 }
 
 /** Get the file name.
 
 @return
-The file name if this information is valid, an empty string otherwise.
+The file name.
 */
 
 inline ::rtl::OUString getFileName() const
 {
-return _aStatus.ustrFileName ? ::rtl::OUString(_aStatus.ustrFileName) 
: ::rtl::OUString();
+assert(isValid(osl_FileStatus_Mask_FileName));
+return rtl::OUString(_aStatus.ustrFileName);
 }
 
 
 /** Get the URL of the file.
 
 @return
-The full qualified URL of the file if this information is valid, an 
empty string otherwise.
+The full qualified URL of the file.
 */
 
 inline ::rtl::OUString getFileURL() const
 {
-return _aStatus.ustrFileURL ? ::rtl::OUString(_aStatus.ustrFileURL) : 
::rtl::OUString();
+assert(isValid(osl_FileStatus_Mask_FileURL));
+return rtl::OUString(_aStatus.ustrFileURL);
 }
 
 /** Get the link target URL.
 
 @return
-The link target URL if this information is valid, an empty string 
otherwise.
+The link target URL.
 */
 
 inline ::rtl::OUString getLinkTargetURL() const
 {
-return _aStatus.ustrLinkTargetURL ? 
::rtl::OUString(_aStatus.ustrLinkTargetURL) : ::rtl::OUString();
+assert(isValid(osl_FileStatus_Mask_LinkTargetURL));
+return rtl::OUString(_aStatus.ustrLinkTargetURL);
 }
 
 friend class DirectoryItem;
@@ -1947,7 +1955,6 @@ public:
 
 } /* namespace osl */
 
-#endif  /* __cplusplus */
 #endif  /* _OSL_FILE_HXX_ */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index cb55ddc..2317120 100644
--- 

[Libreoffice-commits] .: sal/inc

2012-02-16 Thread Stephan Bergmann
 sal/inc/sal/types.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e2de115700e7c6c5ee9118c17c06eda0c462f394
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Feb 16 13:10:58 2012 +0100

-Wundef

diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 1bed00c..e8b5662 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -93,7 +93,7 @@ typedef unsigned char   sal_uInt8;
  #error Could not find 32-bit type, add support for your architecture
 #endif
 
-#if (_MSC_VER = 1000)
+#if defined _MSC_VER  _MSC_VER = 1000
 typedef __int64  sal_Int64;
 typedef unsigned __int64 sal_uInt64;
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-02-14 Thread Stephan Bergmann
 sal/inc/rtl/instance.hxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3073b539d28a4ea29347e8060e19dda080c5d13b
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Feb 14 12:32:54 2012 +0100

Make code exploiting -fthreadsafe-statics properly conditional

Looks like 979e2c8f8b9325a5c75bfc1f388aa8f69b988d2c missed these.

diff --git a/sal/inc/rtl/instance.hxx b/sal/inc/rtl/instance.hxx
index 943a449..9520dac 100644
--- a/sal/inc/rtl/instance.hxx
+++ b/sal/inc/rtl/instance.hxx
@@ -446,7 +446,7 @@ private:
   using the outer class
   (the one that derives from this base class)
 */
-#if (__GNUC__ = 4)
+#if defined HAVE_THREADSAFE_STATICS
 templatetypename T, typename Data, typename Unique
 class StaticWithArg {
 public:
@@ -528,7 +528,7 @@ private:
 @tparam InitAggregate
   initializer functor class
 */
-#if (__GNUC__ = 4)
+#if defined HAVE_THREADSAFE_STATICS
 templatetypename T, typename InitAggregate
 class StaticAggregate {
 public:
@@ -593,7 +593,7 @@ public:
   Initializer functor's return type.
   Default is T (common practice).
 */
-#if (__GNUC__ = 4)
+#if defined HAVE_THREADSAFE_STATICS
 templatetypename T, typename InitData,
  typename Unique = InitData, typename Data = T
 class StaticWithInit {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-02-10 Thread Lubos Lunak
 sal/inc/osl/module.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 31e236c5efa01ac5c681a2f18774fe66a9e1249e
Author: Luboš Luňák l.lu...@suse.cz
Date:   Fri Feb 10 13:33:22 2012 +0100

consistent constness for getFunctionSymbol() overloads

This is an inline function, so there should be no problems with binary
compatibility.

diff --git a/sal/inc/osl/module.hxx b/sal/inc/osl/module.hxx
index c8d39a2..0d7bca6 100644
--- a/sal/inc/osl/module.hxx
+++ b/sal/inc/osl/module.hxx
@@ -147,7 +147,7 @@ public:
 
 @see getSymbol
 */
-oslGenericFunction SAL_CALL getFunctionSymbol( const ::rtl::OUString 
ustrFunctionSymbolName )
+oslGenericFunction SAL_CALL getFunctionSymbol( const ::rtl::OUString 
ustrFunctionSymbolName ) const
 {
 return ( osl_getFunctionSymbol( m_Module, ustrFunctionSymbolName.pData 
) );
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/osl sal/qa sal/util

2012-02-05 Thread François Tigeot
 sal/inc/osl/file.h|   43 
 sal/inc/osl/file.hxx  |   28 -
 sal/osl/unx/file_volume.cxx   |   80 --
 sal/osl/w32/file_dirvol.cxx   |   18 
 sal/qa/helper/gcov/deprecated.txt |2 
 sal/util/sal.map  |2 
 6 files changed, 173 deletions(-)

New commits:
commit 32009128e4c77cfd6506ab50a5345776de8144e6
Author: François Tigeot ftig...@wolfpond.org
Date:   Sun Feb 5 18:33:57 2012 +0100

Remove unused VolumeDevice functions and related code

diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index 3bcd877..2c2713b 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -467,47 +467,6 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileStatus(
 
 typedef void *oslVolumeDeviceHandle;
 
-
-/** Unmount a volume device.
-
-Unmount the volume specified by the given oslVolumeDeviceHandle.
-
-@param Handle [in]
-An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
-
-@return
-osl_File_E_None on successbr
-
-@todo
-specify all error codes that may be returned
-
-@see osl_getVolumeInformation()
-*/
-
-SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmountVolumeDevice(
-oslVolumeDeviceHandle Handle );
-
-
-/** Automount a volume device.
-
-Automount the volume device specified by the given oslVolumeDeviceHandle.
-
-@param Handle [in]
-An oslVolumeDeviceHandle received by a call to osl_getVolumeInformation().
-
-@return
-osl_File_E_None on successbr
-
-@todo
-specify all error codes that may be returned
-
-@see osl_getVolumeInformation()
-*/
-
-SAL_DLLPUBLIC oslFileError SAL_CALL osl_automountVolumeDevice(
-oslVolumeDeviceHandle Handle );
-
-
 /** Release a volume device handle.
 
 Releases the given oslVolumeDeviceHandle which was acquired by a call to
@@ -575,8 +534,6 @@ SAL_DLLPUBLIC oslFileError SAL_CALL 
osl_acquireVolumeDeviceHandle(
 osl_File_E_EOVERFLOW value too large for defined data typebr
 
 @seeosl_getVolumeInformation()
-@seeosl_automountVolumeDevice()
-@seeosl_unmountVolumeDevice()
 */
 
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getVolumeDeviceMountPath(
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index d63126b..8c97750 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -388,34 +388,6 @@ public:
 return *this;
 }
 
-/** Automount a volume device.
-
-@return
-E_None on success
-
-@todo
-specify all error codes that may be returned
-*/
-
-inline RC automount()
-{
-return (RC)osl_automountVolumeDevice( _aHandle );
-}
-
-/** Unmount a volume device.
-
-@return
-E_None on success
-
-@todo
-specify all error codes that may be returned
-*/
-
-inline RC unmount()
-{
-return (RC)osl_unmountVolumeDevice( _aHandle );
-}
-
 /** Get the full qualified URL where a device is mounted to.
 
@return
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index ce9f832..42965a7 100644
--- a/sal/osl/unx/file_volume.cxx
+++ b/sal/osl/unx/file_volume.cxx
@@ -59,14 +59,12 @@
 #include sys/mnttab.h
 #include sys/statvfs.h
 #define  HAVE_STATFS_H
-static const sal_Char* MOUNTTAB=/etc/mnttab;
 
 #elif defined(LINUX)
 
 #include mntent.h
 #include sys/vfs.h
 #define  HAVE_STATFS_H
-static const sal_Char* MOUNTTAB=/etc/mtab;
 
 #elif defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) || 
defined(DRAGONFLY)
 
@@ -75,16 +73,11 @@ static const sal_Char* MOUNTTAB=/etc/mtab;
 #include sys/mount.h
 #define  HAVE_STATFS_H
 
-/* No mounting table on *BSD
- * This information is stored only in the kernel. */
-/* static const sal_Char* MOUNTTAB=/etc/mtab; */
-
 #elif defined(MACOSX)
 
 #include sys/param.h
 #include sys/mount.h
 #define HAVE_STATFS_H
-// static const sal_Char* MOUNTTAB=/etc/mtab;
 
 #endif /* HAVE_STATFS_H */
 
@@ -360,42 +353,6 @@ static oslFileError osl_psz_getVolumeInformation (
  *
  */
 
-
-/*
- * osl_unmountVolumeDevice
- /
-
-oslFileError osl_unmountVolumeDevice( oslVolumeDeviceHandle Handle )
-{
-oslFileError tErr = osl_File_E_NOSYS;
-
- /* Perhaps current working directory is set to mount point */
-
- if ( tErr )
-{
-sal_Char *pszHomeDir = getenv(HOME);
-
-if ( pszHomeDir  strlen( pszHomeDir )  0 == chdir( pszHomeDir ) )
-{
-/* try again */
-OSL_ENSURE( tErr, osl_unmountVolumeDevice: CWD was set to volume 
mount point );
-}
-}
-
-return tErr;
-}
-
-/*
- * osl_automountVolumeDevice
- /
-
-oslFileError osl_automountVolumeDevice( oslVolumeDeviceHandle Handle )

[Libreoffice-commits] .: sal/inc

2012-01-30 Thread Miklos Vajna
 sal/inc/sal/log-areas.dox |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f7aac5d4a5f7da91aae2eef906140df4a522e07f
Author: Miklos Vajna vmik...@frugalware.org
Date:   Mon Jan 30 14:21:10 2012 +0100

sal: add sw.rtf log area

diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index 5c10567..42a96ae 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -21,6 +21,7 @@ certain functionality.
 
 @li sw.uno - Writer's UNO interfaces
 @li sw.ww8 - .doc/.docx export filter, .doc import filter (not writerfilter)
+@li sw.rtf - .rtf export filter
 
 @section StarMath
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-01-30 Thread David Tardon
 sal/inc/sal/log-areas.dox |4 
 1 file changed, 4 insertions(+)

New commits:
commit bfd9753b92c225d7cc2b2d3172b26eb53a8e9228
Author: David Tardon dtar...@redhat.com
Date:   Tue Jan 31 07:18:49 2012 +0100

add vcl log area

diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index 42a96ae..d0cbaee 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -17,6 +17,10 @@ certain functionality.
 
 @li oox.xmlstream - XmlStream class
 
+@section VCL
+
+@li vcl.gtk - Gtk+ 2/3 plugin
+
 @section Writer
 
 @li sw.uno - Writer's UNO interfaces
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/osl sal/util tools/inc tools/source

2012-01-19 Thread Michael Meeks
 sal/inc/osl/detail/file.h   |   12 --
 sal/inc/osl/file.h  |1 
 sal/osl/unx/file.cxx|2 -
 sal/osl/unx/file_stat.cxx   |   12 --
 sal/util/sal.map|2 -
 tools/inc/tools/stream.hxx  |4 +-
 tools/source/stream/strmunx.cxx |   71 +++-
 7 files changed, 38 insertions(+), 66 deletions(-)

New commits:
commit 4a086fca7b0a77c20bc9f1c97507966e2861f3da
Author: Michael Meeks michael.me...@suse.com
Date:   Thu Jan 19 12:23:23 2012 +

fix SvStream to not require a custom open or lstat method.

diff --git a/sal/inc/osl/detail/file.h b/sal/inc/osl/detail/file.h
index 108d230..065c355 100644
--- a/sal/inc/osl/detail/file.h
+++ b/sal/inc/osl/detail/file.h
@@ -49,25 +49,13 @@ extern C {
 #define osl_File_OpenFlag_Trunc 0x0010L
 #define osl_File_OpenFlag_NoExcl0x0020L
 
-/* Variant of osl_openFile that takes the file pathname directly as a
-   char*
-*/
-
-SAL_DLLPUBLIC oslFileError SAL_CALL osl_openFilePath(
-const char *cpFilePath,
-oslFileHandle *pHandle,
-sal_uInt32 uFlags );
-
 /* Compare directory items for being the same underlying file
  * this unwinds unix hard-links and symlinks etc.
  */
 
 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(oslDirectory a, 
oslDirectory b);
 
-SAL_DLLPUBLIC oslFileError SAL_CALL osl_lstatFilePath( const char *cpFilePath, 
struct stat *statb );
-
 /*  Get the OS specific handle of an open file. */
-
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileOSHandle(
 oslFileHandle Handle,
 sal_IntPtr *piFileHandle );
diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index 2a8cf37..0e0d765 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -664,6 +664,7 @@ typedef void *oslFileHandle;
 #define osl_File_OpenFlag_Write 0x0002L
 #define osl_File_OpenFlag_Create0x0004L
 #define osl_File_OpenFlag_NoLock0x0008L
+/* larger bit-fields reserved for internal use cf. detail/file.h */
 
 /** Open a regular file.
 
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 64ce977..7bb6bae 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -892,7 +892,7 @@ SAL_CALL osl_openMemoryAsFile( void *address, size_t size, 
oslFileHandle *pHandl
 #define OPEN_CREATE_FLAGS ( O_CREAT | O_RDWR )
 #endif
 
-oslFileError
+static oslFileError
 SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, 
sal_uInt32 uFlags )
 {
 oslFileError eRet;
diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx
index 0477a52..320744f 100644
--- a/sal/osl/unx/file_stat.cxx
+++ b/sal/osl/unx/file_stat.cxx
@@ -462,7 +462,6 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, 
oslDirectoryItem b)
 return sal_True;
 
 fprintf (stderr, We have to do an inode compare !\n);
-
 /*
 int rc = stat_c( cpFilePath, statb );
 
@@ -475,15 +474,4 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, 
oslDirectoryItem b)
 return sal_False;
 }
 
-oslFileError
-SAL_CALL osl_lstatFilePath( const char *cpFilePath, struct stat *statb )
-{
-int rc = lstat_c( cpFilePath, statb );
-
-if (rc == -1)
-return oslTranslateFileError(OSL_FET_ERROR, errno);
-else
-return osl_File_E_None;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 26c30fc..02610f5 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -647,9 +647,7 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
 
 PRIVATE_file.1 { # LibreOffice 3.6
 global:
-osl_openFilePath;
 osl_identicalDirectoryItem;
-osl_lstatFilePath;
 osl_getFileOSHandle;
 };
 
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index 37b7c3f..8c7fa0c 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -576,10 +576,10 @@ class TOOLS_DLLPUBLIC SvFileStream : public SvStream
 friend class FileCopier;
 
 private:
-StreamData* pInstanceData;
+StreamData* pInstanceData;
 String  aFilename;
 sal_uInt16  nLockCounter;
-sal_BoolbIsOpen;
+sal_BoolbIsOpen;
 sal_uInt32  GetFileHandle() const;
 
 // Forbidden and not implemented.
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 0fcddbd..d2135fa 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -223,7 +223,7 @@ class StreamData
 public:
 oslFileHandle rHandle;
 
-StreamData() { }
+StreamData() : rHandle( 0 ) { }
 };
 
 // ---
@@ -683,8 +683,6 @@ void SvFileStream::Open( const String rFilename, 
StreamMode nOpenMode )
 {
 sal_uInt32 uFlags;
 oslFileHandle nHandleTmp;
-struct stat buf;
-sal_Bool bStatValid = sal_False;
 
 Close();
 errno = 0;
@@ -707,16 +705,22 @@ void SvFileStream::Open( const 

[Libreoffice-commits] .: sal/inc sal/util tools/source

2012-01-19 Thread Michael Meeks
 sal/inc/osl/file.h  |   24 
 sal/inc/osl/file.hxx|   26 +-
 sal/util/sal.map|2 +-
 tools/source/stream/strmunx.cxx |2 +-
 4 files changed, 51 insertions(+), 3 deletions(-)

New commits:
commit 13a752cdbb9e2c1e2c0f922158f03fc70c12245c
Author: Michael Meeks michael.me...@suse.com
Date:   Thu Jan 19 14:01:33 2012 +

sal: expose a public API for comparing directory items

Windows impl. still pending.

diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index 0e0d765..3bcd877 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -316,6 +316,30 @@ SAL_DLLPUBLIC oslFileError SAL_CALL 
osl_acquireDirectoryItem(
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_releaseDirectoryItem(
 oslDirectoryItem Item );
 
+/** Determine if two directory items point the the same underlying file
+
+The comparison is done first by URL, and then by resolving links to
+find the target, and finally by comparing inodes on unix.
+
+@param  pItemA [in]
+A directory handle to compare with another handle
+
+@param  pItemB [in]
+A directory handle to compare with pItemA
+
+@return
+sal_True: if the items point to an identical resourcebr
+sal_False: if the items point to a different resource, or a fatal error 
occuredbr
+
+@see osl_getDirectoryItem()
+
+@since LibreOffice 3.6
+*/
+
+SAL_DLLPUBLIC sal_Bool SAL_CALL osl_identicalDirectoryItem(
+oslDirectoryItem pItemA,
+oslDirectoryItem pItemB );
+
 /* File types */
 
 typedef enum {
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
index d9a1d89..85393f5 100644
--- a/sal/inc/osl/file.hxx
+++ b/sal/inc/osl/file.hxx
@@ -1389,9 +1389,9 @@ public:
 
 class DirectoryItem: public FileBase
 {
+oslDirectoryItem _pData;
 
 public:
-oslDirectoryItem _pData;
 
 /** Constructor.
 */
@@ -1529,6 +1529,30 @@ public:
 return (RC) osl_getFileStatus( _pData, rStatus._aStatus, 
rStatus._nMask );
 }
 
+/** Determine if two directory items point the the same underlying file
+
+The comparison is done first by URL, and then by resolving links to
+find the target, and finally by comparing inodes on unix.
+
+@param  pItemA [in]
+A directory handle to compare with another handle
+
+@param  pItemB [in]
+A directory handle to compare with pItemA
+
+@return
+sal_True: if the items point to an identical resourcebr
+sal_False: if the items point to a different resource, or a fatal error 
occuredbr
+
+@see osl_getDirectoryItem()
+
+@since LibreOffice 3.6
+*/
+inline sal_Bool isIdenticalTo( const DirectoryItem pOther )
+{
+return osl_identicalDirectoryItem( _pData, pOther._pData );
+}
+
 friend class Directory;
 };
 
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 02610f5..1e9753b 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -613,6 +613,7 @@ LIBO_UDK_3.5 { # symbols available in = LibO 3.5
 LIBO_UDK_3.6 { # symbols available in = LibO 3.6
 global:
 osl_unmapMappedFile;
+osl_identicalDirectoryItem;
 } UDK_3.10;
 
 PRIVATE_1.0 {
@@ -647,7 +648,6 @@ PRIVATE_textenc.1 { # LibreOffice 3.6
 
 PRIVATE_file.1 { # LibreOffice 3.6
 global:
-osl_identicalDirectoryItem;
 osl_getFileOSHandle;
 };
 
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 850eedc..031aaa5 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -146,7 +146,7 @@ sal_Bool InternalStreamLock::LockFile( sal_Size nStart, 
sal_Size nEnd, SvFileStr
 for( size_t i = 0; i  rLockList.size(); ++i )
 {
 pLock = rLockList[ i ];
-if( osl_identicalDirectoryItem( aItem._pData, pLock-m_aItem._pData) )
+if( aItem.isIdenticalTo( pLock-m_aItem ) )
 {
 sal_Bool bDenyByOptions = sal_False;
 StreamMode nLockMode = pLock-m_pStream-GetStreamMode();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2012-01-13 Thread Norbert Thiebaud
 sal/inc/osl/security.h |2 -
 sal/inc/osl/semaphor.h |2 -
 sal/inc/osl/socket.h   |   80 -
 sal/inc/osl/time.h |   16 -
 4 files changed, 50 insertions(+), 50 deletions(-)

New commits:
commit 1b8b6ecf5fdf753bd787748d54aaa61964199465
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Fri Jan 13 02:30:20 2012 -0600

suppress doxygen warning in osl

diff --git a/sal/inc/osl/security.h b/sal/inc/osl/security.h
index ed9d9b5..85e8abd 100644
--- a/sal/inc/osl/security.h
+++ b/sal/inc/osl/security.h
@@ -61,7 +61,7 @@ SAL_DLLPUBLIC oslSecurity SAL_CALL 
osl_getCurrentSecurity(void);
 /** Deprecated API
 Create a security handle for the denoted user.
 Try to log in the user on the local system.
-@param[in] strzUserName denotes the name of the user to logg in.
+@param[in] strUserName denotes the name of the user to logg in.
 @param[in] strPasswd the password for this user.
 @param[out] pSecurity returns the security handle if user could be logged 
in.
 @return osl_Security_E_None if user could be logged in, otherwise an 
error-code.
diff --git a/sal/inc/osl/semaphor.h b/sal/inc/osl/semaphor.h
index 0a10a37..fb0cc71 100644
--- a/sal/inc/osl/semaphor.h
+++ b/sal/inc/osl/semaphor.h
@@ -42,7 +42,7 @@ typedef void* oslSemaphore;
 @deprecated
 Must not be used, as unnamed semaphores are not supported on Mac OS X.
 
-@param InitialCount denotes the starting value the semaphore. If you set 
it to
+@param initialCount denotes the starting value the semaphore. If you set 
it to
 zero, the first acquire() blocks. Otherwise InitialCount acquire()s  are
 immedeatly  successfull.
 @return 0 if the semaphore could not be created, otherwise a handle to the 
sem.
diff --git a/sal/inc/osl/socket.h b/sal/inc/osl/socket.h
index 87df672..19554e6 100644
--- a/sal/inc/osl/socket.h
+++ b/sal/inc/osl/socket.h
@@ -229,7 +229,7 @@ SAL_DLLPUBLIC sal_Bool SAL_CALL osl_isEqualSocketAddr(
 oslSocketAddr Addr1, oslSocketAddr Addr2);
 
 /** Uses the systems name-service interface to find an address for strHostname.
-@param strHostname [in] The name for which you search for an address.
+@param[in] strHostname The name for which you search for an address.
 @return The desired address if one could be found, otherwise 0.
 Don't forget to destroy the address if you don't need it any longer.
 */
@@ -241,8 +241,8 @@ SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_resolveHostname(
 in dotted decimal notation as first argument.
 @seeosl_sendToSocket()
 @seeoslSocketAddr
-@param  strDottedAddr [in] dotted decimal internet address, may be 0.
-@param  Port  [in] port number in host byte order.
+@param[in]  strDottedAddr dotted decimal internet address, may be 0.
+@param[in]  Port port number in host byte order.
 @return 0 if address could not be created.
 */
 SAL_DLLPUBLIC oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
@@ -292,7 +292,7 @@ SAL_DLLPUBLIC sal_Int32 SAL_CALL 
osl_getInetPortOfSocketAddr(
 
 
 /** Sets the Port of Addr.
-@param Port [in] is expected in host byte-order.
+@param[in] Port is expected in host byte-order.
 @return codesal_False/code if Addr is not an inet-addr.
 */
 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setInetPortOfSocketAddr(
@@ -337,8 +337,8 @@ typedef struct oslHostAddrImpl * oslHostAddr;
 
 
 /** Create an oslHostAddr from given hostname and socket address.
-@param strHostname [in] The hostname to be stored.
-@param Addr [in] The socket address to be stored.
+@param[in] strHostname The hostname to be stored.
+@param[in] Addr The socket address to be stored.
 @return The created address or 0 upon failure.
 */
 SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddr(
@@ -349,7 +349,7 @@ SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddr(
 Successful name resolution should result in the fully qualified
 domain name (FQDN) and it's address as hostname and socket address
 members of the resulting oslHostAddr.
-@param strHostname [in] The hostname to be resolved.
+@param[in] strHostname The hostname to be resolved.
 @return The resulting address or 0 upon failure.
 */
 SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString 
*strHostname);
@@ -359,7 +359,7 @@ SAL_DLLPUBLIC oslHostAddr SAL_CALL 
osl_createHostAddrByName(rtl_uString *strHost
 Successful name resolution should result in the fully qualified
 domain name (FQDN) and it's address as hostname and socket address
 members of the resulting oslHostAddr.
-@param Addr [in] The socket address to be reverse resolved.
+@param[in] Addr The socket address to be reverse resolved.
 @return The resulting address or 0 upon failure.
 */
 SAL_DLLPUBLIC oslHostAddr SAL_CALL osl_createHostAddrByAddr(const 
oslSocketAddr Addr);
@@ -447,8 +447,8 @@ SAL_DLLPUBLIC oslSocketAddr SAL_CALL 

[Libreoffice-commits] .: sal/inc

2012-01-12 Thread Stephan Bergmann
 sal/inc/sal/log.hxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit ddc3458259222720d000ccc9cc5e6bd9b09ef3c9
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Jan 12 10:57:41 2012 +0100

Make it clear that sal/log.hxx functionality may change again.

diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx
index 6eb152b..816d57a 100644
--- a/sal/inc/sal/log.hxx
+++ b/sal/inc/sal/log.hxx
@@ -153,6 +153,9 @@ inline char const * unwrapStream(StreamIgnore const ) {
 Potentially not only useful within the log framework (where it is used
 automatically), but also when creating exception messages.
 
+@attention For now, this functionality should only be used internally 
within
+LibreOffice. It may change again in a future version.
+
 @since LibreOffice 3.5
 */
 #define SAL_WHERE SAL_DETAIL_WHERE
@@ -166,6 +169,9 @@ inline char const * unwrapStream(StreamIgnore const ) {
 
   SAL_INFO(foo, object:   (hasName ? obj-name : SAL_STREAM(obj)));
 
+@attention For now, this functionality should only be used internally 
within
+LibreOffice. It may change again in a future version.
+
 @since LibreOffice 3.5
 */
 #define SAL_STREAM(stream) \
@@ -251,6 +257,9 @@ inline char const * unwrapStream(StreamIgnore const ) {
 change.  The log output is printed to stderr without further text encoding
 conversion.
 
+@attention For now, this functionality should only be used internally 
within
+LibreOffice. It may change again in a future version.
+
 @since LibreOffice 3.5
 */
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/osl sal/util store/source xmlreader/source

2011-12-21 Thread Tor Lillqvist
 sal/inc/osl/file.h |   45 
 sal/osl/unx/file.cxx   |   56 -
 sal/osl/w32/file.cxx   |7 +
 sal/util/sal.map   |5 +++
 store/source/lockbyte.cxx  |   14 ++
 xmlreader/source/xmlreader.cxx |4 +-
 6 files changed, 112 insertions(+), 19 deletions(-)

New commits:
commit e3ab0fd9016bc24c5a0eb0807f171d5025c3bb79
Author: Tor Lillqvist tlillqv...@suse.com
Date:   Wed Dec 21 13:51:50 2011 +0200

osl_unmapFile can't work for files bundled inside the .apk on Android

On Android, when an app is installed, arbitrary files bundled in the
app won't be unpacked into actual separate files in the file
system. They will exist only as archive entries in the .apk file
(which is a zip archive).

The SDK tooling puts such files under the /assets folder in the
.apk. The LibreOffice bootstrapping code for Android maps the .apk
file into memory.

osl_openFile() knows about the /assets special case, and uses a
separate abstraction for such memory-mapped files.

Obviously, when producing an .apk, one needs to make sure these
bundled files are not compressed, if one wants to be able to use them
directly from the memory-mapped .apk file. We do that in our test and
sample Android projects.

When mapping such files under /assets , just return a pointer to the
file's location inside the mapped .apk archive.

We can't use the old osl_unmapFile() on such mapped files, as that
would unexpectedly unmap fairly arbitrary pages of the .apk mapping,
wreaking havoc on later use of the same pages.

So, introduce a new osl_unmapMappedFile() function that takes also the
oslFileHandle originally passed to osl_mapFile(). Use this instead in
the few places where the code actually called osl_unmapFile(). Make
sure osl_mapFile() is nonexistent on Android.

diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index cc12b1c..ecf9e60 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -680,6 +680,12 @@ typedef void *oslFileHandle;
 @param uFlags [in]
 Specifies the open mode.
 
+On Android, if the file path is below the /assets folder, the file
+exists only as a hopefully uncompressed element inside the app
+package (.apk), which has been mapped into memory as a whole by
+the LibreOffice Android bootstrapping code. So files opened from
+there aren't actually files in the OS sense.
+
 @return
 osl_File_E_None on successbr
 osl_File_E_NOMEM not enough memory for allocating structures br
@@ -837,6 +843,15 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_getFileSize(
 
 /** Map a shared file into memory.
 
+Don't know what the shared is supposed to mean there? Also,
+obviously this API can be used to map *part* of a file into
+memory, and different parts can be mapped separately even.
+
+On Android, if the Handle refers to a file that is actually inside
+the app package (.apk zip archive), no new mapping is created,
+just a pointer to the file inside the already mapped .apk is
+returned.
+
 @since UDK 3.2.10
  */
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_mapFile (
@@ -848,8 +863,19 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_mapFile (
 );
 
 
+#ifndef ANDROID
+
 /** Unmap a shared file from memory.
 
+Ditto here, why do we need to mention shared?
+
+This function just won't work on Android in general where for
+(uncompressed) files inside the .apk, per SDK conventions in the
+/assets folder, osl_mapFile() returns a pointer to the file inside
+the already by LibreOffice Android-specific bootstrapping code
+mmapped .apk archive. We can't go and randomly munmap part of the
+.apk archive. So this function is not present on Android.
+
 @since UDK 3.2.10
  */
 SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapFile (
@@ -857,6 +883,25 @@ SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapFile (
   sal_uInt64 uLength
 );
 
+#endif
+
+/** Unmap a file segment from memory.
+
+Like osl_unmapFile(), but takes also the oslFileHandle argument
+passed to osl_mapFile() when creating this mapping.
+
+On Android, for files below /assets, i.e. located inside the app
+archive (.apk), this won't actually unmap anything; all the .apk
+stays mapped.
+
+@since UDK 3.6
+ */
+SAL_DLLPUBLIC oslFileError SAL_CALL osl_unmapMappedFile (
+  oslFileHandle Handle,
+  void*  pAddr,
+  sal_uInt64 uLength
+);
+
 
 /** Read a number of bytes from a file.
 
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index f060413..458554e 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -865,7 +865,6 @@ SAL_CALL osl_openMemoryAsFile( void *address, size_t size, 
oslFileHandle *pHandl
 eRet = oslTranslateFileError (OSL_FET_ERROR, ENOMEM);
 return eRet;
 }
-pImpl-m_kind = 

[Libreoffice-commits] .: sal/inc

2011-12-09 Thread Stephan Bergmann
 sal/inc/rtl/ustrbuf.hxx |   24 
 1 file changed, 24 insertions(+)

New commits:
commit 0670d4652dab1986412f4e9d3c9f36ba2e34db64
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Dec 9 12:31:49 2011 +0100

rtl::OUStringBuffer::insert overloaded for char (similar to ::append).

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index d9c3893..74df4fe 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -647,6 +647,30 @@ public:
 @param  offset   the offset.
 @param  ch   a codechar/code.
 @return this string buffer.
+
+@since LibreOffice 3.6
+ */
+OUStringBuffer  insert(sal_Int32 offset, char c)
+{
+sal_Unicode u = c;
+return insert( offset, u, 1 );
+}
+
+/**
+Inserts the string representation of the codechar/code
+argument into this string buffer.
+
+The second argument is inserted into the contents of this string
+buffer at the position indicated by codeoffset/code. The length
+of this string buffer increases by one.
+p
+The offset argument must be greater than or equal to
+code0/code, and less than or equal to the length of this
+string buffer.
+
+@param  offset   the offset.
+@param  ch   a codechar/code.
+@return this string buffer.
  */
 OUStringBuffer  insert(sal_Int32 offset, sal_Unicode c)
 {
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2011-12-01 Thread August Sodora
 sal/inc/rtl/strbuf.hxx  |   36 
 sal/inc/rtl/ustrbuf.hxx |   36 
 2 files changed, 72 deletions(-)

New commits:
commit 1820e7f575dffe53062f50f08cebf0efa37e2cc2
Author: August Sodora aug...@gmail.com
Date:   Thu Dec 1 18:58:46 2011 -0500

Remove charAt/setCharAt once and for all

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 3ea6bc0..e3ae74b 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -269,42 +269,6 @@ public:
 }
 
 /**
-Returns the character at a specific index in this string buffer.
-
-The first character of a string buffer is at index
-code0/code, the next at index code1/code, and so on, for
-array indexing.
-p
-The index argument must be greater than or equal to
-code0/code, and less than the length of this string buffer.
-
-@param  index   the index of the desired character.
-@return the character at the specified index of this string buffer.
-*/
-sal_Char charAt( sal_Int32 index )
-{
-assert(index = 0  index  pData-length);
-return pData-buffer[ index ];
-}
-
-/**
-The character at the specified index of this string buffer is set
-to codech/code.
-
-The index argument must be greater than or equal to
-code0/code, and less than the length of this string buffer.
-
-@param  index   the index of the character to modify.
-@param  ch  the new character.
- */
-OStringBuffer  setCharAt(sal_Int32 index, sal_Char ch)
-{
-assert(index = 0  index  pData-length);
-pData-buffer[ index ] = ch;
-return *this;
-}
-
-/**
 Return a null terminated character array.
  */
 const sal_Char* getStr() const { return pData-buffer; }
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index b4d4871..624b6f0 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -248,42 +248,6 @@ public:
 }
 
 /**
-Returns the character at a specific index in this string buffer.
-
-The first character of a string buffer is at index
-code0/code, the next at index code1/code, and so on, for
-array indexing.
-p
-The index argument must be greater than or equal to
-code0/code, and less than the length of this string buffer.
-
-@param  index   the index of the desired character.
-@return the character at the specified index of this string buffer.
- */
-sal_Unicode charAt( sal_Int32 index ) const
-{
-assert(index = 0  index  pData-length);
-return pData-buffer[ index ];
-}
-
-/**
-The character at the specified index of this string buffer is set
-to codech/code.
-
-The index argument must be greater than or equal to
-code0/code, and less than the length of this string buffer.
-
-@param  index   the index of the character to modify.
-@param  ch  the new character.
- */
-OUStringBuffer  setCharAt(sal_Int32 index, sal_Unicode ch)
-{
-assert(index = 0  index  pData-length);
-pData-buffer[ index ] = ch;
-return *this;
-}
-
-/**
 Return a null terminated unicode character array.
  */
 const sal_Unicode*  getStr() const { return pData-buffer; }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/rtl

2011-11-30 Thread Stephan Bergmann
 sal/inc/internal/once.h |   82 
 sal/rtl/source/alloc_arena.cxx  |1 
 sal/rtl/source/alloc_cache.cxx  |1 
 sal/rtl/source/alloc_global.cxx |1 
 sal/rtl/source/locale.cxx   |1 
 5 files changed, 86 deletions(-)

New commits:
commit cbcf00ad04e8e1457f5563a25b6f9cf68e3f4a24
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Nov 30 09:10:17 2011 +0100

Removed unused sal/inc/internal/once.h.

diff --git a/sal/inc/internal/once.h b/sal/inc/internal/once.h
deleted file mode 100644
index 45f9c37..000
--- a/sal/inc/internal/once.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * http://www.openoffice.org/license.html
- * for a copy of the LGPLv3 License.
- *
- /
-
-#ifndef INCLUDED_SAL_INTERNAL_ONCE_H
-#define INCLUDED_SAL_INTERNAL_ONCE_H
-
-/** sal_once_type
- *  (platform dependent)
- */
-
-#if defined(SAL_UNX)
-
-#include pthread.h
-
-typedef pthread_once_t sal_once_type;
-
-#define SAL_ONCE_INIT PTHREAD_ONCE_INIT
-#define SAL_ONCE(once, init) pthread_once((once), (init))
-
-#elif defined(SAL_W32)
-
-#define WIN32_LEAN_AND_MEAN
-#pragma warning(push,1) /* disable warnings within system headers */
-#include windows.h
-#pragma warning(pop)
-
-typedef struct sal_once_st sal_once_type;
-struct sal_once_st
-{
-LONG volatile m_done;
-LONG volatile m_lock;
-};
-
-#define SAL_ONCE_INIT { 0, 0 }
-#define SAL_ONCE(once, init) \
-{ \
-sal_once_type * control = (once); \
-if (!(control-m_done)) \
-{ \
-while (InterlockedExchange((control-m_lock), 1) == 1) Sleep(0); \
-if (!(control-m_done)) \
-{ \
-void (*init_routine)(void) = (init); \
-(*init_routine)(); \
-control-m_done = 1; \
-} \
-InterlockedExchange((control-m_lock), 0); \
-} \
-}
-
-#else
-#error Unknown platform
-#endif /* SAL_UNX | SAL_W32 */
-
-#endif /* INCLUDED_SAL_INTERNAL_ONCE_H */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/alloc_arena.cxx b/sal/rtl/source/alloc_arena.cxx
index 20ee962..03c7f47 100644
--- a/sal/rtl/source/alloc_arena.cxx
+++ b/sal/rtl/source/alloc_arena.cxx
@@ -30,7 +30,6 @@
 #include alloc_arena.hxx
 
 #include alloc_impl.hxx
-#include internal/once.h
 #include internal/rtllifecycle.h
 #include sal/macros.h
 #include osl/diagnose.h
diff --git a/sal/rtl/source/alloc_cache.cxx b/sal/rtl/source/alloc_cache.cxx
index a1d8d54..0769b8e 100644
--- a/sal/rtl/source/alloc_cache.cxx
+++ b/sal/rtl/source/alloc_cache.cxx
@@ -29,7 +29,6 @@
 #include alloc_cache.hxx
 #include alloc_impl.hxx
 #include alloc_arena.hxx
-#include internal/once.h
 #include internal/rtllifecycle.h
 #include sal/macros.h
 #include osl/diagnose.h
diff --git a/sal/rtl/source/alloc_global.cxx b/sal/rtl/source/alloc_global.cxx
index e48fdd1..c0de496 100644
--- a/sal/rtl/source/alloc_global.cxx
+++ b/sal/rtl/source/alloc_global.cxx
@@ -51,7 +51,6 @@ static void determine_alloc_mode()
  *
  * = */
 
-#include internal/once.h
 #include sal/macros.h
 
 /* = *
diff --git a/sal/rtl/source/locale.cxx b/sal/rtl/source/locale.cxx
index 1d975ad..885b139 100644
--- a/sal/rtl/source/locale.cxx
+++ b/sal/rtl/source/locale.cxx
@@ -31,7 +31,6 @@
 #include osl/diagnose.h
 #include rtl/alloc.h
 
-#include internal/once.h
 #include internal/rtllifecycle.h
 
 static sal_Int32 RTL_HASHTABLE_SIZE[] =
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc sal/osl

2011-11-25 Thread François Tigeot
 sal/inc/osl/endian.h |   21 -
 sal/osl/unx/system.h |   16 
 2 files changed, 37 deletions(-)

New commits:
commit 3a1441c0d3107c69fd80492fa7e182d4f8c02d3d
Author: François Tigeot ftig...@wolfpond.org
Date:   Fri Nov 25 10:38:14 2011 +0100

PDP_ENDIAN and variants are unused.

Remove their use from the code.

diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h
index 7069c3b..dace25b 100644
--- a/sal/inc/osl/endian.h
+++ b/sal/inc/osl/endian.h
@@ -61,8 +61,6 @@ extern C {
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif __BYTE_ORDER == __PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #endif
 
@@ -76,8 +74,6 @@ extern C {
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif __BYTE_ORDER == __PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #endif
 
@@ -85,13 +81,8 @@ extern C {
 #   include machine/endian.h
 #   if BYTE_ORDER == LITTLE_ENDIAN
 #   undef _BIG_ENDIAN
-#   undef _PDP_ENDIAN
 #   elif BYTE_ORDER == BIG_ENDIAN
 #   undef _LITTLE_ENDIAN
-#   undef _PDP_ENDIAN
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   undef _LITTLE_ENDIAN
-#   undef _BIG_ENDIAN
 #   endif
 #endif
 
@@ -103,8 +94,6 @@ extern C {
 #   define _LITTLE_ENDIAN
 #   elif BYTE_ORDER == BIG_ENDIAN
 #   define _BIG_ENDIAN
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #endif
 #endif
@@ -119,8 +108,6 @@ extern C {
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #endif
 
@@ -138,10 +125,6 @@ extern C {
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   ifndef _PDP_ENDIAN
-#   define _PDP_ENDIAN
-#   endif
 #   endif
 #endif
 
@@ -155,10 +138,6 @@ extern C {
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   ifndef _PDP_ENDIAN
-#   define _PDP_ENDIAN
-#   endif
 #   endif
 #endif
 
diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h
index c8f4871..71b9b31 100644
--- a/sal/osl/unx/system.h
+++ b/sal/osl/unx/system.h
@@ -89,8 +89,6 @@
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif __BYTE_ORDER == __PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #   define  IORESOURCE_TRANSFER_BSD
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
@@ -142,8 +140,6 @@
 #   define _LITTLE_ENDIAN_OO
 #   elif BYTE_ORDER == BIG_ENDIAN
 #   define _BIG_ENDIAN_OO
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   define _PDP_ENDIAN_OO
 #   endif
 #   define  IORESOURCE_TRANSFER_BSD
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
@@ -179,8 +175,6 @@
 #   define _LITTLE_ENDIAN
 #   elif BYTE_ORDER == BIG_ENDIAN
 #   define _BIG_ENDIAN
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #endif
 #   define  NO_PTHREAD_RTL
@@ -248,8 +242,6 @@
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   define _PDP_ENDIAN
 #   endif
 #   define  SLEEP_TIMESPEC(timespec)nsleep(timespec, 0)
 #   define  LIBPATH LIBPATH
@@ -301,10 +293,6 @@
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   ifndef _PDP_ENDIAN
-#   define _PDP_ENDIAN
-#   endif
 #   endif
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
 #   define  NO_PTHREAD_RTL
@@ -341,10 +329,6 @@ int macxp_resolveAlias(char *path, int buflen);
 #   ifndef _BIG_ENDIAN
 #   define _BIG_ENDIAN
 #   endif
-#   elif BYTE_ORDER == PDP_ENDIAN
-#   ifndef _PDP_ENDIAN
-#   define _PDP_ENDIAN
-#   endif
 #   endif
 #   define  IOCHANNEL_TRANSFER_BSD_RENO
 #   define  NO_PTHREAD_RTL
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2011-11-23 Thread Stephan Bergmann
 sal/inc/sal/log.hxx |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 364a3d2864973935b2cd18b328392d1b556456dd
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Nov 23 20:26:52 2011 +0100

Silence bogus MSC must return a value errors.

diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx
index be71d02..cf22519 100644
--- a/sal/inc/sal/log.hxx
+++ b/sal/inc/sal/log.hxx
@@ -91,25 +91,39 @@ template typename T  inline StreamIgnore operator (
 StreamStart const , T const )
 {
 std::abort();
+#if defined _MSC_VER
+return StreamIgnore();
+#endif
 }
 
 template typename T  inline StreamIgnore operator (
 StreamString const , T const )
 {
 std::abort();
+#if defined _MSC_VER
+return StreamIgnore();
+#endif
 }
 
 template typename T  inline StreamIgnore operator (
 StreamIgnore const , T const )
 {
 std::abort();
+#if defined _MSC_VER
+return StreamIgnore();
+#endif
 }
 
 template typename T  typename T::Result getResult(T const );
 
 inline char const * unwrapStream(StreamString const  s) { return s.string; }
 
-inline char const * unwrapStream(StreamIgnore const ) { std::abort(); }
+inline char const * unwrapStream(StreamIgnore const ) {
+std::abort();
+#if defined _MSC_VER
+return 0;
+#endif
+}
 
 } }
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2011-11-23 Thread Stephan Bergmann
 sal/inc/sal/log.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0a1f03544a72596b5022985f2367bdcd0699adeb
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Nov 23 21:55:59 2011 +0100

Call getResult with fully qualified name.

diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx
index cf22519..2e09c29 100644
--- a/sal/inc/sal/log.hxx
+++ b/sal/inc/sal/log.hxx
@@ -131,7 +131,8 @@ inline char const * unwrapStream(StreamIgnore const ) {
 #define SAL_DETAIL_LOG_STREAM(condition, level, area, where, stream) \
 do { \
 if (condition) { \
-if (sizeof getResult(::sal::detail::StreamStart()  stream) == 1) 
\
+if (sizeof ::sal::detail::getResult( \
+::sal::detail::StreamStart()  stream) == 1) \
 { \
 ::sal_detail_log( \
 (level), (area), (where), \
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sal/inc

2011-10-05 Thread Stephan Bergmann
 sal/inc/rtl/strbuf.hxx  |   14 ++
 sal/inc/rtl/string.hxx  |   24 +++-
 sal/inc/rtl/ustrbuf.hxx |   14 ++
 sal/inc/rtl/ustring.hxx |   12 +++-
 4 files changed, 38 insertions(+), 26 deletions(-)

New commits:
commit 112bdf84d684590e042725c7173e059b4afa2f83
Author: Stephan Bergmann sberg...@redhat.com
Date:   Wed Oct 5 09:20:59 2011 +0200

Removed dangerous rtl::O[U]String[Buffer]::operator sal_{char,Unicode} 
const *.

As a replacement, added appropriate operator [] functions.  All other uses 
can
use getStr().

diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 63ae448..962d3df 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -287,12 +287,18 @@ public:
 /**
 Return a null terminated character array.
  */
-operatorconst sal_Char *() const { return pData-buffer; }
+const sal_Char* getStr() const { return pData-buffer; }
 
 /**
-Return a null terminated character array.
- */
-const sal_Char* getStr() const { return pData-buffer; }
+  Access to individual characters.
+
+  @param index must be non-negative and less than length.
+
+  @return a reference to the character at the given index.
+
+  @since LibreOffice 3.5
+*/
+sal_Char  operator [](sal_Int32 index) { return pData-buffer[index]; }
 
 /**
 Return a OString instance reflecting the current content
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 96ca406..22de6dd 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -251,19 +251,6 @@ public:
 /**
   Returns a pointer to the characters of this string.
 
-  pThe returned pointer is not guaranteed to point to a null-terminated
-  byte string.  Note that this string object may contain embedded null
-  characters, which will thus also be embedded in the returned byte
-  string./p
-
-  @return a pointer to a (not necessarily null-terminated) byte string
-  representing the characters of this string object.
-*/
-operator const sal_Char *() const SAL_THROW(()) { return pData-buffer; }
-
-/**
-  Returns a pointer to the characters of this string.
-
   pThe returned pointer is guaranteed to point to a null-terminated byte
   string.  But note that this string object may contain embedded null
   characters, which will thus also be embedded in the returned
@@ -275,6 +262,17 @@ public:
 const sal_Char * getStr() const SAL_THROW(()) { return pData-buffer; }
 
 /**
+  Access to individual characters.
+
+  @param index must be non-negative and less than length.
+
+  @return the character at the given index.
+
+  @since LibreOffice 3.5
+*/
+sal_Char operator [](sal_Int32 index) const { return getStr()[index]; }
+
+/**
   Compares two strings.
 
   The comparison is based on the numeric value of each character in
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index a356309..47569e5 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -267,12 +267,18 @@ public:
 /**
 Return a null terminated unicode character array.
  */
-operatorconst sal_Unicode *() const { return pData-buffer; }
+const sal_Unicode*  getStr() const { return pData-buffer; }
 
 /**
-Return a null terminated unicode character array.
- */
-const sal_Unicode*  getStr() const { return pData-buffer; }
+  Access to individual characters.
+
+  @param index must be non-negative and less than length.
+
+  @return a reference to the character at the given index.
+
+  @since LibreOffice 3.5
+*/
+sal_Unicode  operator [](sal_Int32 index) { return pData-buffer[index]; }
 
 /**
 Return a OUString instance reflecting the current content
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index ed268d9..e104f0d 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -300,16 +300,18 @@ public:
 
   @return   a pointer to the Unicode characters buffer from this object.
 */
-operator const sal_Unicode *() const SAL_THROW(()) { return pData-buffer; 
}
+const sal_Unicode * getStr() const SAL_THROW(()) { return pData-buffer; }
 
 /**
-  Returns a pointer to the Unicode character buffer from this string.
+  Access to individual characters.
 
-  It isn't necessarily NULL terminated.
+  @param index must be non-negative and less than length.
 
-  @return   a pointer to the Unicode characters buffer from this object.
+  @return the character at the given index.
+
+  @since LibreOffice 3.5
 */
-const sal_Unicode * getStr() const SAL_THROW(()) { return pData-buffer; }
+sal_Unicode operator [](sal_Int32 index) const { return getStr()[index]; }
 
 /**
   Compares two strings.
___
Libreoffice-commits mailing 

[Libreoffice-commits] .: sal/inc sal/osl sal/textenc

2011-09-27 Thread Stephan Bergmann
 sal/inc/osl/module.h|   24 ++
 sal/inc/osl/module.hxx  |   15 
 sal/osl/unx/module.c|  168 +++-
 sal/osl/w32/module.cxx  |6 +
 sal/textenc/textenc.cxx |   12 ---
 5 files changed, 144 insertions(+), 81 deletions(-)

New commits:
commit 193715bbf0e59256fd8da7ebd8dc5eb937615281
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Sep 27 10:06:54 2011 +0200

FullTextEncodingDataSingleton must not call itself recursively.

Happened on non-standard locales (like hu_HU on Linux) when 
osl_loadModuleRelative
wanted to access non-standard text encodings.

For Windows, the fix is still only a TODO: FIXME dummy.

diff --git a/sal/inc/osl/module.h b/sal/inc/osl/module.h
index c103e41..6784232 100644
--- a/sal/inc/osl/module.h
+++ b/sal/inc/osl/module.h
@@ -102,6 +102,30 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char 
*pModuleName, sal_Int32 nR
 oslModule SAL_CALL osl_loadModuleRelative(
 oslGenericFunction baseModule, rtl_uString * relativePath, sal_Int32 mode);
 
+/** Load a module located relative to some other module.
+
+@param baseModule
+must point to a function that is part of the code of some loaded module;
+must not be NULL.
+
+@param relativePath
+a relative URL containing only ASCII (0x01--7F) characters; must not be
+NULL.
+
+@param mode
+the SAL_LOADMODULE_xxx flags.
+
+@return
+a non-NULL handle to the loaded module, or NULL if an error occurred.
+
+@since LibreOffice 3.5
+*/
+oslModule SAL_CALL osl_loadModuleRelativeAscii(
+oslGenericFunction baseModule, char const * relativePath, sal_Int32 mode);
+/* This function is guaranteed not to call into
+   FullTextEncodingDataSingleton in sal/textenc/textenc.cxx, so can be used
+   in its implementation without running into circles. */
+
 /** Retrieve the handle of an already loaded module.
 
 This function can be used to search for a function symbol in the process 
address space.
diff --git a/sal/inc/osl/module.hxx b/sal/inc/osl/module.hxx
index cfc1c5e..3ece623 100644
--- a/sal/inc/osl/module.hxx
+++ b/sal/inc/osl/module.hxx
@@ -102,6 +102,16 @@ public:
 return is();
 }
 
+/// @since LibreOffice 3.5
+sal_Bool SAL_CALL loadRelative(
+oslGenericFunction baseModule, char const * relativePath,
+sal_Int32 mode = SAL_LOADMODULE_DEFAULT)
+{
+unload();
+m_Module = osl_loadModuleRelativeAscii(baseModule, relativePath, mode);
+return is();
+}
+
 void SAL_CALL unload()
 {
 if (m_Module)
@@ -144,6 +154,11 @@ public:
 return ( osl_getFunctionSymbol( m_Module, ustrFunctionSymbolName.pData 
) );
 }
 
+/// @since LibreOffice 3.5
+oslGenericFunction SAL_CALL getFunctionSymbol(char const * name) const {
+return osl_getAsciiFunctionSymbol(m_Module, name);
+}
+
 operator oslModule() const
 {
 return m_Module;
diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c
index 63fbc20..7db8011 100644
--- a/sal/osl/unx/module.c
+++ b/sal/osl/unx/module.c
@@ -46,6 +46,69 @@
 /* implemented in file.c */
 extern int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32);
 
+static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
+sal_Bool result = sal_False;
+/* Bah, we do want to use dladdr here also on iOS, I think? */
+#if !defined(NO_DL_FUNCTIONS) || defined(IOS)
+#if defined(AIX)
+int i;
+int size = 4 * 1024;
+char *buf, *filename=NULL;
+struct ld_info *lp;
+
+if ((buf = malloc(size)) == NULL)
+return result;
+
+while((i = loadquery(L_GETINFO, buf, size)) == -1  errno == ENOMEM)
+{
+size += 4 * 1024;
+if ((buf = malloc(size)) == NULL)
+break;
+}
+
+lp = (struct ld_info*) buf;
+while (lp)
+{
+unsigned long start = (unsigned long)lp-ldinfo_dataorg;
+unsigned long end = start + lp-ldinfo_datasize;
+if (start = (unsigned long)address  end  (unsigned long)address)
+{
+filename = lp-ldinfo_filename;
+break;
+}
+if (!lp-ldinfo_next)
+break;
+lp = (struct ld_info*) ((char *) lp + lp-ldinfo_next);
+}
+
+if (filename)
+{
+rtl_string_newFromStr(path, filename);
+result = sal_True;
+}
+else
+{
+result = sal_False;
+}
+
+free(buf);
+#else
+Dl_info dl_info;
+
+if ((result = dladdr(address, dl_info)) != 0)
+{
+rtl_string_newFromStr(path, dl_info.dli_fname);
+result = sal_True;
+}
+else
+{
+result = sal_False;
+}
+#endif
+#endif
+return result;
+}
+
 /*/
 /* osl_loadModule */
 /*/
@@ -104,6 +167,34 @@ oslModule SAL_CALL