[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source

Stephan Bergmann sbergman at redhat.com
Tue Nov 17 01:43:29 PST 2015


 vcl/inc/sft.hxx                |    8 ++++----
 vcl/quartz/ctfonts.cxx         |    2 +-
 vcl/quartz/ctlayout.cxx        |    4 ++--
 vcl/quartz/utils.cxx           |   11 ++++++-----
 vcl/source/fontsubset/sft.cxx  |    4 ++--
 vcl/source/fontsubset/xlat.cxx |   10 +++++-----
 vcl/source/window/syschild.cxx |    3 ++-
 7 files changed, 22 insertions(+), 20 deletions(-)

New commits:
commit a3db321ecb1cf9f8c08476ecc699931b6111bc21
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Nov 17 10:43:03 2015 +0100

    Don't assume sal_Unicode is unsigned short
    
    Change-Id: I7a741130689721c69fd2879be6bda27fc6ec3646

diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 220518c..ec8c6a0 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -180,9 +180,9 @@ namespace vcl
 
     typedef struct {
         char *family;             /**< family name                                             */
-        sal_uInt16 *ufamily;          /**< family name UCS2                                         */
+        sal_Unicode *ufamily;     /**< family name UCS2                                         */
         char *subfamily;          /**< subfamily name                                          */
-        sal_uInt16 *usubfamily;   /**< subfamily name UCS2 */
+        sal_Unicode *usubfamily;  /**< subfamily name UCS2 */
         char *psname;             /**< PostScript name                                         */
         sal_uInt16 macStyle;      /**< macstyle bits from 'HEAD' table */
         int   weight;             /**< value of WeightClass or 0 if can't be determined        */
@@ -527,9 +527,9 @@ namespace vcl
 
         char        *psname;
         char        *family;
-        sal_uInt16  *ufamily;
+        sal_Unicode *ufamily;
         char        *subfamily;
-        sal_uInt16  *usubfamily;
+        sal_Unicode *usubfamily;
 
         sal_uInt32  ntables;
         sal_uInt32  *goffsets;
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 8f352b8..2042618 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -296,7 +296,7 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
 #ifdef MACOSX
     const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage();
     CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault,
-                                                        aUILang.getStr(), aUILang.getLength() );
+                                                        reinterpret_cast<UniChar const *>(aUILang.getStr()), aUILang.getLength() );
     CFStringRef pLang = nullptr;
     CFStringRef pFamilyName = static_cast<CFStringRef>(
             CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang ));
diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 61ddecc..0eff2a0 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -135,7 +135,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
 
     // create the CoreText line layout
     CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( nullptr,
-                                                              pStr + mnMinCharPos,
+                                                              reinterpret_cast<UniChar const *>(pStr + mnMinCharPos),
                                                               mnCharCount,
                                                               kCFAllocatorNull );
     // CFAttributedStringCreate copies the attribues parameter
@@ -213,7 +213,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
         CFRelease( mpCTLine );
         const sal_Unicode *pStr = rArgs.mrStr.getStr();
         CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( nullptr,
-                                                                  pStr + mnMinCharPos,
+                                                                  reinterpret_cast<UniChar const *>(pStr + mnMinCharPos),
                                                                   mnCharCount - mnTrailingSpaceCount,
                                                                   kCFAllocatorNull );
         CFAttributedStringRef pAttrStr = CFAttributedStringCreate( nullptr,
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index 7194ad3..f0ebb9a 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -43,14 +43,14 @@ OUString GetOUString( CFStringRef rStr )
     const UniChar* pConstStr = CFStringGetCharactersPtr( rStr );
     if( pConstStr )
     {
-        return OUString( pConstStr, nLength );
+        return OUString( reinterpret_cast<sal_Unicode const *>(pConstStr), nLength );
     }
 
     UniChar* pStr = static_cast<UniChar*>( rtl_allocateMemory( sizeof(UniChar)*nLength ) );
     CFRange aRange = { 0, nLength };
     CFStringGetCharacters( rStr, aRange, pStr );
 
-    OUString aRet( pStr, nLength );
+    OUString aRet( reinterpret_cast<sal_Unicode *>(pStr), nLength );
     rtl_freeMemory( pStr );
     return aRet;
 }
