diff --git a/src/string.cpp b/src/string.cpp index a8ca115..bd1901c 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -134,7 +134,7 @@ namespace bx { for (int32_t ii = 0; ii < _len; ++ii) { - *_inOutStr = toLower(*_inOutStr); + _inOutStr[ii] = toLower(_inOutStr[ii]); } } @@ -153,7 +153,7 @@ namespace bx { for (int32_t ii = 0; ii < _len; ++ii) { - *_inOutStr = toUpper(*_inOutStr); + _inOutStr[ii] = toUpper(_inOutStr[ii]); } } @@ -879,11 +879,6 @@ namespace bx return 0; } - if (_param.upper) - { - toUpperUnsafe(str, len); - } - const char* dot = strFind(str, INT32_MAX, '.'); if (NULL != dot) { diff --git a/tests/vsnprintf_test.cpp b/tests/vsnprintf_test.cpp index 2b91f7c..d332ca8 100644 --- a/tests/vsnprintf_test.cpp +++ b/tests/vsnprintf_test.cpp @@ -90,6 +90,7 @@ TEST_CASE("vsnprintf f") REQUIRE(test("-1.2345670000e-9", "%.10f", -1.234567e-9) ); REQUIRE(test("3.141592", "%f", 3.1415926535897932) ); + REQUIRE(test("3.141592", "%F", 3.1415926535897932) ); REQUIRE(test("3", "%.0f", 3.1415926535897932) ); REQUIRE(test("3.1", "%.1f", 3.1415926535897932) ); REQUIRE(test("3.14", "%.2f", 3.1415926535897932) ); @@ -107,8 +108,10 @@ TEST_CASE("vsnprintf f") REQUIRE(test("3.14159265358979", "%.14f", 3.1415926535897932) ); REQUIRE(test("3.141592653589793", "%.15f", 3.1415926535897932) ); REQUIRE(test("3.1415926535897930", "%.16f", 3.1415926535897932) ); + REQUIRE(test("3.1415926535897930", "%.16F", 3.1415926535897932) ); REQUIRE(test("-3.141592e-9", "%f", -3.1415926535897932e-9) ); + REQUIRE(test("-3.141592E-9", "%F", -3.1415926535897932e-9) ); REQUIRE(test("-3e-9", "%.0f", -3.1415926535897932e-9) ); REQUIRE(test("-3.1e-9", "%.1f", -3.1415926535897932e-9) ); REQUIRE(test("-3.14e-9", "%.2f", -3.1415926535897932e-9) ); @@ -126,6 +129,7 @@ TEST_CASE("vsnprintf f") REQUIRE(test("-3.14159265358979e-9", "%.14f", -3.1415926535897932e-9) ); REQUIRE(test("-3.141592653589793e-9", "%.15f", -3.1415926535897932e-9) ); REQUIRE(test("-3.1415926535897930e-9", "%.16f", -3.1415926535897932e-9) ); + REQUIRE(test("-3.1415926535897930E-9", "%.16F", -3.1415926535897932e-9) ); REQUIRE(test("1e-12", "%f", 1e-12));