[Libreoffice-commits] .: 7 commits - sal/inc sal/osl sal/rtl sal/util soltools/testSHL

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Nov 1 09:11:33 PDT 2011


 sal/inc/internal/rtllifecycle.h   |   67 +
 sal/inc/rtl/tres.h                |  109 -
 sal/inc/rtl/tres.hxx              |  111 -
 sal/osl/w32/dllentry.c            |    7 
 sal/rtl/source/alloc_arena.c      | 1362 ------------------------
 sal/rtl/source/alloc_arena.cxx    | 1360 ++++++++++++++++++++++++
 sal/rtl/source/alloc_arena.h      |  140 --
 sal/rtl/source/alloc_arena.hxx    |  129 ++
 sal/rtl/source/alloc_cache.c      | 1767 -------------------------------
 sal/rtl/source/alloc_cache.cxx    | 1759 +++++++++++++++++++++++++++++++
 sal/rtl/source/alloc_cache.h      |  185 ---
 sal/rtl/source/alloc_cache.hxx    |  171 +++
 sal/rtl/source/alloc_fini.cxx     |   22 
 sal/rtl/source/alloc_global.c     |  386 ------
 sal/rtl/source/alloc_global.cxx   |  386 ++++++
 sal/rtl/source/alloc_impl.h       |  284 -----
 sal/rtl/source/alloc_impl.hxx     |  275 ++++
 sal/rtl/source/byteseq.c          |  257 ----
 sal/rtl/source/byteseq.cxx        |  266 ++++
 sal/rtl/source/cipher.c           | 1365 ------------------------
 sal/rtl/source/cipher.cxx         | 1364 ++++++++++++++++++++++++
 sal/rtl/source/cmdargs.cxx        |    2 
 sal/rtl/source/crc.c              |  166 --
 sal/rtl/source/crc.cxx            |  166 ++
 sal/rtl/source/digest.c           | 2121 -------------------------------------
 sal/rtl/source/digest.cxx         | 2143 ++++++++++++++++++++++++++++++++++++++
 sal/rtl/source/hash.cxx           |    4 
 sal/rtl/source/hash.h             |   24 
 sal/rtl/source/hash.hxx           |   16 
 sal/rtl/source/locale.c           |  352 ------
 sal/rtl/source/locale.cxx         |  349 ++++++
 sal/rtl/source/makefile.mk        |    2 
 sal/rtl/source/memory.c           |   64 -
 sal/rtl/source/memory.cxx         |   64 +
 sal/rtl/source/random.c           |  340 ------
 sal/rtl/source/random.cxx         |  340 ++++++
 sal/rtl/source/rtl_process.c      |   51 
 sal/rtl/source/rtl_process.cxx    |   63 +
 sal/rtl/source/strbuf.c           |  179 ---
 sal/rtl/source/strbuf.cxx         |  179 +++
 sal/rtl/source/strimp.c           |   61 -
 sal/rtl/source/strimp.cxx         |   61 +
 sal/rtl/source/strimp.h           |   67 -
 sal/rtl/source/strimp.hxx         |   59 +
 sal/rtl/source/string.c           |  323 -----
 sal/rtl/source/string.cxx         |  327 +++++
 sal/rtl/source/strtmpl.c          | 1567 ---------------------------
 sal/rtl/source/strtmpl.cxx        | 1617 ++++++++++++++++++++++++++++
 sal/rtl/source/surrogates.h       |   53 
 sal/rtl/source/surrogates.hxx     |   53 
 sal/rtl/source/tres.c             |  688 ------------
 sal/rtl/source/uri.cxx            |    2 
 sal/rtl/source/ustrbuf.c          |  239 ----
 sal/rtl/source/ustrbuf.cxx        |  240 ++++
 sal/rtl/source/ustring.c          |  983 -----------------
 sal/rtl/source/ustring.cxx        |  997 +++++++++++++++++
 sal/rtl/source/uuid.cxx           |    4 
 sal/util/sal.map                  |    2 
 soltools/testSHL/inc/tlog.hxx     |   99 -
 soltools/testSHL/inc/tstMgr.hxx   |   75 -
 soltools/testSHL/inc/tutil.hxx    |   52 
 soltools/testSHL/makefile.mk      |   52 
 soltools/testSHL/testshl.cxx      |   96 -
 soltools/testSHL/util/makefile.mk |   45 
 soltools/testSHL/util/tlog.cxx    |  109 -
 soltools/testSHL/util/tstMgr.cxx  |  163 --
 soltools/testSHL/util/tutil.cxx   |  149 --
 67 files changed, 12469 insertions(+), 14111 deletions(-)

New commits:
commit 54760dfdc26fcded5c62bbad05429db5c9cee935
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 31 22:32:07 2011 +0100

    Moved sal/rtl/source string files from C to C++, for easier maintenance.

diff --git a/sal/rtl/source/hash.cxx b/sal/rtl/source/hash.cxx
index 4e03dfc..8ddf268 100644
--- a/sal/rtl/source/hash.cxx
+++ b/sal/rtl/source/hash.cxx
@@ -29,8 +29,8 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sal.hxx"
 
-#include "hash.h"
-#include "strimp.h"
+#include "hash.hxx"
+#include "strimp.hxx"
 #include <osl/diagnose.h>
 #include <sal/macros.h>
 
