From f7d3dac6cfe0e428f213f75f736310cc32823bbf Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Wed, 28 Dec 2011 11:37:38 +0100 Subject: [PATCH] More fixes. --- mpsl.l | 11 ++++------- mpsl_c.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mpsl.l b/mpsl.l index 3f8ebe8..86e1e96 100644 --- a/mpsl.l +++ b/mpsl.l @@ -72,16 +72,13 @@ static wchar_t *s_mbstowcs(char *str) /* converts from mbs to wcs, using a static buffer */ { static wchar_t *wc = NULL; - static int wc_s = 0; int n; - /* allocs wchar_t space, if needed */ - if ((n = mbstowcs(NULL, str, 0)) > wc_s) { - wc_s = n; - wc = realloc(wc, (wc_s + 1) * sizeof(wchar_t)); - } + /* get needed space */ + n = mbstowcs(NULL, str, 0); + wc = realloc(wc, (n + 1) * sizeof(wchar_t)); - /* really converts */ + /* really convert */ mbstowcs(wc, str, n); wc[n] = L'\0'; diff --git a/mpsl_c.c b/mpsl_c.c index a4d504c..05ab415 100644 --- a/mpsl_c.c +++ b/mpsl_c.c @@ -579,11 +579,15 @@ O_TYPE O_range(O_ARGS) mpdm_t r = RF(MPDM_A(0)); if (v1 < v2) - while (v1 <= v2) - mpdm_push(r, MPDM_R(v1 += 1.0)); + while (v1 <= v2) { + mpdm_push(r, MPDM_R(v1)); + v1 += 1.0; + } else - while (v1 >= v2) - mpdm_push(r, MPDM_R(v1 -= 1.0)); + while (v1 >= v2) { + mpdm_push(r, MPDM_R(v1)); + v1 -= 1.0; + } UFND(r); -- 2.11.4.GIT