Fix building with very strict flags, use size_t rather than int for string length.

Reported on bf-committers.
This commit is contained in:
Bastien Montagne 2015-01-10 19:13:38 +01:00
parent ab3f037ccc
commit 5357474ad8
3 changed files with 5 additions and 5 deletions

View File

@ -86,7 +86,7 @@ int BLI_str_index_in_array_n(const char *__restrict str, const char **__restrict
int BLI_str_index_in_array(const char *__restrict str, const char **__restrict str_array) 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();
bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, size_t 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();

View File

@ -773,9 +773,9 @@ int BLI_str_index_in_array(const char *__restrict str, const char **__restrict s
return -1;
}
bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, int slength)
bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, size_t slength)
{
int elength = strlen(end);
size_t elength = strlen(end);
if (elength < slength) {
const char *iter = &str[slength - elength];
@ -798,7 +798,7 @@ bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, i
*/
bool BLI_str_endswith(const char *__restrict str, const char *end)
{
int slength = strlen(str);
const size_t slength = strlen(str);
return BLI_strn_endswith(str, end, slength);
}

View File

@ -747,7 +747,7 @@ static tAnimCopybufItem *pastebuf_match_index_only(FCurve *fcu, const short from
static void do_curve_mirror_flippping(tAnimCopybufItem *aci, BezTriple *bezt)
{
if (aci->is_bone) {
int slength = strlen(aci->rna_path);
const size_t slength = strlen(aci->rna_path);
bool flip = false;
if (BLI_strn_endswith(aci->rna_path, "location", slength) && aci->array_index == 0)
flip = true;