Mercurial > hg > orthanc-stone
comparison UnitTestsSources/GenericToolboxTests.cpp @ 1084:6cf58788f37f broker
fix GenericToolboxTests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Oct 2019 13:19:25 +0200 |
parents | 287ec78f63b4 |
children | a9d10e54c536 |
comparison
equal
deleted
inserted
replaced
1083:f72d1ab42932 | 1084:6cf58788f37f |
---|---|
3760 //const double FACTOR = 1.000000000171271211; | 3760 //const double FACTOR = 1.000000000171271211; |
3761 const double FACTOR = 1.71271211; | 3761 const double FACTOR = 1.71271211; |
3762 for (double b = DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) | 3762 for (double b = DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) |
3763 { | 3763 { |
3764 char txt[1024]; | 3764 char txt[1024]; |
3765 sprintf_s(txt, "%.17f", b); | 3765 snprintf(txt, sizeof(txt) - 1, "%.17f", b); |
3766 double r = 0.0; | 3766 double r = 0.0; |
3767 bool ok = StringToDouble(r, txt); | 3767 bool ok = StringToDouble(r, txt); |
3768 | 3768 |
3769 #if 0 | 3769 #if 0 |
3770 if (ok) | 3770 if (ok) |
3800 //const double FACTOR = 1.000000000171271211; | 3800 //const double FACTOR = 1.000000000171271211; |
3801 const double FACTOR = 1.71271211; | 3801 const double FACTOR = 1.71271211; |
3802 for (double b = -1.0*DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) | 3802 for (double b = -1.0*DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) |
3803 { | 3803 { |
3804 char txt[1024]; | 3804 char txt[1024]; |
3805 sprintf_s(txt, "%.17f", b); | 3805 snprintf(txt, sizeof(txt) - 1, "%.17f", b); |
3806 double r = 0.0; | 3806 double r = 0.0; |
3807 bool ok = StringToDouble(r, txt); | 3807 bool ok = StringToDouble(r, txt); |
3808 | 3808 |
3809 #if 0 | 3809 #if 0 |
3810 if (ok) | 3810 if (ok) |
3841 for (double b = DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) | 3841 for (double b = DBL_EPSILON; b < DBL_MAX && i < COUNT; ++i, b *= FACTOR) |
3842 { | 3842 { |
3843 int64_t bi = static_cast<int64_t>(b); | 3843 int64_t bi = static_cast<int64_t>(b); |
3844 char txt[1024]; | 3844 char txt[1024]; |
3845 #if (defined __clang__) || (defined __GNUC__) || ( (defined _MSC_VER) && (_MSC_VER > 1800) ) | 3845 #if (defined __clang__) || (defined __GNUC__) || ( (defined _MSC_VER) && (_MSC_VER > 1800) ) |
3846 sprintf_s(txt, "%lld", bi); | 3846 snprintf(txt, sizeof(txt) - 1, "%ld", bi); |
3847 #elif (defined _MSC_VER) | 3847 #elif (defined _MSC_VER) |
3848 sprintf_s(txt, "%I64d", bi); | 3848 snprintf(txt, sizeof(txt) - 1, "%I64d", bi); |
3849 #else | 3849 #else |
3850 #error Please adjust for your platform | 3850 #error Please adjust for your platform |
3851 #endif | 3851 #endif |
3852 int64_t r = 0; | 3852 int64_t r = 0; |
3853 bool ok = StringToInteger<int64_t>(r, txt); | 3853 bool ok = StringToInteger<int64_t>(r, txt); |