From cb5db95476d9cb9834f6b94233ea0b2e95530f71 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Tue, 18 Oct 2022 18:40:14 -0500 Subject: [PATCH] Do not print "\000" at end of printf/scanf format strings. This happened due to the change to include the null terminator in the internal representation of strings. --- Printf.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Printf.pas b/Printf.pas index dbfa30f..db42cbe 100644 --- a/Printf.pas +++ b/Printf.pas @@ -136,7 +136,7 @@ var WriteLine; if s <> nil then begin Write(' > "'); - for i := 1 to s^.length do begin + for i := 1 to s^.length-1 do begin ch := s^.str[i]; if ch in [' '..'~'] then begin if ch in ['"','\','?'] then @@ -167,13 +167,13 @@ var Write(' '); if offset = 0 then if s <> nil then begin - offset := s^.length; + offset := s^.length-1; write(' '); end; {if} - if offset > 0 then begin - if s <> nil then begin - if offset > s^.length then - offset := s^.length; + if s <> nil then begin + if offset > 0 then begin + if offset > s^.length-1 then + offset := s^.length-1; for i := 1 to offset do begin ch := s^.str[i]; if ch in [' '..'~'] then begin