[Libreoffice-commits] .: 6 commits - idl/Executable_svidl.mk idl/inc idl/source sal/rtl svtools/source tools/inc tools/source unusedcode.easy

Caolán McNamara caolan at kemper.freedesktop.org
Tue Aug 9 01:33:09 PDT 2011


 idl/Executable_svidl.mk           |    1 
 idl/inc/char.hxx                  |   43 ----------------
 idl/inc/lex.hxx                   |    5 -
 idl/source/cmptools/char.cxx      |  102 --------------------------------------
 idl/source/cmptools/lex.cxx       |   14 -----
 sal/rtl/source/alloc_arena.c      |    4 +
 svtools/source/filter/sgvtext.cxx |   11 ++--
 tools/inc/tools/string.hxx        |   12 +---
 tools/source/string/strcvt.cxx    |   57 +++------------------
 unusedcode.easy                   |    2 
 10 files changed, 22 insertions(+), 229 deletions(-)

New commits:
commit 61185cbaa1feb48d4cfaba509a7805b9f1da5be2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 9 09:31:59 2011 +0100

    reduce unused list

diff --git a/unusedcode.easy b/unusedcode.easy
index d7bdd0a..3317327 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -2643,7 +2643,6 @@ binfilter::Sw3Bytes::Insert(binfilter::Sw3Bytes const*, unsigned short, unsigned
 binfilter::Sw3Bytes::Replace(unsigned char const&, unsigned short)
 binfilter::Sw3Bytes::Replace(unsigned char const*, unsigned short, unsigned short)
 binfilter::Sw3Bytes::_ForEach(unsigned short, unsigned short, unsigned char (*)(unsigned char const&, void*), void*)
-binfilter::Sw3IoImp::OutRedline(binfilter::SwRedline const&)
 binfilter::Sw3Marks::GetPos(binfilter::Sw3Mark const*) const
 binfilter::Sw3Marks::Insert(binfilter::Sw3Mark*)
 binfilter::Sw3Marks::Remove(binfilter::Sw3Mark*)
@@ -2681,7 +2680,6 @@ binfilter::SwDestroyList::Insert(binfilter::SwSectionFrm* const&, unsigned short
 binfilter::SwDestroyList::Insert(binfilter::SwSectionFrm* const*, unsigned short)
 binfilter::SwDestroyList::Remove(binfilter::SwSectionFrm* const&, unsigned short)
 binfilter::SwDoc::Replace(binfilter::SwPaM&, String const&, unsigned char)
-binfilter::SwGrfNode::SaveCompleted(unsigned char)
 binfilter::SwOLELRUCache::Remove(binfilter::SwOLEObj&)
 binfilter::SwOutlineNodes::Insert(binfilter::SwNode* const&, unsigned short&)
 binfilter::SwOutlineNodes::Insert(binfilter::SwNode* const*, unsigned short)
commit 07c1881b18bf8b6abdf976e3bdb564945d313a6c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 9 09:31:29 2011 +0100

    ConvertFromUnicode can be made private
    
    and default argument can be removed as its always the same

diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index a8726b5..4ace128 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -176,6 +176,8 @@ private:
     void                operator +=(int); // not implemented; to detect misuses
                                           // of operator +=(sal_Char)
 
+    static sal_Size     ConvertFromUnicode( sal_Unicode c, sal_Char* pBuf, sal_Size nBufLen,
+                                            rtl_TextEncoding eTextEncoding );
 public:
                         ByteString();
                         ByteString( const ByteString& rStr );
@@ -255,12 +257,8 @@ public:
     ByteString&         Convert( rtl_TextEncoding eSource,
                                  rtl_TextEncoding eTarget,
                                  sal_Bool bReplace = sal_True );
-    static sal_Char     ConvertFromUnicode( sal_Unicode c,
-                                            rtl_TextEncoding eTextEncoding,
-                                            sal_Bool bReplace = sal_True );
-    static sal_Size     ConvertFromUnicode( sal_Unicode c, sal_Char* pBuf, sal_Size nBufLen,
-                                            rtl_TextEncoding eTextEncoding,
-                                            sal_Bool bReplace = sal_True );
+    static sal_Char     ConvertFromUnicode(sal_Unicode c,
+                                            rtl_TextEncoding eTextEncoding);
     ByteString&         ConvertLineEnd( LineEnd eLineEnd );
     ByteString&         ConvertLineEnd()
                             { return ConvertLineEnd( GetSystemLineEnd() ); }
diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx
index 3023a10..d5c734b 100644
--- a/tools/source/string/strcvt.cxx
+++ b/tools/source/string/strcvt.cxx
@@ -386,11 +386,11 @@ ByteString& ByteString::Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTar
 
 // -----------------------------------------------------------------------
 
-char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncoding, sal_Bool bReplace )
+char ByteString::ConvertFromUnicode(sal_Unicode c, rtl_TextEncoding eTextEncoding)
 {
     sal_Size    nLen;
     char        aBuf[30];
-    nLen = ConvertFromUnicode( c, aBuf, sizeof( aBuf ), eTextEncoding, bReplace );
+    nLen = ConvertFromUnicode(c, aBuf, sizeof( aBuf ), eTextEncoding);
     if ( nLen == 1 )
         return aBuf[0];
     else
@@ -399,8 +399,7 @@ char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncodi
 
 // -----------------------------------------------------------------------
 
-sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding,
-                                         sal_Bool bReplace )
+sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding )
 {
     // TextEncoding Dontknow wird nicht konvertiert
     if ( eTextEncoding == RTL_TEXTENCODING_DONTKNOW )
@@ -414,19 +413,12 @@ sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBu
     sal_uInt32                  nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
                                          RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE |
                                          RTL_UNICODETOTEXT_FLAGS_FLUSH;
-    if ( bReplace )
-    {
-        nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
-                  RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT;
-        nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
-        if ( nBufLen > 1 )
-            nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR;
-    }
-    else
-    {
-        nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 |
-                  RTL_UNICODETOTEXT_FLAGS_INVALID_0;
-    }
+
+    nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+              RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT;
+    nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
+    if ( nBufLen > 1 )
+        nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR;
 
     hConverter = rtl_createUnicodeToTextConverter( eTextEncoding );
     nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
commit 0c88ebd66b0283ca770658cf1d5ee2b7b367c64a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 9 09:30:11 2011 +0100

    build error

diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c
index 571d6de..5984f75 100644
--- a/sal/rtl/source/alloc_arena.c
+++ b/sal/rtl/source/alloc_arena.c
@@ -1001,10 +1001,12 @@ SAL_CALL rtl_arena_alloc (
 
     if ((arena != 0) && (pSize != 0))
     {
+        sal_Size size;
+
         if (alloc_mode == AMode_SYSTEM)
             return rtl_allocateMemory(*pSize);
 
-        sal_Size size = RTL_MEMORY_ALIGN((*pSize), arena->m_quantum);
+        size = RTL_MEMORY_ALIGN((*pSize), arena->m_quantum);
         if (size > arena->m_qcache_max)
         {
             /* allocate from segment list */
commit d0fecfb842d02fc027043e610bdf33f60ea109a2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Aug 9 00:11:18 2011 +0100

    remove ByteString::Convert

diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index fc7c755..a8726b5 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -255,8 +255,6 @@ public:
     ByteString&         Convert( rtl_TextEncoding eSource,
                                  rtl_TextEncoding eTarget,
                                  sal_Bool bReplace = sal_True );
-    static sal_Char     Convert( sal_Char c, rtl_TextEncoding eSource,
-                                 rtl_TextEncoding eTarget );
     static sal_Char     ConvertFromUnicode( sal_Unicode c,
                                             rtl_TextEncoding eTextEncoding,
                                             sal_Bool bReplace = sal_True );
diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx
index b64b514..3023a10 100644
--- a/tools/source/string/strcvt.cxx
+++ b/tools/source/string/strcvt.cxx
@@ -384,37 +384,6 @@ ByteString& ByteString::Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTar
     return *this;
 }
 
-// =======================================================================
-
-char ByteString::Convert( char c,
-                          rtl_TextEncoding eSource, rtl_TextEncoding eTarget )
-{
-    // TextEncoding Dontknow kann nicht konvertiert werden
-    if ( (eSource == RTL_TEXTENCODING_DONTKNOW) || (eTarget == RTL_TEXTENCODING_DONTKNOW) )
-        return '\0';
-
-    // Wenn Source und Target gleich sind, muss nicht konvertiert werden
-    if ( eSource == eTarget )
-        return c;
-
-    // TextEncoding Symbol nur nach Unicode oder von Unicode wandeln, ansonsten
-    // wollen wir die Zeichencodes beibehalten
-    if ( (eSource == RTL_TEXTENCODING_SYMBOL) &&
-         (eTarget != RTL_TEXTENCODING_UTF7) &&
-         (eTarget != RTL_TEXTENCODING_UTF8) )
-        return '\0';
-    if ( (eTarget == RTL_TEXTENCODING_SYMBOL) &&
-         (eSource != RTL_TEXTENCODING_UTF7) &&
-         (eSource != RTL_TEXTENCODING_UTF8) )
-        return '\0';
-
-    sal_uChar* pConvertTab = ImplGet1ByteConvertTab( eSource, eTarget, true );
-    if ( pConvertTab )
-        return (char)pConvertTab[(sal_uChar)c];
-    else
-        return '\0';
-}
-
 // -----------------------------------------------------------------------
 
 char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncoding, sal_Bool bReplace )
commit bca5c1a4d0aa762f37d9f3f6976d3d17865f33a6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 8 22:50:17 2011 +0100

    The idl encoding table stuff appears to be a no-op, converts x to x
    
    1.a) There is only one call to SvTokenStream::SetCharSet
    2.b) That call is from SvTokenStream::InitCtor and the argument is
       gsl_getSystemTextEncoding()
    
    2.a) SvTokenStream::SetCharSet is the sole caller of SvChar::GetTable
       i.e.
       pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() );
    2.b) so this is in practive only ever...
       pCharTab = SvChar::GetTable( gsl_getSystemTextEncoding(),
            gsl_getSystemTextEncoding() );
    
    3) SvChar::GetTable returns a table for converting from one encoding to
       another.
    
    4) so the whole thing is a no-op, i.e.
       pCharTab can be dropped
       SvChar::GetTable is then unused and can be dropped
       SetCharSet and GetCharSet are then also unused

