diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-10-31 10:00:11 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-10-31 10:22:46 +0100 |
commit | 3b921a2cd7c2b29245af4e975da6c60f72384237 (patch) | |
tree | fb4d075c111f4c7e6f89020d671639713a2b3ec2 | |
parent | f28f87f20c040d941d7a5e64c6b662a23744a21b (diff) |
sw: bookmark names don't need cryptographic randomness
Change-Id: I6cecbf9b5a8b66de2e0e2d90fdecf6b389caad25
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 2ba5c115b8f3..3b93e30592b8 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -31,10 +31,10 @@ #include <swtypes.hxx> #include <UndoBookmark.hxx> #include <unobookmark.hxx> -#include <rtl/random.h> #include <o3tl/make_unique.hxx> #include <xmloff/odffields.hxx> #include <libxml/xmlwriter.h> +#include <comphelper/random.hxx> #include <comphelper/anytostring.hxx> using namespace ::sw::mark; @@ -206,15 +206,14 @@ namespace sw { namespace mark } else { - static rtlRandomPool aPool = rtl_random_createPool(); static OUString sUniquePostfix; static sal_Int32 nCount = SAL_MAX_INT32; OUStringBuffer aResult(rPrefix); if(nCount == SAL_MAX_INT32) { - sal_Int32 nRandom; - rtl_random_getBytes(aPool, &nRandom, sizeof(nRandom)); - sUniquePostfix = OUStringBuffer(13).append('_').append(static_cast<sal_Int32>(abs(nRandom))).makeStringAndClear(); + unsigned int const n(comphelper::rng::uniform_uint_distribution(0, + std::numeric_limits<unsigned int>::max())); + sUniquePostfix = "_" + OUString::number(n); nCount = 0; } // putting the counter in front of the random parts will speed up string comparisons |