Menu

#72 Bug: std::string::size() not like expected.

1.0
accepted
SGrottel
None
2014-04-04
2014-04-04
SGrottel
No

We have a problem.

std::string::size answers the size of the allocated memory of the string. Thus, if one stores shorter strings (e.g. bei explicitly setting a '\0' character) the returned size is not the size of the actual content.

The content size (by linear search) can be retreived through the::text::string_utility::c_str_len(str.c_str()).

However, I did not know this when I was writing the string_utility classes. Thus, e.g. string_utility::ends_with is currently broken, since it relies on str.size().

I will review all implementations in namespace the::text. I don't know of any other classes which could be affected by this issue. If there are some, add their names to this ticket.

Otherwise, I will close this ticket after fixing the classes in the::text.

Related

Tickets: #73

Discussion


Log in to post a comment.

MongoDB Logo MongoDB