fixing INSERT function: was inserting into incorrect position. (submitted by Manuele)
authorMario de Sousa <msousa@fe.up.pt>
Mon, 06 Jun 2011 14:05:28 +0100
changeset 313 90c3772e6547
parent 312 29add821207d
child 314 41d4ac0b4821
fixing INSERT function: was inserting into incorrect position. (submitted by Manuele)
lib/iec_std_lib.h
--- a/lib/iec_std_lib.h	Mon Jun 06 11:01:47 2011 +0200
+++ b/lib/iec_std_lib.h	Mon Jun 06 14:05:28 2011 +0100
@@ -385,7 +385,7 @@
     TEST_EN_COND(STRING, P < 0)
     res = __INIT_STRING;
 
-    to_copy = P > IN1.len ? IN1.len : P - 1;
+    to_copy = P > IN1.len ? IN1.len : P;
     memcpy(&res.body, &IN1.body , to_copy);
     P = res.len = to_copy;