Бранимир Караџић před 6 roky
rodič
revize
d60912bcb5
2 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 1 1
      src/string.cpp
  2. 1 0
      tests/string_test.cpp

+ 1 - 1
src/string.cpp

@@ -375,7 +375,7 @@ namespace bx
 
 	inline const char* strRFindUnsafe(const char* _str, int32_t _len, char _ch)
 	{
-		for (int32_t ii = _len; 0 <= ii; --ii)
+		for (int32_t ii = _len-1; 0 <= ii; --ii)
 		{
 			if (_str[ii] == _ch)
 			{

+ 1 - 0
tests/string_test.cpp

@@ -188,6 +188,7 @@ TEST_CASE("strRFind", "")
 	REQUIRE(bx::strRFind(bx::StringView(test, 0), 's').isEmpty() );
 	REQUIRE(bx::strRFind(bx::StringView(test, 1), 's').isEmpty() );
 	REQUIRE(&test[2] == bx::strRFind(test, 's').getPtr() );
+	REQUIRE(&test[3] == bx::strRFind(test, 't').getPtr() );
 }
 
 TEST_CASE("strFindI", "")