@@ -70,19 +70,20 @@ OUString GetOUString( NSString* pStr )
 
     OUStringBuffer aBuf( nLen+1 );
     aBuf.setLength( nLen );
-    [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
+    [pStr getCharacters:
+     reinterpret_cast<unichar *>(const_cast<sal_Unicode*>(aBuf.getStr()))];
 
     return aBuf.makeStringAndClear();
 }
 
 CFStringRef CreateCFString( const OUString& rStr )
 {
-    return CFStringCreateWithCharacters(kCFAllocatorDefault, rStr.getStr(), rStr.getLength() );
+    return CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<UniChar const *>(rStr.getStr()), rStr.getLength() );
 }
 
 NSString* CreateNSString( const OUString& rStr )
 {
-    return [[NSString alloc] initWithCharacters: rStr.getStr() length: rStr.getLength()];
+    return [[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rStr.getStr()) length: rStr.getLength()];
 }
 
 std::ostream &operator <<(std::ostream& s, const CGRect &rRect)
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 7e3932c2..37cd963 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -848,7 +848,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat
 
 /*- Extracts a string from the name table and allocates memory for it -*/
 
-static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFlag, sal_uInt16** ucs2result )
+static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFlag, sal_Unicode** ucs2result )
 {
     char *res;
     const sal_uInt8* ptr = name + GetUInt16(name, 4, 1) + GetUInt16(name + 6, 12 * n + 10, 1);
@@ -874,7 +874,7 @@ static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFl
         res[len/2] = 0;
         if( ucs2result )
         {
-            *ucs2result = static_cast<sal_uInt16*>(malloc( len+2 ));
+            *ucs2result = static_cast<sal_Unicode*>(malloc( len+2 ));
             for (int i = 0; i < len/2; i++ )
                 (*ucs2result)[i] = GetUInt16( ptr, 2*i, 1 );
             (*ucs2result)[len/2] = 0;
diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx
index 3716a1c..408e6b1 100644
--- a/vcl/source/fontsubset/xlat.cxx
+++ b/vcl/source/fontsubset/xlat.cxx
@@ -171,27 +171,27 @@ sal_uInt16 TranslateChar16(sal_uInt16 src)
 
 void TranslateString12(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
 {
-    aCC.convertStr( 2, src, dst, n);
+    aCC.convertStr( 2, reinterpret_cast<sal_Unicode *>(src), dst, n);
 }
 
 void TranslateString13(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
 {
-    aCC.convertStr( 3, src, dst, n);
+    aCC.convertStr( 3, reinterpret_cast<sal_Unicode *>(src), dst, n);
 }
 
 void TranslateString14(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
 {
-    aCC.convertStr( 4, src, dst, n);
+    aCC.convertStr( 4, reinterpret_cast<sal_Unicode *>(src), dst, n);
 }
 
 void TranslateString15(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
 {
-    aCC.convertStr( 5, src, dst, n);
+    aCC.convertStr( 5, reinterpret_cast<sal_Unicode *>(src), dst, n);
 }
 
 void TranslateString16(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
 {
-    aCC.convertStr( 6, src, dst, n);
+    aCC.convertStr( 6, reinterpret_cast<sal_Unicode *>(src), dst, n);
 }
 
 } // namespace vcl
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 0615cf5..c9b84bf 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -182,7 +182,8 @@ void SystemChildWindow::ImplTestJavaException( void* pEnv )
         if(jsMessage)
         {
             const jchar * jcMessage = pJavaEnv->GetStringChars(jsMessage, nullptr);
-            ouMessage = OUString(jcMessage);
+            ouMessage = OUString(
+                reinterpret_cast<sal_Unicode const *>(jcMessage));
             pJavaEnv->ReleaseStringChars(jsMessage, jcMessage);
         }
 


More information about the Libreoffice-commits mailing list