diff --git a/sal/rtl/source/hash.h b/sal/rtl/source/hash.h
deleted file mode 100644
index 6a65188..0000000
--- a/sal/rtl/source/hash.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-#ifndef INCLUDED_RTL_SOURCE_HASH_H
-#define INCLUDED_RTL_SOURCE_HASH_H
-
-#include <sal/types.h>
-#include <rtl/ustring.h>
-
-#if defined __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* These functions are not multi-thread safe: */
-
-rtl_uString     *rtl_str_hash_intern (rtl_uString       *pString,
-                                      int                can_return);
-void             rtl_str_hash_remove (rtl_uString       *pString);
-
-#if defined __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* INCLUDED_RTL_SOURCE_HASH_H */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/hash.hxx b/sal/rtl/source/hash.hxx
new file mode 100644
index 0000000..d103efc
--- /dev/null
+++ b/sal/rtl/source/hash.hxx
@@ -0,0 +1,16 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef INCLUDED_RTL_SOURCE_HASH_HXX
+#define INCLUDED_RTL_SOURCE_HASH_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.h>
+
+/* These functions are not multi-thread safe: */
+
+rtl_uString     *rtl_str_hash_intern (rtl_uString       *pString,
+                                      int                can_return);
+void             rtl_str_hash_remove (rtl_uString       *pString);
+
+#endif /* INCLUDED_RTL_SOURCE_HASH_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strbuf.c b/sal/rtl/source/strbuf.c
deleted file mode 100644
index c9a4f31..0000000
--- a/sal/rtl/source/strbuf.c
+++ /dev/null
@@ -1,179 +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.
- *
- ************************************************************************/
-
-#include <osl/interlck.h>
-
-#ifndef _RTL_STRING_HXX_
-#include <rtl/strbuf.hxx>
-#endif
-#include <rtl/memory.h>
-
-/*
-#include <rtl/alloc.h>
-*/
-
-
-
-/*************************************************************************
- *  rtl_stringbuffer_newFromStr_WithLength
- */
-void SAL_CALL rtl_stringbuffer_newFromStr_WithLength( rtl_String ** newStr,
-                                                      const sal_Char * value,
-                                                      sal_Int32 count )
-{
-    if (!value)
-    {
-        rtl_string_new_WithLength( newStr, 16 );
-        return;
-    }
-
-    rtl_string_new_WithLength( newStr, count + 16 );
-    (*newStr)->length = count;
-    rtl_copyMemory( (*newStr)->buffer, value, count );
-    return;
-}
-
-/*************************************************************************
- *  rtl_stringbuffer_newFromStringBuffer
- */
-sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer( rtl_String ** newStr,
-                                                         sal_Int32 capacity,
-                                                         rtl_String * oldStr )
-{
-    sal_Int32 newCapacity = capacity;
-
-    if (newCapacity < oldStr->length)
-        newCapacity = oldStr->length;
-
-    rtl_string_new_WithLength( newStr, newCapacity );
-    if (oldStr->length > 0) {
-        (*newStr)->length = oldStr->length;
-        rtl_copyMemory( (*newStr)->buffer, oldStr->buffer, oldStr->length );
-    }
-    return newCapacity;
-}
-
-/*************************************************************************
- *  rtl_stringbuffer_ensureCapacity
- */
-void SAL_CALL rtl_stringbuffer_ensureCapacity
-    (rtl_String ** This, sal_Int32* capacity, sal_Int32 minimumCapacity)
-{
-    if (minimumCapacity > *capacity)
-    {
-        rtl_String * pTmp = *This;
-        rtl_String * pNew = NULL;
-        *capacity = ((*This)->length + 1) * 2;
-        if (minimumCapacity > *capacity)
-            /* still lower, set to the minimum capacity */
-            *capacity = minimumCapacity;
-
-        rtl_string_new_WithLength(&pNew, *capacity);
-        pNew->length = (*This)->length;
-        *This = pNew;
-
-        rtl_copyMemory( (*This)->buffer, pTmp->buffer, pTmp->length );
-        rtl_string_release( pTmp );
-    }
-}
-
-/*************************************************************************
- *  rtl_stringbuffer_insert
- */
-void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
-                                       sal_Int32 * capacity,
-                                       sal_Int32 offset,
-                                       const sal_Char * str,
-                                       sal_Int32 len )
-{
-    sal_Int32 nOldLen;
-    sal_Char * pBuf;
-    sal_Int32 n;
-    if( len != 0 )
-    {
-        if (*capacity < (*This)->length + len)
-            rtl_stringbuffer_ensureCapacity( This, capacity, (*This)->length + len );
-
-        /*
-        if( len == 1 )
-            This->buffer
-        */
-        nOldLen = (*This)->length;
-        pBuf = (*This)->buffer;
-
-        /* copy the tail */
-        n = (nOldLen - offset);
-        if( n == 1 )
-            /* optimized for 1 character */
-            pBuf[offset + len] = pBuf[offset];
-        else if( n > 1 )
-            rtl_moveMemory( pBuf + offset + len, pBuf + offset, n * sizeof(sal_Char) );
-
-        /* insert the new characters */
-        n = len;
-        if( len == 1 )
-                            /* optimized for 1 character */
-            pBuf[offset] = *str;
-        else if( n > 1 )
-            rtl_copyMemory( pBuf + offset, str, len * sizeof(sal_Char) );
-        (*This)->length = nOldLen + len;
-        pBuf[ nOldLen + len ] = 0;
-    }
-}
-
-/*************************************************************************
- *  rtl_stringbuffer_remove
- */
-void SAL_CALL rtl_stringbuffer_remove( rtl_String ** This,
-                                       sal_Int32 start,
-                                       sal_Int32 len )
-{
-    sal_Int32 nTailLen;
-    sal_Char * pBuf;
-
-    if (len > (*This)->length - start)
-        len = (*This)->length - start;
-
-    //remove nothing
-    if (!len)
-        return;
-
-    pBuf = (*This)->buffer;
-    nTailLen = (*This)->length - ( start + len );
-
-    if (nTailLen)
-    {
-        /* move the tail */
-        rtl_moveMemory(pBuf + start, pBuf + start + len, nTailLen * sizeof(sal_Char));
-    }
-
-    (*This)->length-=len;
-    pBuf[ (*This)->length ] = 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strbuf.cxx b/sal/rtl/source/strbuf.cxx
new file mode 100644
index 0000000..c9a4f31
--- /dev/null
+++ b/sal/rtl/source/strbuf.cxx
@@ -0,0 +1,179 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+#include <osl/interlck.h>
+
+#ifndef _RTL_STRING_HXX_
+#include <rtl/strbuf.hxx>
+#endif
+#include <rtl/memory.h>
+
+/*
+#include <rtl/alloc.h>
+*/
+
+
+
+/*************************************************************************
+ *  rtl_stringbuffer_newFromStr_WithLength
+ */
+void SAL_CALL rtl_stringbuffer_newFromStr_WithLength( rtl_String ** newStr,
+                                                      const sal_Char * value,
+                                                      sal_Int32 count )
+{
+    if (!value)
+    {
+        rtl_string_new_WithLength( newStr, 16 );
+        return;
+    }
+
+    rtl_string_new_WithLength( newStr, count + 16 );
+    (*newStr)->length = count;
+    rtl_copyMemory( (*newStr)->buffer, value, count );
+    return;
+}
+
+/*************************************************************************
+ *  rtl_stringbuffer_newFromStringBuffer
+ */
+sal_Int32 SAL_CALL rtl_stringbuffer_newFromStringBuffer( rtl_String ** newStr,
+                                                         sal_Int32 capacity,
+                                                         rtl_String * oldStr )
+{
+    sal_Int32 newCapacity = capacity;
+
+    if (newCapacity < oldStr->length)
+        newCapacity = oldStr->length;
+
+    rtl_string_new_WithLength( newStr, newCapacity );
+    if (oldStr->length > 0) {
+        (*newStr)->length = oldStr->length;
+        rtl_copyMemory( (*newStr)->buffer, oldStr->buffer, oldStr->length );
+    }
+    return newCapacity;
+}
+
+/*************************************************************************
+ *  rtl_stringbuffer_ensureCapacity
+ */
+void SAL_CALL rtl_stringbuffer_ensureCapacity
+    (rtl_String ** This, sal_Int32* capacity, sal_Int32 minimumCapacity)
+{
+    if (minimumCapacity > *capacity)
+    {
+        rtl_String * pTmp = *This;
+        rtl_String * pNew = NULL;
+        *capacity = ((*This)->length + 1) * 2;
+        if (minimumCapacity > *capacity)
+            /* still lower, set to the minimum capacity */
+            *capacity = minimumCapacity;
+
+        rtl_string_new_WithLength(&pNew, *capacity);
+        pNew->length = (*This)->length;
+        *This = pNew;
+
+        rtl_copyMemory( (*This)->buffer, pTmp->buffer, pTmp->length );
+        rtl_string_release( pTmp );
+    }
+}
+
+/*************************************************************************
+ *  rtl_stringbuffer_insert
+ */
+void SAL_CALL rtl_stringbuffer_insert( rtl_String ** This,
+                                       sal_Int32 * capacity,
+                                       sal_Int32 offset,
+                                       const sal_Char * str,
+                                       sal_Int32 len )
+{
+    sal_Int32 nOldLen;
+    sal_Char * pBuf;
+    sal_Int32 n;
+    if( len != 0 )
+    {
+        if (*capacity < (*This)->length + len)
+            rtl_stringbuffer_ensureCapacity( This, capacity, (*This)->length + len );
+
+        /*
+        if( len == 1 )
+            This->buffer
+        */
+        nOldLen = (*This)->length;
+        pBuf = (*This)->buffer;
+
+        /* copy the tail */
+        n = (nOldLen - offset);
+        if( n == 1 )
+            /* optimized for 1 character */
+            pBuf[offset + len] = pBuf[offset];
+        else if( n > 1 )
+            rtl_moveMemory( pBuf + offset + len, pBuf + offset, n * sizeof(sal_Char) );
+
+        /* insert the new characters */
+        n = len;
+        if( len == 1 )
+                            /* optimized for 1 character */
+            pBuf[offset] = *str;
+        else if( n > 1 )
+            rtl_copyMemory( pBuf + offset, str, len * sizeof(sal_Char) );
+        (*This)->length = nOldLen + len;
+        pBuf[ nOldLen + len ] = 0;
+    }
+}
+
+/*************************************************************************
+ *  rtl_stringbuffer_remove
+ */
+void SAL_CALL rtl_stringbuffer_remove( rtl_String ** This,
+                                       sal_Int32 start,
+                                       sal_Int32 len )
+{
+    sal_Int32 nTailLen;
+    sal_Char * pBuf;
+
+    if (len > (*This)->length - start)
+        len = (*This)->length - start;
+
+    //remove nothing
+    if (!len)
+        return;
+
+    pBuf = (*This)->buffer;
+    nTailLen = (*This)->length - ( start + len );
+
+    if (nTailLen)
+    {
+        /* move the tail */
+        rtl_moveMemory(pBuf + start, pBuf + start + len, nTailLen * sizeof(sal_Char));
+    }
+
+    (*This)->length-=len;
+    pBuf[ (*This)->length ] = 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strimp.c b/sal/rtl/source/strimp.c
deleted file mode 100644
index ae75249..0000000
--- a/sal/rtl/source/strimp.c
+++ /dev/null
@@ -1,61 +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.
- *
- ************************************************************************/
-
-#include "strimp.h"
-
-sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
-{
-    sal_Int16 n = -1;
-    if ( (ch >= '0') && (ch <= '9') )
-        n = ch-'0';
-    else if ( (ch >= 'a') && (ch <= 'z') )
-        n = ch-'a'+10;
-    else if ( (ch >= 'A') && (ch <= 'Z') )
-        n = ch-'A'+10;
-    return (n < nRadix) ? n : -1;
-}
-
-sal_Bool rtl_ImplIsWhitespace( sal_Unicode c )
-{
-    /* Space or Control character? */
-    if ( (c <= 32) && c )
-        return sal_True;
-
-    /* Only in the General Punctuation area Space or Control characters are included? */
-    if ( (c < 0x2000) || (c > 0x206F) )
-        return sal_False;
-
-    if ( ((c >= 0x2000) && (c <= 0x200B)) ||    /* All Spaces           */
-         (c == 0x2028) ||                       /* LINE SEPARATOR       */
-         (c == 0x2029) )                        /* PARAGRAPH SEPARATOR  */
-        return sal_True;
-
-    return sal_False;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strimp.cxx b/sal/rtl/source/strimp.cxx
new file mode 100644
index 0000000..a5b8f82
--- /dev/null
+++ b/sal/rtl/source/strimp.cxx
@@ -0,0 +1,61 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+#include "strimp.hxx"
+
+sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
+{
+    sal_Int16 n = -1;
+    if ( (ch >= '0') && (ch <= '9') )
+        n = ch-'0';
+    else if ( (ch >= 'a') && (ch <= 'z') )
+        n = ch-'a'+10;
+    else if ( (ch >= 'A') && (ch <= 'Z') )
+        n = ch-'A'+10;
+    return (n < nRadix) ? n : -1;
+}
+
+sal_Bool rtl_ImplIsWhitespace( sal_Unicode c )
+{
+    /* Space or Control character? */
+    if ( (c <= 32) && c )
+        return sal_True;
+
+    /* Only in the General Punctuation area Space or Control characters are included? */
+    if ( (c < 0x2000) || (c > 0x206F) )
+        return sal_False;
+
+    if ( ((c >= 0x2000) && (c <= 0x200B)) ||    /* All Spaces           */
+         (c == 0x2028) ||                       /* LINE SEPARATOR       */
+         (c == 0x2029) )                        /* PARAGRAPH SEPARATOR  */
+        return sal_True;
+
+    return sal_False;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strimp.h b/sal/rtl/source/strimp.h
deleted file mode 100644
index 3db89ce..0000000
--- a/sal/rtl/source/strimp.h
+++ /dev/null
@@ -1,67 +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_RTL_SOURCE_STRIMP_H
-#define INCLUDED_RTL_SOURCE_STRIMP_H
-
-#include <osl/interlck.h>
-
-#include "sal/types.h"
-
-/* ======================================================================= */
-/* Help functions for String and UString                                   */
-/* ======================================================================= */
-
-#if defined __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * refCount is opaqueincludes 2 bit-fields;
- * MSB:   'interned' - is stored in the intern hash
- * MSB-1: 'static'   - is a const / static string,
- *                     do no ref counting
- */
-#define SAL_STRING_INTERN_FLAG 0x80000000
-#define SAL_STRING_STATIC_FLAG 0x40000000
-#define SAL_STRING_REFCOUNT(a) ((a) & 0x3fffffff)
-
-#define SAL_STRING_IS_INTERN(a) ((a)->refCount & SAL_STRING_INTERN_FLAG)
-#define SAL_STRING_IS_STATIC(a) ((a)->refCount & SAL_STRING_STATIC_FLAG)
-
-sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix );
-
-sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
-
-#if defined __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* INCLUDED_RTL_SOURCE_STRIMP_H */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strimp.hxx b/sal/rtl/source/strimp.hxx
new file mode 100644
index 0000000..a9e5a38
--- /dev/null
+++ b/sal/rtl/source/strimp.hxx
@@ -0,0 +1,59 @@
+/* -*- 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_RTL_SOURCE_STRIMP_HXX
+#define INCLUDED_RTL_SOURCE_STRIMP_HXX
+
+#include <osl/interlck.h>
+
+#include "sal/types.h"
+
+/* ======================================================================= */
+/* Help functions for String and UString                                   */
+/* ======================================================================= */
+
+/*
+ * refCount is opaqueincludes 2 bit-fields;
+ * MSB:   'interned' - is stored in the intern hash
+ * MSB-1: 'static'   - is a const / static string,
+ *                     do no ref counting
+ */
+#define SAL_STRING_INTERN_FLAG 0x80000000
+#define SAL_STRING_STATIC_FLAG 0x40000000
+#define SAL_STRING_REFCOUNT(a) ((a) & 0x3fffffff)
+
+#define SAL_STRING_IS_INTERN(a) ((a)->refCount & SAL_STRING_INTERN_FLAG)
+#define SAL_STRING_IS_STATIC(a) ((a)->refCount & SAL_STRING_STATIC_FLAG)
+
+sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix );
+
+sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
+
+#endif /* INCLUDED_RTL_SOURCE_STRIMP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/string.c b/sal/rtl/source/string.c
deleted file mode 100644
index 2ee7961..0000000
--- a/sal/rtl/source/string.c
+++ /dev/null
@@ -1,323 +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.
- *
- ************************************************************************/
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-#pragma warning(disable:4738) // storing 32-bit float result in memory, possible loss of performance
-#endif
-
-#include <rtl/memory.h>
-#include <osl/interlck.h>
-#include <rtl/alloc.h>
-#include <osl/diagnose.h>
-#include <rtl/tencinfo.h>
-
-#include "strimp.h"
-#include "surrogates.h"
-#include <rtl/string.h>
-
-#include "rtl/math.h"
-#include "rtl/tencinfo.h"
-
-/* ======================================================================= */
-
-/* static data to be referenced by all empty strings
- * the refCount is predefined to 1 and must never become 0 !
- */
-static rtl_String const aImplEmpty_rtl_String =
-{
-    SAL_STRING_STATIC_FLAG|1,
-            /* sal_Int32    refCount;   */
-    0,      /* sal_Int32    length;     */
-    { 0 }   /* sal_Char     buffer[1];  */
-};
-
-/* ======================================================================= */
-
-#define IMPL_RTL_STRCODE            sal_Char
-#define IMPL_RTL_USTRCODE( c )      ((unsigned char)c)
-#define IMPL_RTL_STRNAME( n )       rtl_str_ ## n
-
-#define IMPL_RTL_STRINGNAME( n )    rtl_string_ ## n
-#define IMPL_RTL_STRINGDATA         rtl_String
-#define IMPL_RTL_EMPTYSTRING        aImplEmpty_rtl_String
-
-/* ======================================================================= */
-
-/* Include String/UString template code */
-
-#include "strtmpl.c"
-
-sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * pStr, float f)
-{
-    rtl_String * pResult = NULL;
-    sal_Int32 nLen;
-    rtl_math_doubleToString(
-        &pResult, 0, 0, f, rtl_math_StringFormat_G,
-        RTL_STR_MAX_VALUEOFFLOAT - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', 0, 0,
-        sal_True);
-    nLen = pResult->length;
-    OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFFLOAT);
-    rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
-    rtl_string_release(pResult);
-    return nLen;
-}
-
-sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
-{
-    rtl_String * pResult = NULL;
-    sal_Int32 nLen;
-    rtl_math_doubleToString(
-        &pResult, 0, 0, d, rtl_math_StringFormat_G,
-        RTL_STR_MAX_VALUEOFDOUBLE - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', 0,
-        0, sal_True);
-    nLen = pResult->length;
-    OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFDOUBLE);
-    rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
-    rtl_string_release(pResult);
-    return nLen;
-}
-
-float SAL_CALL rtl_str_toFloat(sal_Char const * pStr)
-{
-    return (float) rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
-                                           '.', 0, 0, 0);
-}
-
-double SAL_CALL rtl_str_toDouble(sal_Char const * pStr)
-{
-    return rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr), '.', 0,
-                                   0, 0);
-}
-
-/* ======================================================================= */
-
-static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
-{
-    int                 n;
-    sal_Unicode         c;
-    sal_uInt32          nUCS4Char;
-    const sal_Unicode*  pEndStr;
-
-    n = 0;
-    pEndStr  = pStr+nLen;
-    while ( pStr < pEndStr )
-    {
-        c = *pStr;
-
-        if ( c < 0x80 )
-            n++;
-        else if ( c < 0x800 )
-            n += 2;
-        else
-        {
-            if ( !SAL_RTL_IS_HIGH_SURROGATE(c) )
-                n += 3;
-            else
-            {
-                nUCS4Char = c;
-
-                if ( pStr+1 < pEndStr )
-                {
-                    c = *(pStr+1);
-                    if ( SAL_RTL_IS_LOW_SURROGATE(c) )
-                    {
-                        nUCS4Char = SAL_RTL_COMBINE_SURROGATES(nUCS4Char, c);
-                        pStr++;
-                    }
-                }
-
-                if ( nUCS4Char < 0x10000 )
-                    n += 3;
-                else if ( nUCS4Char < 0x200000 )
-                    n += 4;
-                else if ( nUCS4Char < 0x4000000 )
-                    n += 5;
-                else
-                    n += 6;
-            }
-        }
-
-        pStr++;
-    }
-
-    return n;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget,
-                                                  sal_Unicode const * pSource,
-                                                  sal_Int32 nLength,
-                                                  rtl_TextEncoding nEncoding,
-                                                  sal_uInt32 nFlags,
-                                                  sal_Bool bCheckErrors)
-{
-    OSL_ASSERT(pTarget != NULL
-               && (pSource != NULL || nLength == 0)
-               && nLength >= 0
-               && (nLength == 0 || rtl_isOctetTextEncoding(nEncoding)));
-
-    if ( !nLength )
-        rtl_string_new( pTarget );
-    else
-    {
-        rtl_String*                 pTemp;
-        rtl_UnicodeToTextConverter  hConverter;
-        sal_uInt32                  nInfo;
-        sal_Size                    nSrcChars;
-        sal_Size                    nDestBytes;
-        sal_Size                    nNewLen;
-        sal_Size                    nNotConvertedChars;
-        sal_Size                    nMaxCharLen;
-
-        /* Optimization for UTF-8 - we try to calculate the exact length */
-        /* For all other encoding we try an good estimation */
-        if ( nEncoding == RTL_TEXTENCODING_UTF8 )
-        {
-            nNewLen = rtl_ImplGetFastUTF8ByteLen( pSource, nLength );
-            /* Includes the string only ASCII, then we could copy
-               the buffer faster */
-            if ( nNewLen == (sal_Size)nLength )
-            {
-                IMPL_RTL_STRCODE* pBuffer;
-                if ( *pTarget )
-                    IMPL_RTL_STRINGNAME( release )( *pTarget );
-                *pTarget = IMPL_RTL_STRINGNAME( ImplAlloc )( nLength );
-                OSL_ASSERT(*pTarget != NULL);
-                pBuffer = (*pTarget)->buffer;
-                do
-                {
-                    /* Check ASCII range */
-                    OSL_ENSURE( *pSource <= 127,
-                                "rtl_uString2String() - UTF8 test is encoding is wrong" );
-
-                    *pBuffer = (IMPL_RTL_STRCODE)(unsigned char)*pSource;
-                    pBuffer++;
-                    pSource++;
-                    nLength--;
-                }
-                while ( nLength );
-                return sal_True;
-            }
-
-            nMaxCharLen = 4;
-        }
-        else
-        {
-            rtl_TextEncodingInfo aTextEncInfo;
-            aTextEncInfo.StructSize = sizeof( aTextEncInfo );
-            if ( !rtl_getTextEncodingInfo( nEncoding, &aTextEncInfo ) )
-            {
-                aTextEncInfo.AverageCharSize    = 1;
-                aTextEncInfo.MaximumCharSize    = 8;
-            }
-
-            nNewLen = nLength*aTextEncInfo.AverageCharSize;
-            nMaxCharLen = aTextEncInfo.MaximumCharSize;
-        }
-
-        nFlags |= RTL_UNICODETOTEXT_FLAGS_FLUSH;
-        hConverter = rtl_createUnicodeToTextConverter( nEncoding );
-
-        for (;;)
-        {
-            pTemp = IMPL_RTL_STRINGNAME( ImplAlloc )( nNewLen );
-            OSL_ASSERT(pTemp != NULL);
-            nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
-                                                   pSource, nLength,
-                                                   pTemp->buffer, nNewLen,
-                                                   nFlags,
-                                                   &nInfo, &nSrcChars );
-            if (bCheckErrors && (nInfo & RTL_UNICODETOTEXT_INFO_ERROR) != 0)
-            {
-                rtl_freeMemory(pTemp);
-                rtl_destroyUnicodeToTextConverter(hConverter);
-                return sal_False;
-            }
-
-            if ((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0)
-                break;
-
-            /* Buffer not big enough, try again with enough space */
-            rtl_freeMemory( pTemp );
-
-            /* Try with the max. count of characters with
-               additional overhead for replacing functionality */
-            nNotConvertedChars = nLength-nSrcChars;
-            nNewLen = nDestBytes+(nNotConvertedChars*nMaxCharLen)+nNotConvertedChars+4;
-        }
-
-        /* Set the buffer to the correct size or is there to
-           much overhead, reallocate to the correct size */
-        if ( nNewLen > nDestBytes+8 )
-        {
-            rtl_String* pTemp2 = IMPL_RTL_STRINGNAME( ImplAlloc )( nDestBytes );
-            OSL_ASSERT(pTemp2 != NULL);
-            rtl_str_ImplCopy( pTemp2->buffer, pTemp->buffer, nDestBytes );
-            rtl_freeMemory( pTemp );
-            pTemp = pTemp2;
-        }
-        else
-        {
-            pTemp->length = nDestBytes;
-            pTemp->buffer[nDestBytes] = 0;
-        }
-
-        rtl_destroyUnicodeToTextConverter( hConverter );
-        if ( *pTarget )
-            IMPL_RTL_STRINGNAME( release )( *pTarget );
-        *pTarget = pTemp;
-
-        /* Results the conversion in an empty buffer -
-           create an empty string */
-        if ( pTemp && !nDestBytes )
-            rtl_string_new( pTarget );
-    }
-    return sal_True;
-}
-
-void SAL_CALL rtl_uString2String( rtl_String** ppThis,
-                                  const sal_Unicode* pUStr,
-                                  sal_Int32 nULen,
-                                  rtl_TextEncoding eTextEncoding,
-                                  sal_uInt32 nCvtFlags )
-{
-    rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding,
-                                    nCvtFlags, sal_False);
-}
-
-sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget,
-                                             sal_Unicode const * pSource,
-                                             sal_Int32 nLength,
-                                             rtl_TextEncoding nEncoding,
-                                             sal_uInt32 nFlags)
-{
-    return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
-                                           nFlags, sal_True);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/string.cxx b/sal/rtl/source/string.cxx
new file mode 100644
index 0000000..c43b564
--- /dev/null
+++ b/sal/rtl/source/string.cxx
@@ -0,0 +1,327 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+#pragma warning(disable:4738) // storing 32-bit float result in memory, possible loss of performance
+#endif
+
+#include <rtl/memory.h>
+#include <osl/interlck.h>
+#include <rtl/alloc.h>
+#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
+
+#include "strimp.hxx"
+#include "surrogates.hxx"
+#include <rtl/string.h>
+
+#include "rtl/math.h"
+#include "rtl/tencinfo.h"
+
+/* ======================================================================= */
+
+/* static data to be referenced by all empty strings
+ * the refCount is predefined to 1 and must never become 0 !
+ */
+static rtl_String const aImplEmpty_rtl_String =
+{
+    SAL_STRING_STATIC_FLAG|1,
+            /* sal_Int32    refCount;   */
+    0,      /* sal_Int32    length;     */
+    { 0 }   /* sal_Char     buffer[1];  */
+};
+
+/* ======================================================================= */
+
+#define IMPL_RTL_STRCODE            sal_Char
+#define IMPL_RTL_USTRCODE( c )      ((unsigned char)c)
+#define IMPL_RTL_STRNAME( n )       rtl_str_ ## n
+
+#define IMPL_RTL_STRINGNAME( n )    rtl_string_ ## n
+#define IMPL_RTL_STRINGDATA         rtl_String
+#define IMPL_RTL_EMPTYSTRING        aImplEmpty_rtl_String
+
+/* ======================================================================= */
+
+/* Include String/UString template code */
+
+#include "strtmpl.cxx"
+
+sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * pStr, float f)
+    SAL_THROW_EXTERN_C()
+{
+    rtl_String * pResult = NULL;
+    sal_Int32 nLen;
+    rtl_math_doubleToString(
+        &pResult, 0, 0, f, rtl_math_StringFormat_G,
+        RTL_STR_MAX_VALUEOFFLOAT - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', 0, 0,
+        sal_True);
+    nLen = pResult->length;
+    OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFFLOAT);
+    rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
+    rtl_string_release(pResult);
+    return nLen;
+}
+
+sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
+    SAL_THROW_EXTERN_C()
+{
+    rtl_String * pResult = NULL;
+    sal_Int32 nLen;
+    rtl_math_doubleToString(
+        &pResult, 0, 0, d, rtl_math_StringFormat_G,
+        RTL_STR_MAX_VALUEOFDOUBLE - RTL_CONSTASCII_LENGTH("-x.E-xxx"), '.', 0,
+        0, sal_True);
+    nLen = pResult->length;
+    OSL_ASSERT(nLen < RTL_STR_MAX_VALUEOFDOUBLE);
+    rtl_copyMemory(pStr, pResult->buffer, (nLen + 1) * sizeof(sal_Char));
+    rtl_string_release(pResult);
+    return nLen;
+}
+
+float SAL_CALL rtl_str_toFloat(sal_Char const * pStr) SAL_THROW_EXTERN_C()
+{
+    return (float) rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
+                                           '.', 0, 0, 0);
+}
+
+double SAL_CALL rtl_str_toDouble(sal_Char const * pStr) SAL_THROW_EXTERN_C()
+{
+    return rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr), '.', 0,
+                                   0, 0);
+}
+
+/* ======================================================================= */
+
+static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
+{
+    int                 n;
+    sal_Unicode         c;
+    sal_uInt32          nUCS4Char;
+    const sal_Unicode*  pEndStr;
+
+    n = 0;
+    pEndStr  = pStr+nLen;
+    while ( pStr < pEndStr )
+    {
+        c = *pStr;
+
+        if ( c < 0x80 )
+            n++;
+        else if ( c < 0x800 )
+            n += 2;
+        else
+        {
+            if ( !SAL_RTL_IS_HIGH_SURROGATE(c) )
+                n += 3;
+            else
+            {
+                nUCS4Char = c;
+
+                if ( pStr+1 < pEndStr )
+                {
+                    c = *(pStr+1);
+                    if ( SAL_RTL_IS_LOW_SURROGATE(c) )
+                    {
+                        nUCS4Char = SAL_RTL_COMBINE_SURROGATES(nUCS4Char, c);
+                        pStr++;
+                    }
+                }
+
+                if ( nUCS4Char < 0x10000 )
+                    n += 3;
+                else if ( nUCS4Char < 0x200000 )
+                    n += 4;
+                else if ( nUCS4Char < 0x4000000 )
+                    n += 5;
+                else
+                    n += 6;
+            }
+        }
+
+        pStr++;
+    }
+
+    return n;
+}
+
+/* ----------------------------------------------------------------------- */
+
+sal_Bool SAL_CALL rtl_impl_convertUStringToString(rtl_String ** pTarget,
+                                                  sal_Unicode const * pSource,
+                                                  sal_Int32 nLength,
+                                                  rtl_TextEncoding nEncoding,
+                                                  sal_uInt32 nFlags,
+                                                  sal_Bool bCheckErrors)
+{
+    OSL_ASSERT(pTarget != NULL
+               && (pSource != NULL || nLength == 0)
+               && nLength >= 0
+               && (nLength == 0 || rtl_isOctetTextEncoding(nEncoding)));
+
+    if ( !nLength )
+        rtl_string_new( pTarget );
+    else
+    {
+        rtl_String*                 pTemp;
+        rtl_UnicodeToTextConverter  hConverter;
+        sal_uInt32                  nInfo;
+        sal_Size                    nSrcChars;
+        sal_Size                    nDestBytes;
+        sal_Size                    nNewLen;
+        sal_Size                    nNotConvertedChars;
+        sal_Size                    nMaxCharLen;
+
+        /* Optimization for UTF-8 - we try to calculate the exact length */
+        /* For all other encoding we try an good estimation */
+        if ( nEncoding == RTL_TEXTENCODING_UTF8 )
+        {
+            nNewLen = rtl_ImplGetFastUTF8ByteLen( pSource, nLength );
+            /* Includes the string only ASCII, then we could copy
+               the buffer faster */
+            if ( nNewLen == (sal_Size)nLength )
+            {
+                IMPL_RTL_STRCODE* pBuffer;
+                if ( *pTarget )
+                    IMPL_RTL_STRINGNAME( release )( *pTarget );
+                *pTarget = IMPL_RTL_STRINGNAME( ImplAlloc )( nLength );
+                OSL_ASSERT(*pTarget != NULL);
+                pBuffer = (*pTarget)->buffer;
+                do
+                {
+                    /* Check ASCII range */
+                    OSL_ENSURE( *pSource <= 127,
+                                "rtl_uString2String() - UTF8 test is encoding is wrong" );
+
+                    *pBuffer = (IMPL_RTL_STRCODE)(unsigned char)*pSource;
+                    pBuffer++;
+                    pSource++;
+                    nLength--;
+                }
+                while ( nLength );
+                return sal_True;
+            }
+
+            nMaxCharLen = 4;
+        }
+        else
+        {
+            rtl_TextEncodingInfo aTextEncInfo;
+            aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+            if ( !rtl_getTextEncodingInfo( nEncoding, &aTextEncInfo ) )
+            {
+                aTextEncInfo.AverageCharSize    = 1;
+                aTextEncInfo.MaximumCharSize    = 8;
+            }
+
+            nNewLen = nLength*aTextEncInfo.AverageCharSize;
+            nMaxCharLen = aTextEncInfo.MaximumCharSize;
+        }
+
+        nFlags |= RTL_UNICODETOTEXT_FLAGS_FLUSH;
+        hConverter = rtl_createUnicodeToTextConverter( nEncoding );
+
+        for (;;)
+        {
+            pTemp = IMPL_RTL_STRINGNAME( ImplAlloc )( nNewLen );
+            OSL_ASSERT(pTemp != NULL);
+            nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
+                                                   pSource, nLength,
+                                                   pTemp->buffer, nNewLen,
+                                                   nFlags,
+                                                   &nInfo, &nSrcChars );
+            if (bCheckErrors && (nInfo & RTL_UNICODETOTEXT_INFO_ERROR) != 0)
+            {
+                rtl_freeMemory(pTemp);
+                rtl_destroyUnicodeToTextConverter(hConverter);
+                return sal_False;
+            }
+
+            if ((nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) == 0)
+                break;
+
+            /* Buffer not big enough, try again with enough space */
+            rtl_freeMemory( pTemp );
+
+            /* Try with the max. count of characters with
+               additional overhead for replacing functionality */
+            nNotConvertedChars = nLength-nSrcChars;
+            nNewLen = nDestBytes+(nNotConvertedChars*nMaxCharLen)+nNotConvertedChars+4;
+        }
+
+        /* Set the buffer to the correct size or is there to
+           much overhead, reallocate to the correct size */
+        if ( nNewLen > nDestBytes+8 )
+        {
+            rtl_String* pTemp2 = IMPL_RTL_STRINGNAME( ImplAlloc )( nDestBytes );
+            OSL_ASSERT(pTemp2 != NULL);
+            rtl_str_ImplCopy( pTemp2->buffer, pTemp->buffer, nDestBytes );
+            rtl_freeMemory( pTemp );
+            pTemp = pTemp2;
+        }
+        else
+        {
+            pTemp->length = nDestBytes;
+            pTemp->buffer[nDestBytes] = 0;
+        }
+
+        rtl_destroyUnicodeToTextConverter( hConverter );
+        if ( *pTarget )
+            IMPL_RTL_STRINGNAME( release )( *pTarget );
+        *pTarget = pTemp;
+
+        /* Results the conversion in an empty buffer -
+           create an empty string */
+        if ( pTemp && !nDestBytes )
+            rtl_string_new( pTarget );
+    }
+    return sal_True;
+}
+
+void SAL_CALL rtl_uString2String( rtl_String** ppThis,
+                                  const sal_Unicode* pUStr,
+                                  sal_Int32 nULen,
+                                  rtl_TextEncoding eTextEncoding,
+                                  sal_uInt32 nCvtFlags )
+    SAL_THROW_EXTERN_C()
+{
+    rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding,
+                                    nCvtFlags, sal_False);
+}
+
+sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget,
+                                             sal_Unicode const * pSource,
+                                             sal_Int32 nLength,
+                                             rtl_TextEncoding nEncoding,
+                                             sal_uInt32 nFlags)
+    SAL_THROW_EXTERN_C()
+{
+    return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
+                                           nFlags, sal_True);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strtmpl.c b/sal/rtl/source/strtmpl.c
deleted file mode 100644
index 830521d..0000000
--- a/sal/rtl/source/strtmpl.c
+++ /dev/null
@@ -1,1567 +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.
- *
- ************************************************************************/
-
-/* ======================================================================= */
-/* Internal C-String help functions which could be used without the        */
-/* String-Class                                                            */
-/* ======================================================================= */
-
-#include <string.h>
-
-/*
-inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* pDest,
-                              const IMPL_RTL_STRCODE* pSrc,
-                              sal_Int32 nCount )
-{
-    while ( nCount > 0 )
-    {
-        *pDest = *pSrc;
-        pDest++;
-        pSrc++;
-        nCount--;
-    }
-}
-*/
-
-#define rtl_str_ImplCopy( _pDest, _pSrc, _nCount )                  \
-{                                                                   \
-    IMPL_RTL_STRCODE*       __mm_pDest      = _pDest;               \
-    const IMPL_RTL_STRCODE* __mm_pSrc       = _pSrc;                \
-    sal_Int32               __mm_nCount     = _nCount;              \
-    while ( __mm_nCount > 0 )                                       \
-    {                                                               \
-        *__mm_pDest = *__mm_pSrc;                                   \
-        __mm_pDest++;                                               \
-        __mm_pSrc++;                                                \
-        __mm_nCount--;                                              \
-    }                                                               \
-}
-
-/* ======================================================================= */
-/* C-String functions which could be used without the String-Class         */
-/* ======================================================================= */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
-{
-    const IMPL_RTL_STRCODE* pTempStr = pStr;
-    while( *pTempStr )
-        pTempStr++;
-    return pTempStr-pStr;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,
-                                                const IMPL_RTL_STRCODE* pStr2 )
-{
-    sal_Int32 nRet;
-    while ( ((nRet = ((sal_Int32)(IMPL_RTL_USTRCODE(*pStr1)))-
-                     ((sal_Int32)(IMPL_RTL_USTRCODE(*pStr2)))) == 0) &&
-            *pStr2 )
-    {
-        pStr1++;
-        pStr2++;
-    }
-
-    return nRet;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCODE* pStr1,
-                                                           sal_Int32 nStr1Len,
-                                                           const IMPL_RTL_STRCODE* pStr2,
-                                                           sal_Int32 nStr2Len )
-{
-    sal_Int32 nRet = nStr1Len - nStr2Len;
-    int nCount = (nRet <= 0) ? nStr1Len : nStr2Len;
-
-    --pStr1;
-    --pStr2;
-    while( (--nCount >= 0) && (*++pStr1 == *++pStr2) );
-
-    if( nCount >= 0 )
-        nRet = ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr1 )))
-             - ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr2 )));
-
-    return nRet;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompare_WithLength )( const IMPL_RTL_STRCODE* pStr1,
-                                                                    sal_Int32 nStr1Len,
-                                                                    const IMPL_RTL_STRCODE* pStr2,
-                                                                    sal_Int32 nStr2Len,
-                                                                    sal_Int32 nShortenedLength )
-{
-    const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
-    const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
-    sal_Int32               nRet;
-    while ( (nShortenedLength > 0) &&
-            (pStr1 < pStr1End) && (pStr2 < pStr2End) )
-    {
-        nRet = ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr1 )))-
-               ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr2 )));
-        if ( nRet )
-            return nRet;
-
-        nShortenedLength--;
-        pStr1++;
-        pStr2++;
-    }
-
-    if ( nShortenedLength <= 0 )
-        return 0;
-    return nStr1Len - nStr2Len;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( reverseCompare_WithLength )( const IMPL_RTL_STRCODE* pStr1,
-                                                                  sal_Int32 nStr1Len,
-                                                                  const IMPL_RTL_STRCODE* pStr2,
-                                                                  sal_Int32 nStr2Len )
-{
-    const IMPL_RTL_STRCODE* pStr1Run = pStr1+nStr1Len;
-    const IMPL_RTL_STRCODE* pStr2Run = pStr2+nStr2Len;
-    sal_Int32               nRet;
-    while ( (pStr1 < pStr1Run) && (pStr2 < pStr2Run) )
-    {
-        pStr1Run--;
-        pStr2Run--;
-        nRet = ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr1Run )))-
-               ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr2Run )));
-        if ( nRet )
-            return nRet;
-    }
-
-    return nStr1Len - nStr2Len;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase )( const IMPL_RTL_STRCODE* pStr1,
-                                                               const IMPL_RTL_STRCODE* pStr2 )
-{
-    sal_Int32   nRet;
-    sal_Int32   c1;
-    sal_Int32   c2;
-    do
-    {
-        /* If character between 'A' and 'Z', than convert it to lowercase */
-        c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
-        c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
-        if ( (c1 >= 65) && (c1 <= 90) )
-            c1 += 32;
-        if ( (c2 >= 65) && (c2 <= 90) )
-            c2 += 32;
-        nRet = c1-c2;
-        if ( nRet != 0 )
-            return nRet;
-
-        pStr1++;
-        pStr2++;
-    }
-    while ( c2 );
-
-    return 0;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase_WithLength )( const IMPL_RTL_STRCODE* pStr1,
-                                                                          sal_Int32 nStr1Len,
-                                                                          const IMPL_RTL_STRCODE* pStr2,
-                                                                          sal_Int32 nStr2Len )
-{
-    const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
-    const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
-    sal_Int32   nRet;
-    sal_Int32   c1;
-    sal_Int32   c2;
-    while ( (pStr1 < pStr1End) && (pStr2 < pStr2End) )
-    {
-        /* If character between 'A' and 'Z', than convert it to lowercase */
-        c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
-        c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
-        if ( (c1 >= 65) && (c1 <= 90) )
-            c1 += 32;
-        if ( (c2 >= 65) && (c2 <= 90) )
-            c2 += 32;
-        nRet = c1-c2;
-        if ( nRet != 0 )
-            return nRet;
-
-        pStr1++;
-        pStr2++;
-    }
-
-    return nStr1Len - nStr2Len;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompareIgnoreAsciiCase_WithLength )( const IMPL_RTL_STRCODE* pStr1,
-                                                                                   sal_Int32 nStr1Len,
-                                                                                   const IMPL_RTL_STRCODE* pStr2,
-                                                                                   sal_Int32 nStr2Len,
-                                                                                   sal_Int32 nShortenedLength )
-{
-    const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
-    const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
-    sal_Int32               nRet;
-    sal_Int32               c1;
-    sal_Int32               c2;
-    while ( (nShortenedLength > 0) &&
-            (pStr1 < pStr1End) && (pStr2 < pStr2End) )
-    {
-        /* If character between 'A' and 'Z', than convert it to lowercase */
-        c1 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr1 );
-        c2 = (sal_Int32)IMPL_RTL_USTRCODE( *pStr2 );
-        if ( (c1 >= 65) && (c1 <= 90) )
-            c1 += 32;
-        if ( (c2 >= 65) && (c2 <= 90) )
-            c2 += 32;
-        nRet = c1-c2;
-        if ( nRet != 0 )
-            return nRet;
-
-        nShortenedLength--;
-        pStr1++;
-        pStr2++;
-    }
-
-    if ( nShortenedLength <= 0 )
-        return 0;
-    return nStr1Len - nStr2Len;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode )( const IMPL_RTL_STRCODE* pStr )
-{
-    return IMPL_RTL_STRNAME( hashCode_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ) );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode_WithLength )( const IMPL_RTL_STRCODE* pStr,
-                                                            sal_Int32 nLen )
-{
-    sal_Int32 h = nLen;
-
-    if ( nLen < 256 )
-    {
-        while ( nLen > 0 )
-        {
-            h = (h*37) + IMPL_RTL_USTRCODE( *pStr );
-            pStr++;
-            nLen--;
-        }
-    }
-    else
-    {
-        sal_Int32               nSkip;
-        const IMPL_RTL_STRCODE* pEndStr = pStr+nLen-5;
-
-        /* only sample some characters */
-        /* the first 3, some characters between, and the last 5 */
-        h = (h*39) + IMPL_RTL_USTRCODE( *pStr );
-        pStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pStr );
-        pStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pStr );
-        pStr++;
-
-        if ( nLen < 32 )
-            nSkip = nLen / 4;
-        else
-            nSkip = nLen / 8;
-        nLen -= 8;
-        while ( nLen > 0 )
-        {
-            h = (h*39) + IMPL_RTL_USTRCODE( *pStr );
-            pStr += nSkip;
-            nLen -= nSkip;
-        }
-
-        h = (h*39) + IMPL_RTL_USTRCODE( *pEndStr );
-        pEndStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pEndStr );
-        pEndStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pEndStr );
-        pEndStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pEndStr );
-        pEndStr++;
-        h = (h*39) + IMPL_RTL_USTRCODE( *pEndStr );
-    }
-
-    return h;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr,
-                                                    IMPL_RTL_STRCODE c )
-{
-    const IMPL_RTL_STRCODE* pTempStr = pStr;
-    while ( *pTempStr )
-    {
-        if ( *pTempStr == c )
-            return pTempStr-pStr;
-
-        pTempStr++;
-    }
-
-    return -1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_STRCODE* pStr,
-                                                               sal_Int32 nLen,
-                                                               IMPL_RTL_STRCODE c )
-{
-    const IMPL_RTL_STRCODE* pTempStr = pStr;
-    while ( nLen > 0 )
-    {
-        if ( *pTempStr == c )
-            return pTempStr-pStr;
-
-        pTempStr++;
-        nLen--;
-    }
-
-    return -1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE* pStr,
-                                                        IMPL_RTL_STRCODE c )
-{
-    return IMPL_RTL_STRNAME( lastIndexOfChar_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ), c );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar_WithLength )( const IMPL_RTL_STRCODE* pStr,
-                                                                   sal_Int32 nLen,
-                                                                   IMPL_RTL_STRCODE c )
-{
-    pStr += nLen;
-    while ( nLen > 0 )
-    {
-        nLen--;
-        pStr--;
-
-        if ( *pStr == c )
-            return nLen;
-    }
-
-    return -1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr )( const IMPL_RTL_STRCODE* pStr,
-                                                   const IMPL_RTL_STRCODE* pSubStr )
-{
-    return IMPL_RTL_STRNAME( indexOfStr_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ),
-                                                      pSubStr, IMPL_RTL_STRNAME( getLength )( pSubStr ) );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr_WithLength )( const IMPL_RTL_STRCODE* pStr,
-                                                              sal_Int32 nStrLen,
-                                                              const  IMPL_RTL_STRCODE* pSubStr,
-                                                              sal_Int32 nSubLen )
-{
-    /* faster search for a single character */
-    if ( nSubLen < 2 )
-    {
-        /* an empty SubString is always not foundable */
-        if ( nSubLen == 1 )
-        {
-            IMPL_RTL_STRCODE        c = *pSubStr;
-            const IMPL_RTL_STRCODE* pTempStr = pStr;
-            while ( nStrLen > 0 )
-            {
-                if ( *pTempStr == c )
-                    return pTempStr-pStr;
-
-                pTempStr++;
-                nStrLen--;
-            }
-        }
-    }
-    else
-    {
-        const IMPL_RTL_STRCODE* pTempStr = pStr;
-        while ( nStrLen > 0 )
-        {
-            if ( *pTempStr == *pSubStr )
-            {
-                /* Compare SubString */
-                if ( nSubLen <= nStrLen )
-                {
-                    const IMPL_RTL_STRCODE* pTempStr1 = pTempStr;
-                    const IMPL_RTL_STRCODE* pTempStr2 = pSubStr;
-                    sal_Int32               nTempLen = nSubLen;
-                    while ( nTempLen )
-                    {
-                        if ( *pTempStr1 != *pTempStr2 )
-                            break;
-
-                        pTempStr1++;
-                        pTempStr2++;
-                        nTempLen--;
-                    }
-
-                    if ( !nTempLen )
-                        return pTempStr-pStr;
-                }
-                else
-                    break;
-            }
-
-            nStrLen--;
-            pTempStr++;
-        }
-    }
-
-    return -1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfStr )( const IMPL_RTL_STRCODE* pStr,
-                                                       const IMPL_RTL_STRCODE* pSubStr )
-{
-    return IMPL_RTL_STRNAME( lastIndexOfStr_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ),
-                                                          pSubStr, IMPL_RTL_STRNAME( getLength )( pSubStr ) );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfStr_WithLength )( const IMPL_RTL_STRCODE* pStr,
-                                                                  sal_Int32 nStrLen,
-                                                                  const IMPL_RTL_STRCODE* pSubStr,
-                                                                  sal_Int32 nSubLen )
-{
-    /* faster search for a single character */
-    if ( nSubLen < 2 )
-    {
-        /* an empty SubString is always not foundable */
-        if ( nSubLen == 1 )
-        {
-            IMPL_RTL_STRCODE c = *pSubStr;
-            pStr += nStrLen;
-            while ( nStrLen > 0 )
-            {
-                nStrLen--;
-                pStr--;
-
-                if ( *pStr == c )
-                    return nStrLen;
-            }
-        }
-    }
-    else
-    {
-        pStr += nStrLen;
-        nStrLen -= nSubLen;
-        pStr -= nSubLen;
-        while ( nStrLen >= 0 )
-        {
-            const IMPL_RTL_STRCODE* pTempStr1 = pStr;
-            const IMPL_RTL_STRCODE* pTempStr2 = pSubStr;
-            sal_Int32               nTempLen = nSubLen;
-            while ( nTempLen )
-            {
-                if ( *pTempStr1 != *pTempStr2 )
-                    break;
-
-                pTempStr1++;
-                pTempStr2++;
-                nTempLen--;
-            }
-
-            if ( !nTempLen )
-                return nStrLen;
-
-            nStrLen--;
-            pStr--;
-        }
-    }
-
-    return -1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( replaceChar )( IMPL_RTL_STRCODE* pStr,
-                                               IMPL_RTL_STRCODE cOld,
-                                               IMPL_RTL_STRCODE cNew )
-{
-    while ( *pStr )
-    {
-        if ( *pStr == cOld )
-            *pStr = cNew;
-
-        pStr++;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( replaceChar_WithLength )( IMPL_RTL_STRCODE* pStr,
-                                                          sal_Int32 nLen,
-                                                          IMPL_RTL_STRCODE cOld,
-                                                          IMPL_RTL_STRCODE cNew )
-{
-    while ( nLen > 0 )
-    {
-        if ( *pStr == cOld )
-            *pStr = cNew;
-
-        pStr++;
-        nLen--;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase )( IMPL_RTL_STRCODE* pStr )
-{
-    while ( *pStr )
-    {
-        /* Between A-Z (65-90), than to lowercase (+32) */
-        if ( (*pStr >= 65) && (*pStr <= 90) )
-            *pStr += 32;
-
-        pStr++;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase_WithLength )( IMPL_RTL_STRCODE* pStr,
-                                                               sal_Int32 nLen )
-{
-    while ( nLen > 0 )
-    {
-        /* Between A-Z (65-90), than to lowercase (+32) */
-        if ( (*pStr >= 65) && (*pStr <= 90) )
-            *pStr += 32;
-
-        pStr++;
-        nLen--;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase )( IMPL_RTL_STRCODE* pStr )
-{
-    while ( *pStr )
-    {
-        /* Between a-z (97-122), than to uppercase (-32) */
-        if ( (*pStr >= 97) && (*pStr <= 122) )
-            *pStr -= 32;
-
-        pStr++;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase_WithLength )( IMPL_RTL_STRCODE* pStr,
-                                                               sal_Int32 nLen )
-{
-    while ( nLen > 0 )
-    {
-        /* Between a-z (97-122), than to uppercase (-32) */
-        if ( (*pStr >= 97) && (*pStr <= 122) )
-            *pStr -= 32;
-
-        pStr++;
-        nLen--;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim )( IMPL_RTL_STRCODE* pStr )
-{
-    return IMPL_RTL_STRNAME( trim_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ) );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim_WithLength )( IMPL_RTL_STRCODE* pStr, sal_Int32 nLen )
-{
-    sal_Int32 nPreSpaces    = 0;
-    sal_Int32 nPostSpaces   = 0;
-    sal_Int32 nIndex        = nLen-1;
-
-    while ( (nPreSpaces < nLen) && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE(*(pStr+nPreSpaces)) ) )
-        nPreSpaces++;
-
-    while ( (nIndex > nPreSpaces) && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE(*(pStr+nIndex)) ) )
-    {
-        nPostSpaces++;
-        nIndex--;
-    }
-
-    if ( nPostSpaces )
-    {
-        nLen -= nPostSpaces;
-        *(pStr+nLen) = 0;
-    }
-
-    if ( nPreSpaces )
-    {
-        IMPL_RTL_STRCODE* pNewStr = pStr+nPreSpaces;
-
-        nLen -= nPreSpaces;
-        nIndex = nLen;
-
-        while ( nIndex )
-        {
-            *pStr = *pNewStr;
-            pStr++;
-            pNewStr++;
-            nIndex--;
-        }
-        *pStr = 0;
-    }
-
-    return nLen;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfBoolean )( IMPL_RTL_STRCODE* pStr, sal_Bool b )
-{
-    if ( b )
-    {
-        *pStr = 't';
-        pStr++;
-        *pStr = 'r';
-        pStr++;
-        *pStr = 'u';
-        pStr++;
-        *pStr = 'e';
-        pStr++;
-        *pStr = 0;
-        return 4;
-    }
-    else
-    {
-        *pStr = 'f';
-        pStr++;
-        *pStr = 'a';
-        pStr++;
-        *pStr = 'l';
-        pStr++;
-        *pStr = 's';
-        pStr++;
-        *pStr = 'e';
-        pStr++;
-        *pStr = 0;
-        return 5;
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfChar )( IMPL_RTL_STRCODE* pStr,
-                                                    IMPL_RTL_STRCODE c )
-{
-    *pStr++ = c;
-    *pStr = 0;
-    return 1;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt32 )( IMPL_RTL_STRCODE* pStr,
-                                                     sal_Int32 n,
-                                                     sal_Int16 nRadix )
-{
-    sal_Char    aBuf[RTL_STR_MAX_VALUEOFINT32];
-    sal_Char*   pBuf = aBuf;
-    sal_Int32   nLen = 0;
-    sal_uInt32  nValue;
-
-    /* Radix must be valid */
-    if ( (nRadix < RTL_STR_MIN_RADIX) || (nRadix > RTL_STR_MAX_RADIX) )
-        nRadix = 10;
-
-    /* is value negativ */
-    if ( n < 0 )
-    {
-        *pStr = '-';
-        pStr++;
-        nLen++;
-        nValue = -n; /* FIXME this code is not portable for n == -2147483648
-                        (smallest negative value for sal_Int32) */
-    }
-    else
-        nValue = n;
-
-    /* create a recursive buffer with all values, except the last one */
-    do
-    {
-        sal_Char nDigit = (sal_Char)(nValue % nRadix);
-        nValue /= nRadix;
-        if ( nDigit > 9 )
-            *pBuf = (nDigit-10) + 'a';
-        else
-            *pBuf = (nDigit + '0' );
-        pBuf++;
-    }
-    while ( nValue > 0 );
-
-    /* copy the values in the right direction into the destination buffer */
-    do
-    {
-        pBuf--;
-        *pStr = *pBuf;
-        pStr++;
-        nLen++;
-    }
-    while ( pBuf != aBuf );
-    *pStr = 0;
-
-    return nLen;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt64 )( IMPL_RTL_STRCODE* pStr,
-                                                     sal_Int64 n,
-                                                     sal_Int16 nRadix )
-{
-    sal_Char    aBuf[RTL_STR_MAX_VALUEOFINT64];
-    sal_Char*   pBuf = aBuf;
-    sal_Int32   nLen = 0;
-    sal_uInt64  nValue;
-
-    /* Radix must be valid */
-    if ( (nRadix < RTL_STR_MIN_RADIX) || (nRadix > RTL_STR_MAX_RADIX) )
-        nRadix = 10;
-
-    /* is value negativ */
-    if ( n < 0 )
-    {
-        *pStr = '-';
-        pStr++;
-        nLen++;
-        nValue = -n; /* FIXME this code is not portable for
-                        n == -9223372036854775808 (smallest negative value for
-                        sal_Int64) */
-    }
-    else
-        nValue = n;
-
-    /* create a recursive buffer with all values, except the last one */
-    do
-    {
-        sal_Char nDigit = (sal_Char)(nValue % nRadix);
-        nValue /= nRadix;
-        if ( nDigit > 9 )
-            *pBuf = (nDigit-10) + 'a';
-        else
-            *pBuf = (nDigit + '0' );
-        pBuf++;
-    }
-    while ( nValue > 0 );
-
-    /* copy the values in the right direction into the destination buffer */
-    do
-    {
-        pBuf--;
-        *pStr = *pBuf;
-        pStr++;
-        nLen++;
-    }
-    while ( pBuf != aBuf );
-    *pStr = 0;
-
-    return nLen;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Bool SAL_CALL IMPL_RTL_STRNAME( toBoolean )( const IMPL_RTL_STRCODE* pStr )
-{
-    if ( *pStr == '1' )
-        return sal_True;
-
-    if ( (*pStr == 'T') || (*pStr == 't') )
-    {
-        pStr++;
-        if ( (*pStr == 'R') || (*pStr == 'r') )
-        {
-            pStr++;
-            if ( (*pStr == 'U') || (*pStr == 'u') )
-            {
-                pStr++;
-                if ( (*pStr == 'E') || (*pStr == 'e') )
-                    return sal_True;
-            }
-        }
-    }
-
-    return sal_False;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRNAME( toInt32 )( const IMPL_RTL_STRCODE* pStr,
-                                                sal_Int16 nRadix )
-{
-    sal_Bool    bNeg;
-    sal_Int16   nDigit;
-    sal_Int32   n = 0;
-
-    if ( (nRadix < RTL_STR_MIN_RADIX) || (nRadix > RTL_STR_MAX_RADIX) )
-        nRadix = 10;
-
-    /* Skip whitespaces */
-    while ( *pStr && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE( *pStr ) ) )
-        pStr++;
-
-    if ( *pStr == '-' )
-    {
-        bNeg = sal_True;
-        pStr++;
-    }
-    else
-    {
-        if ( *pStr == '+' )
-            pStr++;
-        bNeg = sal_False;
-    }
-
-    while ( *pStr )
-    {
-        nDigit = rtl_ImplGetDigit( IMPL_RTL_USTRCODE( *pStr ), nRadix );
-        if ( nDigit < 0 )
-            break;
-
-        n *= nRadix;
-        n += nDigit;
-
-        pStr++;
-    }
-
-    if ( bNeg )
-        return -n;
-    else
-        return n;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64 )( const IMPL_RTL_STRCODE* pStr,
-                                                sal_Int16 nRadix )
-{
-    sal_Bool    bNeg;
-    sal_Int16   nDigit;
-    sal_Int64   n = 0;
-
-    if ( (nRadix < RTL_STR_MIN_RADIX) || (nRadix > RTL_STR_MAX_RADIX) )
-        nRadix = 10;
-
-    /* Skip whitespaces */
-    while ( *pStr && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE( *pStr ) ) )
-        pStr++;
-
-    if ( *pStr == '-' )
-    {
-        bNeg = sal_True;
-        pStr++;
-    }
-    else
-    {
-        if ( *pStr == '+' )
-            pStr++;
-        bNeg = sal_False;
-    }
-
-    while ( *pStr )
-    {
-        nDigit = rtl_ImplGetDigit( IMPL_RTL_USTRCODE( *pStr ), nRadix );
-        if ( nDigit < 0 )
-            break;
-
-        n *= nRadix;
-        n += nDigit;
-
-        pStr++;
-    }
-
-    if ( bNeg )
-        return -n;
-    else
-        return n;
-}
-
-/* ======================================================================= */
-/* Internal String-Class help functions                                    */
-/* ======================================================================= */
-
-static IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )( sal_Int32 nLen )
-{
-    IMPL_RTL_STRINGDATA * pData
-        = (SAL_INT_CAST(sal_uInt32, nLen)
-           <= ((SAL_MAX_UINT32 - sizeof (IMPL_RTL_STRINGDATA))
-               / sizeof (IMPL_RTL_STRCODE)))
-        ? (IMPL_RTL_STRINGDATA *) rtl_allocateMemory(
-            sizeof (IMPL_RTL_STRINGDATA) + nLen * sizeof (IMPL_RTL_STRCODE))
-        : NULL;
-    if (pData != NULL) {
-        pData->refCount = 1;
-        pData->length = nLen;
-        pData->buffer[nLen] = 0;
-    }
-    return pData;
-}
-
-/* ----------------------------------------------------------------------- */
-
-static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy )( IMPL_RTL_STRINGDATA** ppThis,
-                                                             IMPL_RTL_STRINGDATA* pStr,
-                                                             sal_Int32 nCount )
-{
-    IMPL_RTL_STRCODE*       pDest;
-    const IMPL_RTL_STRCODE* pSrc;
-    IMPL_RTL_STRINGDATA*    pData = IMPL_RTL_STRINGNAME( ImplAlloc )( pStr->length );
-    OSL_ASSERT(pData != NULL);
-
-    pDest   = pData->buffer;
-    pSrc    = pStr->buffer;
-    while ( nCount > 0 )
-    {
-        *pDest = *pSrc;
-        pDest++;
-        pSrc++;
-        nCount--;
-    }
-
-    *ppThis = pData;
-    return pDest;
-}
-
-/* ======================================================================= */
-/* String-Class functions                                                  */
-/* ======================================================================= */
-
-#define IMPL_RTL_AQUIRE( pThis )                                \
-{                                                               \
-    if (!SAL_STRING_IS_STATIC (pThis))                          \
-        osl_incrementInterlockedCount( &((pThis)->refCount) );  \
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( acquire )( IMPL_RTL_STRINGDATA* pThis )
-{
-    IMPL_RTL_AQUIRE( pThis );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
-{
-    if (SAL_STRING_IS_STATIC (pThis))
-        return;
-
-/* OString doesn't have an 'intern' */
-#ifdef IMPL_RTL_INTERN
-    if (SAL_STRING_IS_INTERN (pThis))
-    {
-        internRelease (pThis);
-        return;
-    }
-#endif
-
-    if ( pThis->refCount == 1 ||
-         !osl_decrementInterlockedCount( &(pThis->refCount) ) )
-    {
-        rtl_freeMemory( pThis );
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( new )( IMPL_RTL_STRINGDATA** ppThis )
-{
-    if ( *ppThis)
-        IMPL_RTL_STRINGNAME( release )( *ppThis );
-
-    *ppThis = (IMPL_RTL_STRINGDATA*) (&IMPL_RTL_EMPTYSTRING);
-    IMPL_RTL_AQUIRE( *ppThis );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( new_WithLength )( IMPL_RTL_STRINGDATA** ppThis, sal_Int32 nLen )
-{
-    if ( nLen <= 0 )
-        IMPL_RTL_STRINGNAME( new )( ppThis );
-    else
-    {
-        if ( *ppThis)
-            IMPL_RTL_STRINGNAME( release )( *ppThis );
-
-        *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-        OSL_ASSERT(*ppThis != NULL);
-        (*ppThis)->length   = 0;
-
-        {
-        IMPL_RTL_STRCODE* pTempStr = (*ppThis)->buffer;
-        memset(pTempStr, 0, nLen*sizeof(IMPL_RTL_STRCODE));
-        }
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newFromString )( IMPL_RTL_STRINGDATA** ppThis,
-                                                    const IMPL_RTL_STRINGDATA* pStr )
-{
-    IMPL_RTL_STRINGDATA* pOrg;
-
-    if ( !pStr->length )
-    {
-        IMPL_RTL_STRINGNAME( new )( ppThis );
-        return;
-    }
-
-    pOrg = *ppThis;
-    *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( pStr->length );
-    OSL_ASSERT(*ppThis != NULL);
-    rtl_str_ImplCopy( (*ppThis)->buffer, pStr->buffer, pStr->length );
-
-    /* must be done at least, if pStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( IMPL_RTL_STRINGDATA** ppThis,
-                                                 const IMPL_RTL_STRCODE* pCharStr )
-{
-    IMPL_RTL_STRCODE*       pBuffer;
-    IMPL_RTL_STRINGDATA*    pOrg;
-    sal_Int32               nLen;
-
-    if ( pCharStr )
-    {
-        const IMPL_RTL_STRCODE* pTempStr = pCharStr;
-        while( *pTempStr )
-            pTempStr++;
-        nLen = pTempStr-pCharStr;
-    }
-    else
-        nLen = 0;
-
-    if ( !nLen )
-    {
-        IMPL_RTL_STRINGNAME( new )( ppThis );
-        return;
-    }
-
-    pOrg = *ppThis;
-    *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-    OSL_ASSERT(*ppThis != NULL);
-    pBuffer = (*ppThis)->buffer;
-    do
-    {
-        *pBuffer = *pCharStr;
-        pBuffer++;
-        pCharStr++;
-    }
-    while ( *pCharStr );
-
-    /* must be done at least, if pCharStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr_WithLength )( IMPL_RTL_STRINGDATA** ppThis,
-                                                            const IMPL_RTL_STRCODE* pCharStr,
-                                                            sal_Int32 nLen )
-{
-    IMPL_RTL_STRINGDATA* pOrg;
-
-    if ( !pCharStr || (nLen <= 0) )
-    {
-        IMPL_RTL_STRINGNAME( new )( ppThis );
-        return;
-    }
-
-    pOrg = *ppThis;
-    *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-    OSL_ASSERT(*ppThis != NULL);
-    rtl_str_ImplCopy( (*ppThis)->buffer, pCharStr, nLen );
-
-    /* must be done at least, if pCharStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( assign )( IMPL_RTL_STRINGDATA** ppThis,
-                                             IMPL_RTL_STRINGDATA* pStr )
-{
-    /* must be done at first, if pStr == *ppThis */
-    IMPL_RTL_AQUIRE( pStr );
-
-    if ( *ppThis )
-        IMPL_RTL_STRINGNAME( release )( *ppThis );
-
-    *ppThis = pStr;
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRINGNAME( getLength )( const IMPL_RTL_STRINGDATA* pThis )
-{
-    return pThis->length;
-}
-
-/* ----------------------------------------------------------------------- */
-
-IMPL_RTL_STRCODE* SAL_CALL IMPL_RTL_STRINGNAME( getStr )( IMPL_RTL_STRINGDATA * pThis )
-{
-    return pThis->buffer;
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newConcat )( IMPL_RTL_STRINGDATA** ppThis,
-                                                IMPL_RTL_STRINGDATA* pLeft,
-                                                IMPL_RTL_STRINGDATA* pRight )
-{
-    IMPL_RTL_STRINGDATA* pOrg = *ppThis;
-
-    /* Test for 0-Pointer - if not, change newReplaceStrAt! */
-    if ( !pRight || !pRight->length )
-    {
-        *ppThis = pLeft;
-        IMPL_RTL_AQUIRE( pLeft );
-    }
-    else if ( !pLeft || !pLeft->length )
-    {
-        *ppThis = pRight;
-        IMPL_RTL_AQUIRE( pRight );
-    }
-    else
-    {
-        IMPL_RTL_STRINGDATA* pTempStr = IMPL_RTL_STRINGNAME( ImplAlloc )( pLeft->length + pRight->length );
-        OSL_ASSERT(pTempStr != NULL);
-        rtl_str_ImplCopy( pTempStr->buffer, pLeft->buffer, pLeft->length );
-        rtl_str_ImplCopy( pTempStr->buffer+pLeft->length, pRight->buffer, pRight->length );
-        *ppThis = pTempStr;
-    }
-
-    /* must be done at least, if left or right == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newReplaceStrAt )( IMPL_RTL_STRINGDATA** ppThis,
-                                                      IMPL_RTL_STRINGDATA* pStr,
-                                                      sal_Int32 nIndex,
-                                                      sal_Int32 nCount,
-                                                      IMPL_RTL_STRINGDATA* pNewSubStr )
-{
-    /* Append? */
-    if ( nIndex >= pStr->length )
-    {
-        /* newConcat test, if pNewSubStr is 0 */
-        IMPL_RTL_STRINGNAME( newConcat )( ppThis, pStr, pNewSubStr );
-        return;
-    }
-
-    /* negativ index? */
-    if ( nIndex < 0 )
-    {
-        nCount -= nIndex;
-        nIndex = 0;
-    }
-
-    /* not more than the String length could be deleted */
-    if ( nCount >= pStr->length-nIndex )
-    {
-        nCount = pStr->length-nIndex;
-
-        /* Assign of NewSubStr? */
-        if ( !nIndex && (nCount >= pStr->length) )
-        {
-            if ( !pNewSubStr )
-                IMPL_RTL_STRINGNAME( new )( ppThis );
-            else
-                IMPL_RTL_STRINGNAME( assign )( ppThis, pNewSubStr );
-            return;
-        }
-    }
-
-    /* Assign of Str? */
-    if ( !nCount && (!pNewSubStr || !pNewSubStr->length) )
-    {
-        IMPL_RTL_STRINGNAME( assign )( ppThis, pStr );
-        return;
-    }
-
-    {
-    IMPL_RTL_STRINGDATA*    pOrg = *ppThis;
-    IMPL_RTL_STRCODE*       pBuffer;
-    sal_Int32               nNewLen;
-
-    /* Calculate length of the new string */
-    nNewLen = pStr->length-nCount;
-    if ( pNewSubStr )
-        nNewLen += pNewSubStr->length;
-
-    /* Alloc New Buffer */
-    *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nNewLen );
-    OSL_ASSERT(*ppThis != NULL);
-    pBuffer = (*ppThis)->buffer;
-    if ( nIndex )
-    {
-        rtl_str_ImplCopy( pBuffer, pStr->buffer, nIndex );
-        pBuffer += nIndex;
-    }
-    if ( pNewSubStr && pNewSubStr->length )
-    {
-        rtl_str_ImplCopy( pBuffer, pNewSubStr->buffer, pNewSubStr->length );
-        pBuffer += pNewSubStr->length;
-    }
-    rtl_str_ImplCopy( pBuffer, pStr->buffer+nIndex+nCount, pStr->length-nIndex-nCount );
-
-    /* must be done at least, if pStr or pNewSubStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-    }
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newReplace )( IMPL_RTL_STRINGDATA** ppThis,
-                                                 IMPL_RTL_STRINGDATA* pStr,
-                                                 IMPL_RTL_STRCODE cOld,
-                                                 IMPL_RTL_STRCODE cNew )
-{
-    IMPL_RTL_STRINGDATA*    pOrg        = *ppThis;
-    int                     bChanged    = 0;
-    sal_Int32               nLen        = pStr->length;
-    const IMPL_RTL_STRCODE* pCharStr    = pStr->buffer;
-
-    while ( nLen > 0 )
-    {
-        if ( *pCharStr == cOld )
-        {
-            /* Copy String */
-            IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
-
-            /* replace/copy rest of the string */
-            if ( pNewCharStr )
-            {
-                *pNewCharStr = cNew;
-                pNewCharStr++;
-                pCharStr++;
-                nLen--;
-
-                while ( nLen > 0 )
-                {
-                    if ( *pCharStr == cOld )
-                        *pNewCharStr = cNew;
-                    else
-                        *pNewCharStr = *pCharStr;
-
-                    pNewCharStr++;
-                    pCharStr++;
-                    nLen--;
-                }
-            }
-
-            bChanged = 1;
-            break;
-        }
-
-        pCharStr++;
-        nLen--;
-    }
-
-    if ( !bChanged )
-    {
-        *ppThis = pStr;
-        IMPL_RTL_AQUIRE( pStr );
-    }
-
-    /* must be done at least, if pStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA** ppThis,
-                                                          IMPL_RTL_STRINGDATA* pStr )
-{
-    IMPL_RTL_STRINGDATA*    pOrg        = *ppThis;
-    int                     bChanged    = 0;
-    sal_Int32               nLen        = pStr->length;
-    const IMPL_RTL_STRCODE* pCharStr    = pStr->buffer;
-
-    while ( nLen > 0 )
-    {
-        /* Between A-Z (65-90), than to lowercase (+32) */
-        if ( (*pCharStr >= 65) && (*pCharStr <= 90) )
-        {
-            /* Copy String */
-            IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
-
-            /* replace/copy rest of the string */
-            if ( pNewCharStr )
-            {
-                /* to lowercase (+32) */
-                *pNewCharStr = *pCharStr+32;
-                pNewCharStr++;
-                pCharStr++;
-                nLen--;
-
-                while ( nLen > 0 )
-                {
-                    /* Between A-Z (65-90), than to lowercase (+32) */
-                    if ( (*pCharStr >= 65) && (*pCharStr <= 90) )
-                        *pNewCharStr = *pCharStr+32;
-                    else
-                        *pNewCharStr = *pCharStr;
-
-                    pNewCharStr++;
-                    pCharStr++;
-                    nLen--;
-                }
-            }
-
-            bChanged = 1;
-            break;
-        }
-
-        pCharStr++;
-        nLen--;
-    }
-
-    if ( !bChanged )
-    {
-        *ppThis = pStr;
-        IMPL_RTL_AQUIRE( pStr );
-    }
-
-    /* must be done at least, if pStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA** ppThis,
-                                                          IMPL_RTL_STRINGDATA* pStr )
-{
-    IMPL_RTL_STRINGDATA*    pOrg        = *ppThis;
-    int                     bChanged    = 0;
-    sal_Int32               nLen        = pStr->length;
-    const IMPL_RTL_STRCODE* pCharStr    = pStr->buffer;
-
-    while ( nLen > 0 )
-    {
-        /* Between a-z (97-122), than to uppercase (-32) */
-        if ( (*pCharStr >= 97) && (*pCharStr <= 122) )
-        {
-            /* Copy String */
-            IMPL_RTL_STRCODE* pNewCharStr = IMPL_RTL_STRINGNAME( ImplNewCopy )( ppThis, pStr, pCharStr-pStr->buffer );
-
-            /* replace/copy rest of the string */
-            if ( pNewCharStr )
-            {
-                /* to uppercase (-32) */
-                *pNewCharStr = *pCharStr-32;
-                pNewCharStr++;
-                pCharStr++;
-                nLen--;
-
-                while ( nLen > 0 )
-                {
-                    /* Between a-z (97-122), than to uppercase (-32) */
-                    if ( (*pCharStr >= 97) && (*pCharStr <= 122) )
-                        *pNewCharStr = *pCharStr-32;
-                    else
-                        *pNewCharStr = *pCharStr;
-
-                    pNewCharStr++;
-                    pCharStr++;
-                    nLen--;
-                }
-            }
-
-            bChanged = 1;
-            break;
-        }
-
-        pCharStr++;
-        nLen--;
-    }
-
-    if ( !bChanged )
-    {
-        *ppThis = pStr;
-        IMPL_RTL_AQUIRE( pStr );
-    }
-
-    /* must be done at least, if pStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-void SAL_CALL IMPL_RTL_STRINGNAME( newTrim )( IMPL_RTL_STRINGDATA** ppThis,
-                                              IMPL_RTL_STRINGDATA* pStr )
-{
-    IMPL_RTL_STRINGDATA*    pOrg        = *ppThis;
-    const IMPL_RTL_STRCODE* pCharStr    = pStr->buffer;
-    sal_Int32               nPreSpaces  = 0;
-    sal_Int32               nPostSpaces = 0;
-    sal_Int32               nLen        = pStr->length;
-    sal_Int32               nIndex      = nLen-1;
-
-    while ( (nPreSpaces < nLen) && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE(*(pCharStr+nPreSpaces)) ) )
-        nPreSpaces++;
-
-    while ( (nIndex > nPreSpaces) && rtl_ImplIsWhitespace( IMPL_RTL_USTRCODE(*(pCharStr+nIndex)) ) )
-    {
-        nPostSpaces++;
-        nIndex--;
-    }
-
-    if ( !nPreSpaces && !nPostSpaces )
-    {
-        *ppThis = pStr;
-        IMPL_RTL_AQUIRE( pStr );
-    }
-    else
-    {
-        nLen -= nPostSpaces+nPreSpaces;
-        *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen );
-        OSL_ASSERT(*ppThis != NULL);
-        if ( *ppThis )
-            rtl_str_ImplCopy( (*ppThis)->buffer, pStr->buffer+nPreSpaces, nLen );
-    }
-
-    /* must be done at least, if pStr == *ppThis */
-    if ( pOrg )
-        IMPL_RTL_STRINGNAME( release )( pOrg );
-}
-
-/* ----------------------------------------------------------------------- */
-
-sal_Int32 SAL_CALL IMPL_RTL_STRINGNAME( getToken )( IMPL_RTL_STRINGDATA** ppThis,
-                                                    IMPL_RTL_STRINGDATA* pStr,
-                                                    sal_Int32 nToken,
-                                                    IMPL_RTL_STRCODE cTok,
-                                                    sal_Int32 nIndex )
-{
-    const IMPL_RTL_STRCODE* pCharStr        = pStr->buffer;
-    const IMPL_RTL_STRCODE* pCharStrStart;
-    const IMPL_RTL_STRCODE* pOrgCharStr;
-    sal_Int32               nLen            = pStr->length-nIndex;
-    sal_Int32               nTokCount       = 0;
-
-    // Set ppThis to an empty string and return -1 if either nToken or nIndex is
-    // negative:
-    if (nIndex < 0) {
-        nToken = -1;
-    }
-
-    pCharStr += nIndex;
-    pOrgCharStr = pCharStr;
-    pCharStrStart = pCharStr;
-    while ( nLen > 0 )
-    {
-        if ( *pCharStr == cTok )
-        {
-            nTokCount++;
-
-            if ( nTokCount == nToken )
-                pCharStrStart = pCharStr+1;
-            else
-            {
-                if ( nTokCount > nToken )
-                    break;
-            }
-        }
-
-        pCharStr++;
-        nLen--;
-    }
-
-    if ( (nToken < 0) || (nTokCount < nToken) || (pCharStr == pCharStrStart) )
-    {
-        IMPL_RTL_STRINGNAME( new )( ppThis );
-        if( (nToken < 0) || (nTokCount < nToken ) )
-            return -1;
-        else if( nLen > 0 )
-            return nIndex+(pCharStr-pOrgCharStr)+1;
-        else return -1;
-    }
-    else
-    {
-        IMPL_RTL_STRINGNAME( newFromStr_WithLength )( ppThis, pCharStrStart, pCharStr-pCharStrStart );
-        if ( nLen )
-            return nIndex+(pCharStr-pOrgCharStr)+1;
-        else
-            return -1;
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/source/strtmpl.cxx b/sal/rtl/source/strtmpl.cxx
new file mode 100644
index 0000000..93f9133
--- /dev/null
+++ b/sal/rtl/source/strtmpl.cxx
@@ -0,0 +1,1617 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+/* ======================================================================= */
+/* Internal C-String help functions which could be used without the        */
+/* String-Class                                                            */
+/* ======================================================================= */
+
+#include <string.h>
+
+/*
+inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* pDest,
+                              const IMPL_RTL_STRCODE* pSrc,
+                              sal_Int32 nCount )
+{
+    while ( nCount > 0 )
+    {
+        *pDest = *pSrc;
+        pDest++;
+        pSrc++;
+        nCount--;
+    }
+}
+*/
+
+#define rtl_str_ImplCopy( _pDest, _pSrc, _nCount )                  \
+{                                                                   \
+    IMPL_RTL_STRCODE*       __mm_pDest      = _pDest;               \
+    const IMPL_RTL_STRCODE* __mm_pSrc       = _pSrc;                \
+    sal_Int32               __mm_nCount     = _nCount;              \
+    while ( __mm_nCount > 0 )                                       \
+    {                                                               \
+        *__mm_pDest = *__mm_pSrc;                                   \
+        __mm_pDest++;                                               \
+        __mm_pSrc++;                                                \
+        __mm_nCount--;                                              \
+    }                                                               \
+}
+
+/* ======================================================================= */
+/* C-String functions which could be used without the String-Class         */
+/* ======================================================================= */
+
+sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
+    SAL_THROW_EXTERN_C()
+{
+    const IMPL_RTL_STRCODE* pTempStr = pStr;
+    while( *pTempStr )
+        pTempStr++;
+    return pTempStr-pStr;
+}
+
+/* ----------------------------------------------------------------------- */
+
+sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list