summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-17 10:43:03 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-17 10:43:03 +0100
commita3db321ecb1cf9f8c08476ecc699931b6111bc21 (patch)
treea24f3cc9f323720b081f804396f9b8ade4bff258
parente625a440a4d17826677608ac430660374d2b7d4f (diff)
Don't assume sal_Unicode is unsigned short
Change-Id: I7a741130689721c69fd2879be6bda27fc6ec3646
-rw-r--r--vcl/inc/sft.hxx8
-rw-r--r--vcl/quartz/ctfonts.cxx2
-rw-r--r--vcl/quartz/ctlayout.cxx4
-rw-r--r--vcl/quartz/utils.cxx11
-rw-r--r--vcl/source/fontsubset/sft.cxx4
-rw-r--r--vcl/source/fontsubset/xlat.cxx10
-rw-r--r--vcl/source/window/syschild.cxx3
7 files changed, 22 insertions, 20 deletions
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 220518c5e1f4..ec8c6a0c92d4 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 8f352b885551..204261833989 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 61ddecc82a80..0eff2a0d17f1 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 7194ad3963ef..f0ebb9a65c20 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 7e3932c2a5ee..37cd963fc607 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 3716a1cd153e..408e6b1aef22 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 0615cf5f69e1..c9b84bf9232a 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);
}