Mercurial > hg > orthanc-stone
changeset 1084:6cf58788f37f broker
fix GenericToolboxTests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Oct 2019 13:19:25 +0200 |
parents | f72d1ab42932 |
children | fe723ea10d98 |
files | Framework/Toolbox/GenericToolbox.h UnitTestsSources/GenericToolboxTests.cpp |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Toolbox/GenericToolbox.h Tue Oct 22 13:14:05 2019 +0200 +++ b/Framework/Toolbox/GenericToolbox.h Tue Oct 22 13:19:25 2019 +0200 @@ -116,7 +116,7 @@ if (*p == '.') { double f = 0.0; - int n = 1; + size_t n = 1; ++p; while (*p >= '0' && *p <= '9' && n < FRAC_FACTORS_LEN) {
--- a/UnitTestsSources/GenericToolboxTests.cpp Tue Oct 22 13:14:05 2019 +0200 +++ b/UnitTestsSources/GenericToolboxTests.cpp Tue Oct 22 13:19:25 2019 +0200 @@ -3762,7 +3762,7 @@ for (double b = DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) { char txt[1024]; - sprintf_s(txt, "%.17f", b); + snprintf(txt, sizeof(txt) - 1, "%.17f", b); double r = 0.0; bool ok = StringToDouble(r, txt); @@ -3802,7 +3802,7 @@ for (double b = -1.0*DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) { char txt[1024]; - sprintf_s(txt, "%.17f", b); + snprintf(txt, sizeof(txt) - 1, "%.17f", b); double r = 0.0; bool ok = StringToDouble(r, txt); @@ -3843,9 +3843,9 @@ int64_t bi = static_cast<int64_t>(b); char txt[1024]; #if (defined __clang__) || (defined __GNUC__) || ( (defined _MSC_VER) && (_MSC_VER > 1800) ) - sprintf_s(txt, "%lld", bi); + snprintf(txt, sizeof(txt) - 1, "%ld", bi); #elif (defined _MSC_VER) - sprintf_s(txt, "%I64d", bi); + snprintf(txt, sizeof(txt) - 1, "%I64d", bi); #else #error Please adjust for your platform #endif