From 4b9494f8e8afc4a46a1780cb88090888b9b0b874 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 4 Sep 2019 15:47:08 +0200 Subject: Minor improvement to path_traits::find_extension() --- libbutl/path.mxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libbutl/path.mxx b/libbutl/path.mxx index 685e15a..ca034c9 100644 --- a/libbutl/path.mxx +++ b/libbutl/path.mxx @@ -317,9 +317,12 @@ LIBBUTL_MODEXPORT namespace butl // Return the position of '.' or npos if there is no extension. // static size_type - find_extension (string_type const& s) + find_extension (string_type const& s, size_type n = string_type::npos) { - const C* r (find_extension (s.c_str (), s.size ())); + if (n == string_type::npos) + n = s.size (); + + const C* r (find_extension (s.c_str (), n)); return r != nullptr ? r - s.c_str () : string_type::npos; } -- cgit v1.1