Commit 9ac9e9e2 authored by Alexander Alekhin's avatar Alexander Alekhin

core: fix String::end() implementation

parent 3450528f
...@@ -748,7 +748,7 @@ const char* String::begin() const ...@@ -748,7 +748,7 @@ const char* String::begin() const
inline inline
const char* String::end() const const char* String::end() const
{ {
return len_ ? cstr_ + 1 : 0; return len_ ? cstr_ + len_ : NULL;
} }
inline inline
......
...@@ -138,3 +138,10 @@ TEST(Core_String, find_last_of__with__empty_string) ...@@ -138,3 +138,10 @@ TEST(Core_String, find_last_of__with__empty_string)
// npos is not exported: EXPECT_EQ(cv::String::npos, p); // npos is not exported: EXPECT_EQ(cv::String::npos, p);
EXPECT_EQ(std::string::npos, p); EXPECT_EQ(std::string::npos, p);
} }
TEST(Core_String, end_method_regression)
{
cv::String old_string = "012345";
cv::String new_string(old_string.begin(), old_string.end());
EXPECT_EQ(6u, new_string.size());
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment