[OpenBIOS] [PATCH 20/20] property.fs: fix off-by-one error in decode-string

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Jun 15 10:38:58 CEST 2013


The sequence 's" test" encode-string decode-string' suffered from an off-by-one
error whereby the trailing '\0' would still be left at the end of the decoded
string.

This fixes the extra "space" appearing at the end of property names, e.g. such
as in the output of "show-devs".

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/forth/device/property.fs |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openbios-devel/forth/device/property.fs b/openbios-devel/forth/device/property.fs
index d19546c..f9769fb 100644
--- a/openbios-devel/forth/device/property.fs
+++ b/openbios-devel/forth/device/property.fs
@@ -185,7 +185,7 @@
     >r >r >r          ( R: prop-addr1 prop-addr2 prop-len2 nlen )
     drop
     r> r> r>          ( nlen prop-len2 prop-addr2 )
-    -rot swap         ( prop-addr2 prop-len2 nlen )
+    -rot swap 1-      ( prop-addr2 prop-len2 nlen )
     r> swap           ( prop-addr2 prop-len2 str len )
   else
     0 0
-- 
1.7.10.4




More information about the OpenBIOS mailing list