diff --git a/idl/Executable_svidl.mk b/idl/Executable_svidl.mk
index c9d6d5a..e73f15e 100644
--- a/idl/Executable_svidl.mk
+++ b/idl/Executable_svidl.mk
@@ -51,7 +51,6 @@ $(eval $(call gb_Executable_add_linked_libs,svidl,\
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,svidl,\
-	idl/source/cmptools/char \
 	idl/source/cmptools/hash \
 	idl/source/cmptools/lex \
 	idl/source/objects/basobj \
diff --git a/idl/inc/char.hxx b/idl/inc/char.hxx
deleted file mode 100644
index 0c0528d..0000000
--- a/idl/inc/char.hxx
+++ /dev/null
@@ -1,43 +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 _CHAR_HXX
-#define _CHAR_HXX
-
-#include <tools/string.hxx>
-
-class SvChar
-{
-public:
-    static char * GetTable( CharSet nSource, CharSet nDest );
-};
-
-
-#endif // _CHAR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx
index 3aa2213..607f0ec 100644
--- a/idl/inc/lex.hxx
+++ b/idl/inc/lex.hxx
@@ -133,8 +133,6 @@ class SvTokenStream
     sal_uLong       nLine, nColumn;
     int         nBufPos;
     int         c;          // next character
-    CharSet     nCharSet;
-    char *      pCharTab;   // pointer to conversion table
     sal_uInt16      nTabSize;   // length of tabulator
     ByteString      aStrTrue;
     ByteString      aStrFalse;
@@ -184,9 +182,6 @@ public:
     const String &  GetFileName() const { return aFileName; }
     SvStream &      GetStream() { return rInStream; }
 
-    void            SetCharSet( CharSet nSet );
-    CharSet         GetCharSet() const { return nCharSet; }
-
     void            SetTabSize( sal_uInt16 nTabSizeP )
                     { nTabSize = nTabSizeP; }
     sal_uInt16          GetTabSize() const { return nTabSize; }
diff --git a/idl/source/cmptools/char.cxx b/idl/source/cmptools/char.cxx
deleted file mode 100644
index 19848ff..0000000
--- a/idl/source/cmptools/char.cxx
+++ /dev/null
@@ -1,102 +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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_idl.hxx"
-
-#include <ctype.h>
-#include <string.h>
-
-#include <tools/table.hxx>
-
-#include <char.hxx>
-
-static unsigned char EqualTab[ 256 ] = {
-  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
- 10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
- 20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
- 30,  31,  32,  33,  34,  35,  36,  37,  38,  39,
- 40,  41,  42,  43,  44,  45,  46,  47,  48,  49,
- 50,  51,  52,  53,  54,  55,  56,  57,  58,  59,
- 60,  61,  62,  63,  64,  65,  66,  67,  68,  69,
- 70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
- 80,  81,  82,  83,  84,  85,  86,  87,  88,  89,
- 90,  91,  92,  93,  94,  95,  96,  97,  98,  99,
-100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
-110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
-120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
-130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
-140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
-150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
-160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
-170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
-180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
-190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
-200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
-210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
-220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
-230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
-240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
-250, 251, 252, 253, 254, 255 };
-
-
-/*************************************************************************
-|*
-|*    RscChar::GetTable()
-|*
-*************************************************************************/
-Table *         pCharTable  = NULL;
-unsigned char * pChange     = EqualTab;
-char * SvChar::GetTable( CharSet nSource , CharSet nDest )
-{
-    if( nSource == nDest )
-        return (char *)EqualTab;
-
-    if( !pCharTable )
-        pCharTable = new Table();
-
-    sal_uInt8 * pSet;
-    pSet = (sal_uInt8 *)pCharTable->Get( ((sal_uLong)nSource << 16) + (sal_uLong)nDest );
-
-    if( !pSet )
-    {
-        pSet = new sal_uInt8[ 256 ];
-        memcpy( pSet, EqualTab, sizeof( EqualTab ) );
-        for( sal_uInt16 i = 128; i < 256; i++ )
-        {
-            char c = ByteString::Convert( pSet[i], nSource, nDest );
-            if( c )
-                pSet[ i ] = (sal_uInt8)c;
-        }
-        pCharTable->Insert( ((sal_uLong)nSource << 16) + (sal_uLong)nDest, pSet );
-    }
-
-    return (char *)pSet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index 12ce3e1..244aa23 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -33,7 +33,6 @@
 #include <ctype.h>
 #include <stdio.h>
 
-#include <char.hxx>
 #include <hash.hxx>
 #include <lex.hxx>
 #include <globals.hxx>
@@ -99,7 +98,6 @@ SvToken & SvToken::operator = ( const SvToken & rObj )
 
 void SvTokenStream::InitCtor()
 {
-    SetCharSet( gsl_getSystemTextEncoding() );
     aStrTrue    = "TRUE";
     aStrFalse   = "FALSE";
     nLine       = nColumn = 0;
@@ -163,12 +161,6 @@ void SvTokenStream::FillTokenList()
     pCurToken = aTokList.begin();
 }
 
-void SvTokenStream::SetCharSet( CharSet nSet )
-{
-    nCharSet = nSet;
-    pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() );
-}
-
 int SvTokenStream::GetNextChar()
 {
     int nChar;
@@ -332,12 +324,6 @@ sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
         }
         if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
             return sal_False;
-        char * pStr = (char *)aStr.GetBuffer();
-        while( *pStr )
-        {
-            *pStr = pCharTab[ (unsigned char)*pStr ];
-            pStr++;
-        };
         rToken.nType   = SVTOKEN_STRING;
         rToken.aString = aStr;
     }
commit fa419956a170395d5df4f66c9564de6253d77d6d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 8 21:55:58 2011 +0100

    Convert directly from RTL_TEXTENCODING_IBM_437 to unicode
    
    When we draw this text we assume it's in RTL_TEXTENCODING_IBM_437 and convert
    from RTL_TEXTENCODING_IBM_437 to unicode.
    
    So why when we determine the width to use convert from RTL_TEXTENCODING_IBM_437
    to the system encoding, which could be anything, and get the width of that ?

diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index ed83389..c3dfeff 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -693,27 +693,28 @@ UCHAR Upcase(UCHAR c)
 
 sal_uInt16 GetCharWidth(OutputDevice& rOut, UCHAR c)
 {
-    UCHAR  c1;
     sal_uInt16 ChrWidth;
 
-    c1 = ByteString::Convert((char)c,RTL_TEXTENCODING_IBM_437, gsl_getSystemTextEncoding() );
     if (c==' ')
     {
         ChrWidth=(sal_uInt16)rOut.GetTextWidth( String('A') );
         if (rOut.GetFont().GetPitch()!=PITCH_FIXED) {
             ChrWidth=MulDiv(ChrWidth,DefaultSpace,100);
         }
-    } else {
+    }
+    else
+    {
          // with MaxChar == 255 c cannot be greater than MaxChar
          // assert if MaxChar is ever changed
         OSL_ENSURE( MaxChar == 255, "MaxChar not 255" );
+        OSL_ENSURE(sizeof(UCHAR) == 1, "should be 1");
         if (c>=MinChar /*&& c<=MaxChar*/)
         {
-            ChrWidth=(sal_uInt16)rOut.GetTextWidth(String((char)c1));
+            ChrWidth=(sal_uInt16)rOut.GetTextWidth(rtl::OUString(reinterpret_cast<sal_Char*>(&c), 1, RTL_TEXTENCODING_IBM_437));
         }
         else
         {
-            ChrWidth=(sal_uInt16)rOut.GetTextWidth(String('A'));
+            ChrWidth=(sal_uInt16)rOut.GetTextWidth(rtl::OUString(static_cast<sal_Unicode>('A')));
         }
     }
     return ChrWidth;


More information about the Libreoffice-commits mailing list