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

Caolán McNamara caolanm at redhat.com
Tue Oct 22 01:14:40 PDT 2013


 include/tools/string.hxx        |    1 
 tools/source/rc/rc.cxx          |   44 +++++++++++++++++++++++++++
 tools/source/string/strucvt.cxx |   63 ----------------------------------------
 3 files changed, 43 insertions(+), 65 deletions(-)

New commits:
commit 5d9889070846e2e0d1d836ecf867590ebee7c027
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 21 19:57:45 2013 +0100

    move ResId::toString
    
    Change-Id: I287a92de9ae30255990595263c3302d753fdbccf

diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx
index af2cc3d..f3e966d 100644
--- a/tools/source/rc/rc.cxx
+++ b/tools/source/rc/rc.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <string.h>
-
+#include <rtl/ustrbuf.hxx>
 #include <tools/date.hxx>
 #include <tools/time.hxx>
 #include <tools/rc.hxx>
@@ -78,4 +78,46 @@ Date::Date( const ResId& rResId ) : nDate(0)
         SetDay( (sal_uInt16)pResMgr->ReadShort() );
 }
 
+OUString ResId::toString() const
+{
+    SetRT( RSC_STRING );
+    ResMgr* pResMgr = GetResMgr();
+
+    if ( !pResMgr || !pResMgr->GetResource( *this ) )
+    {
+        OUString sRet;
+
+#if OSL_DEBUG_LEVEL > 0
+        sRet = OUStringBuffer().
+            append("<resource id ").
+            append(static_cast<sal_Int32>(GetId())).
+            append(" not found>").
+            makeStringAndClear();
+#endif
+
+        if( pResMgr )
+            pResMgr->PopContext();
+
+        return sRet;
+    }
+
+    // String loading
+    RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
+
+    sal_Int32 nStringLen = rtl_str_getLength( (char*)(pResHdr+1) );
+    OUString sRet((const char*)(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
+
+    sal_uInt32 nSize = sizeof( RSHEADER_TYPE )
+        + sal::static_int_cast< sal_uInt32 >(nStringLen) + 1;
+    nSize += nSize % 2;
+    pResMgr->Increment( nSize );
+
+    ResHookProc pImplResHookProc = ResMgr::GetReadStringHook();
+    if ( pImplResHookProc )
+        sRet = pImplResHookProc(sRet);
+    return sRet;
+}
+
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx
index be8c72d..916eb04 100644
--- a/tools/source/string/strucvt.cxx
+++ b/tools/source/string/strucvt.cxx
@@ -55,48 +55,4 @@ UniString& UniString::Assign( const OUString& rStr )
     return *this;
 }
 
-#include <rtl/ustrbuf.hxx>
-#include <tools/rc.hxx>
-#include <tools/rcid.h>
-
-OUString ResId::toString() const
-{
-    SetRT( RSC_STRING );
-    ResMgr* pResMgr = GetResMgr();
-
-    if ( !pResMgr || !pResMgr->GetResource( *this ) )
-    {
-        OUString sRet;
-
-#if OSL_DEBUG_LEVEL > 0
-        sRet = OUStringBuffer().
-            append("<resource id ").
-            append(static_cast<sal_Int32>(GetId())).
-            append(" not found>").
-            makeStringAndClear();
-#endif
-
-        if( pResMgr )
-            pResMgr->PopContext();
-
-        return sRet;
-    }
-
-    // String loading
-    RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
-
-    sal_Int32 nStringLen = rtl_str_getLength( (char*)(pResHdr+1) );
-    OUString sRet((const char*)(pResHdr+1), nStringLen, RTL_TEXTENCODING_UTF8);
-
-    sal_uInt32 nSize = sizeof( RSHEADER_TYPE )
-        + sal::static_int_cast< sal_uInt32 >(nStringLen) + 1;
-    nSize += nSize % 2;
-    pResMgr->Increment( nSize );
-
-    ResHookProc pImplResHookProc = ResMgr::GetReadStringHook();
-    if ( pImplResHookProc )
-        sRet = pImplResHookProc(sRet);
-    return sRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit b2e954e300f51120387a55bf237cafdcd40ed7e6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 21 19:56:01 2013 +0100

    Related: fdo#38838 remove UniString::UniString(const ResId&)
    
    Change-Id: Id881fe3f9c7c89a7bcc1a5d8f653e18494ffa913

diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index 3933595..9efa5d7 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -101,7 +101,6 @@ private:
     UniString&          Append( const UniString& rStr );
 public:
                         UniString();
-                        UniString( const ResId& rResId );
                         UniString( const UniString& rStr );
                         UniString( const OUString& rStr );
                        ~UniString();
diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx
index 9ed5a20..be8c72d 100644
--- a/tools/source/string/strucvt.cxx
+++ b/tools/source/string/strucvt.cxx
@@ -59,25 +59,6 @@ UniString& UniString::Assign( const OUString& rStr )
 #include <tools/rc.hxx>
 #include <tools/rcid.h>
 
-UniString::UniString( const ResId& rResId )
-    : mpData(NULL)
-{
-    OUString sStr(rResId.toString());
-
-    OSL_ENSURE(sStr.pData->length < STRING_MAXLEN,
-               "Overflowing OUString -> UniString cut to zero length");
-
-    if (sStr.pData->length < STRING_MAXLEN)
-    {
-        mpData = reinterpret_cast< UniStringData * >(sStr.pData);
-        STRING_ACQUIRE((STRING_TYPE *)mpData);
-    }
-    else
-    {
-        STRING_NEW((STRING_TYPE **)&mpData);
-    }
-}
-
 OUString ResId::toString() const
 {
     SetRT( RSC_STRING );


More information about the Libreoffice-commits mailing list