Kaydet (Commit) a3db321e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Don't assume sal_Unicode is unsigned short

Change-Id: I7a741130689721c69fd2879be6bda27fc6ec3646
üst e625a440
......@@ -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;
......
......@@ -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 ));
......
......@@ -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,
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment