Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenlib/BLI_string.h4
-rw-r--r--source/blender/blenlib/intern/string.c12
-rw-r--r--source/blender/editors/animation/keyframes_general.c11
3 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 4d2007f9fe0..54eb76490b8 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -85,8 +85,8 @@ int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL();
int BLI_str_index_in_array_n(const char *__restrict str, const char **__restrict str_array, const int str_array_len) ATTR_NONNULL();
int BLI_str_index_in_array(const char *__restrict str, const char **__restrict str_array) ATTR_NONNULL();
-bool BLI_str_ends_with(const char *str,const char *end) ATTR_NONNULL();
-bool BLI_strn_ends_with(const char *str,const char *end, int length) ATTR_NONNULL();
+bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL();
+bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, int length) ATTR_NONNULL();
size_t BLI_str_partition(const char *str, const char delim[], char **sep, char **suf) ATTR_NONNULL();
size_t BLI_str_rpartition(const char *str, const char delim[], char **sep, char **suf) ATTR_NONNULL();
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 365e555f9a9..cc049fce7ab 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -773,12 +773,12 @@ int BLI_str_index_in_array(const char *__restrict str, const char **__restrict s
return -1;
}
-bool BLI_strn_ends_with(const char *str,const char *end, int slength)
+bool BLI_strn_endswith(const char *__restrict str,const char *__restrict end, int slength)
{
- size_t elength = strlen(end);
+ int elength = strlen(end);
if (elength < slength) {
- const char *iter = str + slength - elength;
+ const char *iter = &str[slength - elength];
while (*iter) {
if (*iter++ != *end++) {
return false;
@@ -796,10 +796,10 @@ bool BLI_strn_ends_with(const char *str,const char *end, int slength)
* \param end The string we look for at the end.
* \return If str ends with end.
*/
-bool BLI_str_ends_with(const char *str,const char *end)
+bool BLI_str_endswith(const char *__restrict str,const char *end)
{
- size_t slength = strlen(str);
- return BLI_strn_ends_with(str, end, slength);
+ int slength = strlen(str);
+ return BLI_strn_endswith(str, end, slength);
}
/**
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index ee212d6e9d9..64332f61758 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -743,17 +743,18 @@ static tAnimCopybufItem *pastebuf_match_index_only(FCurve *fcu, const short from
/* ................ */
-static void do_curve_mirror_flippping(tAnimCopybufItem *aci, BezTriple *bezt) {
+static void do_curve_mirror_flippping(tAnimCopybufItem *aci, BezTriple *bezt)
+{
if (aci->is_bone) {
int slength = strlen(aci->rna_path);
bool flip = false;
- if (BLI_strn_ends_with(aci->rna_path, "location", slength) && aci->array_index == 0)
+ if (BLI_strn_endswith(aci->rna_path, "location", slength) && aci->array_index == 0)
flip = true;
- else if (BLI_strn_ends_with(aci->rna_path, "rotation_quaternion", slength) && ELEM(aci->array_index, 2, 3))
+ else if (BLI_strn_endswith(aci->rna_path, "rotation_quaternion", slength) && ELEM(aci->array_index, 2, 3))
flip = true;
- else if (BLI_strn_ends_with(aci->rna_path, "rotation_euler", slength) && ELEM(aci->array_index, 1, 2))
+ else if (BLI_strn_endswith(aci->rna_path, "rotation_euler", slength) && ELEM(aci->array_index, 1, 2))
flip = true;
- else if (BLI_strn_ends_with(aci->rna_path, "rotation_axis_angle", slength) && ELEM(aci->array_index, 2, 3))
+ else if (BLI_strn_endswith(aci->rna_path, "rotation_axis_angle", slength) && ELEM(aci->array_index, 2, 3))
flip = true;
if (flip) {