From 039dbbcb9688971a85b1791f60a55693ff3ba261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Tue, 29 Mar 2005 10:47:59 +0000 Subject: [PATCH] INTEGRATION: CWS ab14fixes (1.11.18); FILE MERGED 2005/02/24 09:55:10 ab 1.11.18.1: #i42467# Changed SbiImage::GetString() to allow Strings containing a 0 char --- basic/source/classes/image.cxx | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index 0824c728221e..6e565352cde9 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -2,9 +2,9 @@ * * $RCSfile: image.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: rt $ $Date: 2004-11-15 16:34:02 $ + * last change: $Author: rt $ $Date: 2005-03-29 11:47:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -444,9 +444,27 @@ String SbiImage::GetString( short nId ) const { if( nId && nId <= nStrings ) { - USHORT nOff = pStringOff[ --nId ]; - String aStr( pStrings + nOff ); - return aStr; + USHORT nOff = pStringOff[ nId - 1 ]; + sal_Unicode* pStr = pStrings + nOff; + + // #i42467: Special treatment for vbNullChar + if( *pStr == 0 ) + { + USHORT nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff; + USHORT nLen = nNextOff - nOff - 1; + if( nLen == 1 ) + { + // Force length 1 and make char 0 afterwards + String aNullCharStr( String::CreateFromAscii( " " ) ); + aNullCharStr.SetChar( 0, 0 ); + return aNullCharStr; + } + } + else + { + String aStr( pStr ); + return aStr; + } } return String(); }