incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1172112 - /incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx
Date Sat, 17 Sep 2011 22:39:09 GMT
Author: mst
Date: Sat Sep 17 22:39:09 2011
New Revision: 1172112

URL: http://svn.apache.org/viewvc?rev=1172112&view=rev
Log:
sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles
and list ids

# HG changeset patch
# User Oliver-Rainer Wittmann <od@openoffice.org>
# Date 1302878050 -7200
# Node ID b5be4cee2442cea2204d7daf5a946a0061cc49a4
# Parent  ec59153c0f36b94057baa1b381583052dcb1b87b

Modified:
    incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx   (contents, props changed)

Modified: incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx?rev=1172112&r1=1172111&r2=1172112&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx Sat Sep 17 22:39:09 2011
@@ -29,8 +29,7 @@
 #include "precompiled_sw.hxx"
 
 #include <hintids.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
+#include <rtl/random.h>
 #include <tools/resid.hxx>
 #include <editeng/lrspitem.hxx>
 #include <ftninfo.hxx>
@@ -2535,9 +2534,12 @@ String SwDoc::GetUniqueNumRuleName( cons
 	String aName;
 	if( bAutoNum )
 	{
-		long n = Time().GetTime();
-		n += Date().GetDate();
-		aName = String::CreateFromInt32( n );
+        // --> OD #o12311627#
+        static rtlRandomPool s_RandomPool( rtl_random_createPool() );
+        sal_Int64 n;
+        rtl_random_getBytes( s_RandomPool, &n, sizeof(n) );
+        aName = String::CreateFromInt64( (n < 0 ? -n : n) );
+        // <--
 		if( pChkStr && !pChkStr->Len() )
 			pChkStr = 0;
 	}
@@ -2940,11 +2942,11 @@ namespace listfunc
         // --> OD 2008-08-06 #i92478#
         String aNewListId = String::CreateFromAscii( "list" );
         // <--
-        sal_Int64 n = Time().GetTime();
-        n += Date().GetDate();
-        n += rand();
-        // --> OD 2008-08-06 #i92478#
-        aNewListId += String::CreateFromInt64( n );
+        // --> OD #o12311627#
+        static rtlRandomPool s_RandomPool( rtl_random_createPool() );
+        sal_Int64 n;
+        rtl_random_getBytes( s_RandomPool, &n, sizeof(n) );
+        aNewListId += String::CreateFromInt64( (n < 0 ? -n : n) );
         // <--
 
         return MakeListIdUnique( rDoc, aNewListId );

Propchange: incubator/ooo/trunk/main/sw/source/core/doc/docnum.cxx
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message