forked from bartvdbraak/blender
BLI_string: BLI_str_ends_with -> BLI_str_endswith
Loosely following Python str convention.
This commit is contained in:
parent
73955e2566
commit
ac619aaf38
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user