diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_string_ref.hh | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_interp.c | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index e3dd8afd588..f72106aa961 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -358,7 +358,9 @@ constexpr int64_t StringRefBase::find_first_of(StringRef chars, int64_t pos) con constexpr int64_t StringRefBase::find_first_of(char c, int64_t pos) const { - return this->find_first_of(StringRef(&c, 1), pos); + BLI_assert(pos >= 0); + return index_or_npos_to_int64( + std::string_view(*this).find_first_of(c, static_cast<size_t>(pos))); } constexpr int64_t StringRefBase::find_last_of(StringRef chars, int64_t pos) const @@ -370,7 +372,9 @@ constexpr int64_t StringRefBase::find_last_of(StringRef chars, int64_t pos) cons constexpr int64_t StringRefBase::find_last_of(char c, int64_t pos) const { - return this->find_last_of(StringRef(&c, 1), pos); + BLI_assert(pos >= 0); + return index_or_npos_to_int64( + std::string_view(*this).find_last_of(c, static_cast<size_t>(pos))); } constexpr int64_t StringRefBase::find_first_not_of(StringRef chars, int64_t pos) const @@ -382,7 +386,9 @@ constexpr int64_t StringRefBase::find_first_not_of(StringRef chars, int64_t pos) constexpr int64_t StringRefBase::find_first_not_of(char c, int64_t pos) const { - return this->find_first_not_of(StringRef(&c, 1), pos); + BLI_assert(pos >= 0); + return index_or_npos_to_int64( + std::string_view(*this).find_first_not_of(c, static_cast<size_t>(pos))); } constexpr int64_t StringRefBase::find_last_not_of(StringRef chars, int64_t pos) const @@ -394,7 +400,9 @@ constexpr int64_t StringRefBase::find_last_not_of(StringRef chars, int64_t pos) constexpr int64_t StringRefBase::find_last_not_of(char c, int64_t pos) const { - return this->find_last_not_of(StringRef(&c, 1), pos); + BLI_assert(pos >= 0); + return index_or_npos_to_int64( + std::string_view(*this).find_last_not_of(c, static_cast<size_t>(pos))); } constexpr StringRef StringRefBase::trim() const diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 3800fc58a5b..d61c6c015f6 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3299,8 +3299,8 @@ static bool point_in_slice(const float p[3], return (h >= 0.0f && h <= 1.0f); } -/* adult sister defining the slice planes by the origin and the normal - * NOTE |normal| may not be 1 but defining the thickness of the slice */ +/* Adult sister defining the slice planes by the origin and the normal. + * NOTE: |normal| may not be 1 but defining the thickness of the slice. */ static bool point_in_slice_as(const float p[3], const float origin[3], const float normal[3]) { float h, rp[3]; diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 7225ca5fc94..fed330aa2f0 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -706,9 +706,9 @@ void BLI_ewa_filter(const int width, } } - /* d should hopefully never be zero anymore */ + /* `d` should hopefully never be zero anymore. */ d = 1.0f / d; mul_v3_fl(result, d); - /* clipping can be ignored if alpha used, texr->trgba[3] already includes filtered edge */ + /* Clipping can be ignored if alpha used, `texr->trgba[3]` already includes filtered edge. */ result[3] = use_alpha ? result[3] * d : 1.0f; } |