From 53b23cf4b679a1d214001b79ea0a4438888e94a4 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 15 May 2016 20:19:35 +0200 Subject: [PATCH] nupa_substitute(), transform pscopy(,x,y,) --> pscopy(,x+y,y-y,) (requirement strlen(x) >= y to be verified later) --- src/frontend/numparam/xpressn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index c82d39a1e..e41f5c96a 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -1231,7 +1231,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r) if (d == '\0') { err = message(dico, "Closing \"}\" not found.\n"); } else { - pscopy(&tstr, s, (int) (iptr - s) , (int) (kptr - iptr - 1)); + pscopy(&tstr, s + (iptr - s), (iptr - s) - (iptr - s), (int) (kptr - iptr - 1)); /* exeption made for .meas */ if (strcasecmp(spice_dstring_value(&tstr), "LAST") == 0) { spice_dstring_reinit(&qstr); @@ -1285,7 +1285,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r) if (kptr > s_end) { err = message(dico, "Closing \")\" not found.\n"); } else { - pscopy(&tstr, s, (int) (iptr - s), (int) (kptr - iptr - 1)); + pscopy(&tstr, s + (iptr - s), (iptr - s) - (iptr - s), (int) (kptr - iptr - 1)); const char *xx = spice_dstring_value(&tstr); err = evaluate_expr(dico, &qstr, xx, xx + strlen(xx)); } @@ -1305,7 +1305,7 @@ nupa_substitute(dico_t *dico, char * const s, char *r) } while ((kptr <= s_end) && (d > ' ')); - pscopy(&tstr, s, (int) (iptr - s)-1, (int) (kptr - iptr)); + pscopy(&tstr, s + (iptr - s - 1), (iptr - s)-1 - (iptr - s - 1), (int) (kptr - iptr)); const char *xx = spice_dstring_value(&tstr); err = evaluate_variable(dico, &qstr, xx, xx + strlen(xx)); iptr = kptr - 1;