summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSven Jacobi <sj@openoffice.org>2002-12-05 11:11:36 +0000
committerSven Jacobi <sj@openoffice.org>2002-12-05 11:11:36 +0000
commit39c84af1128df610243b6eb4292242f1589ba4ff (patch)
treef031a7969c649676a0f085501559c3595a5a388c /svx
parent281af5e80c9ce64dfe642b2dcdac2d62c8d03e7a (diff)
#105913# removing usage of sprintf()
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xml/xmleohlp.cxx24
1 files changed, 16 insertions, 8 deletions
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 5c5a581d9a4c..4c2aa609461b 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmleohlp.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: cl $
+ * last change: $Author: sj $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -477,16 +477,24 @@ SvStorageRef SvXMLEmbeddedObjectHelper::ImplGetObjectStorage(
String SvXMLEmbeddedObjectHelper::ImplGetUniqueName( SvStorage* pStg,
const sal_Char* p ) const
{
+ String aP( ByteString( p ), RTL_TEXTENCODING_UTF8 );
String aName;
- sal_Char cBuf[ 32 ];
-
- static ULONG nId = (ULONG) cBuf;
-
+ static ULONG nId = (ULONG)&aP;
nId++;
for( ;; )
{
- sprintf( cBuf, "%s%08lX", p, nId );
- aName.AssignAscii( cBuf );
+ aName = aP;
+ sal_Int32 nBitsLeft = 32;
+ while( nBitsLeft )
+ {
+ sal_uInt32 nNumb = ( nId << ( 32 - nBitsLeft ) ) >> 28;
+ if ( nNumb > 9 )
+ nNumb += 'A' - 10;
+ else
+ nNumb += '0';
+ aName+=(sal_Unicode)((sal_Char)nNumb);
+ nBitsLeft -= 4;
+ }
if( !pStg->IsContained( aName ) )
break;
nId++;