wizards/source/scriptforge/SF_String.xba |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 852454a487aefc17523804dc93892f34047365a0
Author:     Jean-Pierre Ledure <[email protected]>
AuthorDate: Thu Aug 19 17:24:59 2021 +0200
Commit:     Jean-Pierre Ledure <[email protected]>
CommitDate: Thu Aug 19 18:39:31 2021 +0200

    ScriptForge - (SF_String) FIX misplaced brackets in _Repr()
    
    Next Basic code:
    
      Sub ReprNotPrintable()
      Dim a,b
        GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
        a = "abc" & Chr(31) & "def"
        b = SF_String.Represent(a)
      End Sub
    
    gives a Basic runtime error « Invalid procedure call »
    when error handling is disabled.
    
    Reason: misplaced brackets in SF_String._Repr() when
    the argument contains a non-printable character.
    
    ScriptForge additional info :
      Location : String.Represent/2113
      Invalid procedure call.
    
    Should give :
            b = "abc\x1Fdef"
    
    Bug fixed on master in commit https://gerrit.libreoffice.org/c/core/+/119824
    
    Change-Id: I9d180de99c803a49a56c4c1b22847cfc5a1f9608
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120748
    Tested-by: Jenkins
    Reviewed-by: Alain Romedenne <[email protected]>

diff --git a/wizards/source/scriptforge/SF_String.xba 
b/wizards/source/scriptforge/SF_String.xba
index f7c645981c8b..799c055942cb 100644
--- a/wizards/source/scriptforge/SF_String.xba
+++ b/wizards/source/scriptforge/SF_String.xba
@@ -2709,7 +2709,7 @@ Dim i As Long
                        sChar = Mid(sString, lPos, 1)
                        If Not SF_String.IsPrintable(sChar) Then
                                lAsc = Asc(sChar)
-                               sChar = &quot;\x&quot; &amp; Iif(lAsc &lt; 255, 
Right(&quot;00&quot; &amp; Hex(lAsc, 2)), Right(&quot;0000&quot; &amp; 
Hex(lAsc, 4)))
+                               sChar = &quot;\x&quot; &amp; Iif(lAsc &lt; 255, 
Right(&quot;00&quot; &amp; Hex(lAsc), 2), Right(&quot;0000&quot; &amp; 
Hex(lAsc), 4))
                                If lPos &lt; Len(sString) Then
                                        sString = Left(sString, lPos - 1) &amp; 
sChar &amp; Mid(sString, lPos + 1)
                                Else

Reply via email to