From 909b88cccbb932172897a21a97aa16d9e4a94fb1 Mon Sep 17 00:00:00 2001 From: deadwood Date: Mon, 18 Jul 2016 18:50:09 +0000 Subject: [PATCH] locale.library: correctly return the position of remaining datastream Previous implementation was returning position of max used argument. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@52792 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/locale/formatstring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/workbench/libs/locale/formatstring.c b/workbench/libs/locale/formatstring.c index ec5dca944c..d960ab8d29 100644 --- a/workbench/libs/locale/formatstring.c +++ b/workbench/libs/locale/formatstring.c @@ -39,7 +39,7 @@ APTR InternalFormatString(const struct Locale * locale, ULONG template_pos; BOOL end; - ULONG max_argpos; + ULONG max_argpos, max_argpos_datasize; ULONG arg_counter; if (!fmtTemplate) @@ -50,6 +50,7 @@ APTR InternalFormatString(const struct Locale * locale, end = FALSE; max_argpos = 1; arg_counter = 0; + max_argpos_datasize = 0; while (!end) { @@ -257,6 +258,7 @@ APTR InternalFormatString(const struct Locale * locale, ** arg_pos, left, buflen, limit */ { + datasize = sizeof(IPTR); BSTR s = (BSTR) * (UBYTE **) ARG(arg_pos); if (s != (BSTR) BNULL) @@ -458,6 +460,7 @@ APTR InternalFormatString(const struct Locale * locale, case 's': /* NULL terminated string */ { + datasize = sizeof(IPTR); { buffer = *(UBYTE **) ARG(arg_pos); @@ -559,7 +562,10 @@ APTR InternalFormatString(const struct Locale * locale, template_pos++; if (arg_pos > max_argpos) + { max_argpos = arg_pos; + max_argpos_datasize = datasize; + } } state = OUTPUT; @@ -567,7 +573,7 @@ APTR InternalFormatString(const struct Locale * locale, } } - return (APTR)ARG(max_argpos); + return (APTR)(ARG(max_argpos) + max_argpos_datasize); } /***************************************************************************** -- 2.11.4.GIT