From: fennecdjay Date: Sun, 8 Sep 2019 21:52:19 +0000 (+0200) Subject: :bug: Fix string formating X-Git-Tag: nightly~2228 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=9b3e85ae9a4b336ceea19555e1dee241710ce3f4;p=gwion.git :bug: Fix string formating --- diff --git a/src/lib/string.c b/src/lib/string.c index 09b29cc7..311011a3 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -71,7 +71,7 @@ describe_string_assign(Complex_, m_complex, SZ_COMPLEX,, num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + 16, "#(%.4f, %.4f)", creal(lhs), cimag(lhs)) describe_string_assign(Polar_, m_complex, SZ_COMPLEX,, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + 16, + num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs) / M_PI) + 16, "#(%.4f, %.4f)", creal(lhs), cimag(lhs)/M_PI) describe_string_assign(Vec3_, m_vec3, SZ_VEC3,, num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + 23, @@ -117,8 +117,8 @@ describe_string(Complex, m_complex, SZ_COMPLEX, num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + (rhs ? strlen(STRING(rhs)) : 0) + 12,, "#(%.4f, %.4f)%s", creal(lhs), cimag(lhs), rhs ? STRING(rhs) : "") describe_string(Polar, m_complex, SZ_COMPLEX, - num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs)) + (rhs ? strlen(STRING(rhs)) : 0) + 12,, - "%%(%f, %f*pi)%s", creal(lhs), cimag(lhs) / M_PI, rhs ? STRING(rhs) : "") + num_digit((m_uint)creal(lhs)) + num_digit((m_uint)cimag(lhs) / M_PI) + (rhs ? strlen(STRING(rhs)) : 0) + 12,, + "%%(%.4f, %4f*pi)%s", creal(lhs), cimag(lhs) / M_PI, rhs ? STRING(rhs) : "") describe_string(Vec3, m_vec3, SZ_VEC3, (rhs ? strlen(STRING(rhs)) : 0) + 23 + num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z),, @@ -126,7 +126,7 @@ describe_string(Vec3, m_vec3, SZ_VEC3, describe_string(Vec4, m_vec4, SZ_VEC4, (rhs ? strlen(STRING(rhs)) : 0) + 28 + num_digit((m_uint)lhs.x) + num_digit((m_uint)lhs.y) + num_digit((m_uint)lhs.z) + num_digit((m_uint)lhs.w),, - "@(%f, %f, %f, %f)%s", lhs.x, lhs.y, lhs.z, lhs.w, rhs ? STRING(rhs) : "") + "@(%4f, %4f, %4f, %4f)%s", lhs.x, lhs.y, lhs.z, lhs.w, rhs ? STRING(rhs) : "") describe_string(Object, M_Object, SZ_INT, 16 + (rhs ? strlen(STRING(rhs)) : 0), release(lhs, shred), "%p%s", (void*)lhs, rhs ? STRING(rhs) : "")