vcl/source/gdi/pdfwriter_impl.cxx |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit a23d5a4177df24a22e1215bbff7cb06a7116db95
Author:     Arnaud VERSINI <arnaud.vers...@pm.me>
AuthorDate: Sun Aug 10 17:39:18 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Aug 18 14:50:22 2025 +0200

    vcl : simplify appendDestinationName.
    
    Usee rtl::isAsciiAlphanumeric and also foreach loop.
    
    Change-Id: Ie4a494e32cacc36740ee2aa2ae58956c6a40776b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189313
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 2b1e2088eb41..eafe17b67b80 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -51,6 +51,7 @@
 #include <osl/file.hxx>
 #include <osl/thread.h>
 #include <rtl/crc.h>
+#include <rtl/character.hxx>
 #include <rtl/digest.h>
 #include <rtl/uri.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -161,17 +162,11 @@ void appendObjectReference(sal_Int32 nObjectID, 
OStringBuffer & aLine)
  * Further limitation: it is advisable to use standard ASCII characters for
  * OOo bookmarks.
 */
-void appendDestinationName( const OUString& rString, OStringBuffer& rBuffer )
+void appendDestinationName( std::u16string_view rString, OStringBuffer& 
rBuffer )
 {
-    const sal_Unicode* pStr = rString.getStr();
-    sal_Int32 nLen = rString.getLength();
-    for( int i = 0; i < nLen; i++ )
+    for( auto aChar: rString)
     {
-        sal_Unicode aChar = pStr[i];
-        if( (aChar >= '0' && aChar <= '9' ) ||
-            (aChar >= 'a' && aChar <= 'z' ) ||
-            (aChar >= 'A' && aChar <= 'Z' ) ||
-            aChar == '-' )
+        if( rtl::isAsciiAlphanumeric(aChar) || aChar == '-' )
         {
             rBuffer.append(static_cast<char>(aChar));
         }

Reply via email to