Cleanup: avoid '_ln' suffix
Use '_len' or '_line_number'.
This commit is contained in:
@@ -27,14 +27,14 @@ TEST(string, StrPartition)
|
|||||||
{
|
{
|
||||||
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *str = "mat.e-r_ial";
|
const char *str = "mat.e-r_ial";
|
||||||
|
|
||||||
/* "mat.e-r_ial" -> "mat", '.', "e-r_ial", 3 */
|
/* "mat.e-r_ial" -> "mat", '.', "e-r_ial", 3 */
|
||||||
pre_ln = BLI_str_partition(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 3);
|
EXPECT_EQ(pre_len, 3);
|
||||||
EXPECT_EQ(&str[3], sep);
|
EXPECT_EQ(&str[3], sep);
|
||||||
EXPECT_STREQ("e-r_ial", suf);
|
EXPECT_STREQ("e-r_ial", suf);
|
||||||
}
|
}
|
||||||
@@ -44,8 +44,8 @@ TEST(string, StrPartition)
|
|||||||
const char *str = ".mate-rial--";
|
const char *str = ".mate-rial--";
|
||||||
|
|
||||||
/* ".mate-rial--" -> "", '.', "mate-rial--", 0 */
|
/* ".mate-rial--" -> "", '.', "mate-rial--", 0 */
|
||||||
pre_ln = BLI_str_partition(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(&str[0], sep);
|
EXPECT_EQ(&str[0], sep);
|
||||||
EXPECT_STREQ("mate-rial--", suf);
|
EXPECT_STREQ("mate-rial--", suf);
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,8 @@ TEST(string, StrPartition)
|
|||||||
const char *str = ".__.--_";
|
const char *str = ".__.--_";
|
||||||
|
|
||||||
/* ".__.--_" -> "", '.', "__.--_", 0 */
|
/* ".__.--_" -> "", '.', "__.--_", 0 */
|
||||||
pre_ln = BLI_str_partition(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(&str[0], sep);
|
EXPECT_EQ(&str[0], sep);
|
||||||
EXPECT_STREQ("__.--_", suf);
|
EXPECT_STREQ("__.--_", suf);
|
||||||
}
|
}
|
||||||
@@ -64,8 +64,8 @@ TEST(string, StrPartition)
|
|||||||
const char *str = "";
|
const char *str = "";
|
||||||
|
|
||||||
/* "" -> "", NULL, NULL, 0 */
|
/* "" -> "", NULL, NULL, 0 */
|
||||||
pre_ln = BLI_str_partition(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -74,8 +74,8 @@ TEST(string, StrPartition)
|
|||||||
const char *str = "material";
|
const char *str = "material";
|
||||||
|
|
||||||
/* "material" -> "material", NULL, NULL, 8 */
|
/* "material" -> "material", NULL, NULL, 8 */
|
||||||
pre_ln = BLI_str_partition(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 8);
|
EXPECT_EQ(pre_len, 8);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -86,14 +86,14 @@ TEST(string, StrRPartition)
|
|||||||
{
|
{
|
||||||
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *str = "mat.e-r_ial";
|
const char *str = "mat.e-r_ial";
|
||||||
|
|
||||||
/* "mat.e-r_ial" -> "mat.e-r", '_', "ial", 7 */
|
/* "mat.e-r_ial" -> "mat.e-r", '_', "ial", 7 */
|
||||||
pre_ln = BLI_str_rpartition(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 7);
|
EXPECT_EQ(pre_len, 7);
|
||||||
EXPECT_EQ(&str[7], sep);
|
EXPECT_EQ(&str[7], sep);
|
||||||
EXPECT_STREQ("ial", suf);
|
EXPECT_STREQ("ial", suf);
|
||||||
}
|
}
|
||||||
@@ -103,8 +103,8 @@ TEST(string, StrRPartition)
|
|||||||
const char *str = ".mate-rial--";
|
const char *str = ".mate-rial--";
|
||||||
|
|
||||||
/* ".mate-rial--" -> ".mate-rial-", '-', "", 11 */
|
/* ".mate-rial--" -> ".mate-rial-", '-', "", 11 */
|
||||||
pre_ln = BLI_str_rpartition(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 11);
|
EXPECT_EQ(pre_len, 11);
|
||||||
EXPECT_EQ(&str[11], sep);
|
EXPECT_EQ(&str[11], sep);
|
||||||
EXPECT_STREQ("", suf);
|
EXPECT_STREQ("", suf);
|
||||||
}
|
}
|
||||||
@@ -113,8 +113,8 @@ TEST(string, StrRPartition)
|
|||||||
const char *str = ".__.--_";
|
const char *str = ".__.--_";
|
||||||
|
|
||||||
/* ".__.--_" -> ".__.--", '_', "", 6 */
|
/* ".__.--_" -> ".__.--", '_', "", 6 */
|
||||||
pre_ln = BLI_str_rpartition(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 6);
|
EXPECT_EQ(pre_len, 6);
|
||||||
EXPECT_EQ(&str[6], sep);
|
EXPECT_EQ(&str[6], sep);
|
||||||
EXPECT_STREQ("", suf);
|
EXPECT_STREQ("", suf);
|
||||||
}
|
}
|
||||||
@@ -123,8 +123,8 @@ TEST(string, StrRPartition)
|
|||||||
const char *str = "";
|
const char *str = "";
|
||||||
|
|
||||||
/* "" -> "", NULL, NULL, 0 */
|
/* "" -> "", NULL, NULL, 0 */
|
||||||
pre_ln = BLI_str_rpartition(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -133,8 +133,8 @@ TEST(string, StrRPartition)
|
|||||||
const char *str = "material";
|
const char *str = "material";
|
||||||
|
|
||||||
/* "material" -> "material", NULL, NULL, 8 */
|
/* "material" -> "material", NULL, NULL, 8 */
|
||||||
pre_ln = BLI_str_rpartition(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 8);
|
EXPECT_EQ(pre_len, 8);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ TEST(string, StrPartitionEx)
|
|||||||
{
|
{
|
||||||
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
const char delim[] = {'-', '.', '_', '~', '\\', '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
/* Only considering 'from_right' cases here. */
|
/* Only considering 'from_right' cases here. */
|
||||||
|
|
||||||
@@ -153,8 +153,8 @@ TEST(string, StrPartitionEx)
|
|||||||
const char *str = "mat.e-r_ia.l";
|
const char *str = "mat.e-r_ia.l";
|
||||||
|
|
||||||
/* "mat.e-r_ia.l" over "mat.e-r" -> "mat.e", '.', "r_ia.l", 3 */
|
/* "mat.e-r_ia.l" over "mat.e-r" -> "mat.e", '.', "r_ia.l", 3 */
|
||||||
pre_ln = BLI_str_partition_ex(str, str + 6, delim, &sep, &suf, true);
|
pre_len = BLI_str_partition_ex(str, str + 6, delim, &sep, &suf, true);
|
||||||
EXPECT_EQ(pre_ln, 5);
|
EXPECT_EQ(pre_len, 5);
|
||||||
EXPECT_EQ(&str[5], sep);
|
EXPECT_EQ(&str[5], sep);
|
||||||
EXPECT_STREQ("r_ia.l", suf);
|
EXPECT_STREQ("r_ia.l", suf);
|
||||||
}
|
}
|
||||||
@@ -164,8 +164,8 @@ TEST(string, StrPartitionEx)
|
|||||||
const char *str = "mate.rial";
|
const char *str = "mate.rial";
|
||||||
|
|
||||||
/* "mate.rial" over "mate" -> "mate.rial", NULL, NULL, 4 */
|
/* "mate.rial" over "mate" -> "mate.rial", NULL, NULL, 4 */
|
||||||
pre_ln = BLI_str_partition_ex(str, str + 4, delim, &sep, &suf, true);
|
pre_len = BLI_str_partition_ex(str, str + 4, delim, &sep, &suf, true);
|
||||||
EXPECT_EQ(pre_ln, 4);
|
EXPECT_EQ(pre_len, 4);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -176,14 +176,14 @@ TEST(string, StrPartitionUtf8)
|
|||||||
{
|
{
|
||||||
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *str = "ma\xc3\xb1te-r\xe2\x98\xafial";
|
const char *str = "ma\xc3\xb1te-r\xe2\x98\xafial";
|
||||||
|
|
||||||
/* "ma\xc3\xb1te-r\xe2\x98\xafial" -> "ma", '\xc3\xb1', "te-r\xe2\x98\xafial", 2 */
|
/* "ma\xc3\xb1te-r\xe2\x98\xafial" -> "ma", '\xc3\xb1', "te-r\xe2\x98\xafial", 2 */
|
||||||
pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 2);
|
EXPECT_EQ(pre_len, 2);
|
||||||
EXPECT_EQ(&str[2], sep);
|
EXPECT_EQ(&str[2], sep);
|
||||||
EXPECT_STREQ("te-r\xe2\x98\xafial", suf);
|
EXPECT_STREQ("te-r\xe2\x98\xafial", suf);
|
||||||
}
|
}
|
||||||
@@ -193,8 +193,8 @@ TEST(string, StrPartitionUtf8)
|
|||||||
const char *str = "\xe2\x98\xafmate-rial-\xc3\xb1";
|
const char *str = "\xe2\x98\xafmate-rial-\xc3\xb1";
|
||||||
|
|
||||||
/* "\xe2\x98\xafmate-rial-\xc3\xb1" -> "", '\xe2\x98\xaf', "mate-rial-\xc3\xb1", 0 */
|
/* "\xe2\x98\xafmate-rial-\xc3\xb1" -> "", '\xe2\x98\xaf', "mate-rial-\xc3\xb1", 0 */
|
||||||
pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(&str[0], sep);
|
EXPECT_EQ(&str[0], sep);
|
||||||
EXPECT_STREQ("mate-rial-\xc3\xb1", suf);
|
EXPECT_STREQ("mate-rial-\xc3\xb1", suf);
|
||||||
}
|
}
|
||||||
@@ -203,8 +203,8 @@ TEST(string, StrPartitionUtf8)
|
|||||||
const char *str = "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1";
|
const char *str = "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1";
|
||||||
|
|
||||||
/* "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1" -> "", '\xe2\x98\xaf', ".\xc3\xb1_.--\xc3\xb1", 0 */
|
/* "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1" -> "", '\xe2\x98\xaf', ".\xc3\xb1_.--\xc3\xb1", 0 */
|
||||||
pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(&str[0], sep);
|
EXPECT_EQ(&str[0], sep);
|
||||||
EXPECT_STREQ(".\xc3\xb1_.--\xc3\xb1", suf);
|
EXPECT_STREQ(".\xc3\xb1_.--\xc3\xb1", suf);
|
||||||
}
|
}
|
||||||
@@ -213,8 +213,8 @@ TEST(string, StrPartitionUtf8)
|
|||||||
const char *str = "";
|
const char *str = "";
|
||||||
|
|
||||||
/* "" -> "", NULL, NULL, 0 */
|
/* "" -> "", NULL, NULL, 0 */
|
||||||
pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -223,8 +223,8 @@ TEST(string, StrPartitionUtf8)
|
|||||||
const char *str = "material";
|
const char *str = "material";
|
||||||
|
|
||||||
/* "material" -> "material", NULL, NULL, 8 */
|
/* "material" -> "material", NULL, NULL, 8 */
|
||||||
pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_partition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 8);
|
EXPECT_EQ(pre_len, 8);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -235,14 +235,14 @@ TEST(string, StrRPartitionUtf8)
|
|||||||
{
|
{
|
||||||
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *str = "ma\xc3\xb1te-r\xe2\x98\xafial";
|
const char *str = "ma\xc3\xb1te-r\xe2\x98\xafial";
|
||||||
|
|
||||||
/* "ma\xc3\xb1te-r\xe2\x98\xafial" -> "mat\xc3\xb1te-r", '\xe2\x98\xaf', "ial", 8 */
|
/* "ma\xc3\xb1te-r\xe2\x98\xafial" -> "mat\xc3\xb1te-r", '\xe2\x98\xaf', "ial", 8 */
|
||||||
pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 8);
|
EXPECT_EQ(pre_len, 8);
|
||||||
EXPECT_EQ(&str[8], sep);
|
EXPECT_EQ(&str[8], sep);
|
||||||
EXPECT_STREQ("ial", suf);
|
EXPECT_STREQ("ial", suf);
|
||||||
}
|
}
|
||||||
@@ -252,8 +252,8 @@ TEST(string, StrRPartitionUtf8)
|
|||||||
const char *str = "\xe2\x98\xafmate-rial-\xc3\xb1";
|
const char *str = "\xe2\x98\xafmate-rial-\xc3\xb1";
|
||||||
|
|
||||||
/* "\xe2\x98\xafmate-rial-\xc3\xb1" -> "\xe2\x98\xafmate-rial-", '\xc3\xb1', "", 13 */
|
/* "\xe2\x98\xafmate-rial-\xc3\xb1" -> "\xe2\x98\xafmate-rial-", '\xc3\xb1', "", 13 */
|
||||||
pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 13);
|
EXPECT_EQ(pre_len, 13);
|
||||||
EXPECT_EQ(&str[13], sep);
|
EXPECT_EQ(&str[13], sep);
|
||||||
EXPECT_STREQ("", suf);
|
EXPECT_STREQ("", suf);
|
||||||
}
|
}
|
||||||
@@ -262,8 +262,8 @@ TEST(string, StrRPartitionUtf8)
|
|||||||
const char *str = "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1";
|
const char *str = "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1";
|
||||||
|
|
||||||
/* "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1" -> "\xe2\x98\xaf.\xc3\xb1_.--", '\xc3\xb1', "", 10 */
|
/* "\xe2\x98\xaf.\xc3\xb1_.--\xc3\xb1" -> "\xe2\x98\xaf.\xc3\xb1_.--", '\xc3\xb1', "", 10 */
|
||||||
pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 10);
|
EXPECT_EQ(pre_len, 10);
|
||||||
EXPECT_EQ(&str[10], sep);
|
EXPECT_EQ(&str[10], sep);
|
||||||
EXPECT_STREQ("", suf);
|
EXPECT_STREQ("", suf);
|
||||||
}
|
}
|
||||||
@@ -272,8 +272,8 @@ TEST(string, StrRPartitionUtf8)
|
|||||||
const char *str = "";
|
const char *str = "";
|
||||||
|
|
||||||
/* "" -> "", NULL, NULL, 0 */
|
/* "" -> "", NULL, NULL, 0 */
|
||||||
pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 0);
|
EXPECT_EQ(pre_len, 0);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -282,8 +282,8 @@ TEST(string, StrRPartitionUtf8)
|
|||||||
const char *str = "material";
|
const char *str = "material";
|
||||||
|
|
||||||
/* "material" -> "material", NULL, NULL, 8 */
|
/* "material" -> "material", NULL, NULL, 8 */
|
||||||
pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
pre_len = BLI_str_rpartition_utf8(str, delim, &sep, &suf);
|
||||||
EXPECT_EQ(pre_ln, 8);
|
EXPECT_EQ(pre_len, 8);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ TEST(string, StrPartitionExUtf8)
|
|||||||
{
|
{
|
||||||
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
const unsigned int delim[] = {'-', '.', '_', 0x00F1 /* n tilde */, 0x262F /* ying-yang */, '\0'};
|
||||||
const char *sep, *suf;
|
const char *sep, *suf;
|
||||||
size_t pre_ln;
|
size_t pre_len;
|
||||||
|
|
||||||
/* Only considering 'from_right' cases here. */
|
/* Only considering 'from_right' cases here. */
|
||||||
|
|
||||||
@@ -303,8 +303,8 @@ TEST(string, StrPartitionExUtf8)
|
|||||||
|
|
||||||
/* "ma\xc3\xb1te-r\xe2\x98\xafial" over
|
/* "ma\xc3\xb1te-r\xe2\x98\xafial" over
|
||||||
* "ma\xc3\xb1te" -> "ma", '\xc3\xb1', "te-r\xe2\x98\xafial", 2 */
|
* "ma\xc3\xb1te" -> "ma", '\xc3\xb1', "te-r\xe2\x98\xafial", 2 */
|
||||||
pre_ln = BLI_str_partition_ex_utf8(str, str + 6, delim, &sep, &suf, true);
|
pre_len = BLI_str_partition_ex_utf8(str, str + 6, delim, &sep, &suf, true);
|
||||||
EXPECT_EQ(pre_ln, 2);
|
EXPECT_EQ(pre_len, 2);
|
||||||
EXPECT_EQ(&str[2], sep);
|
EXPECT_EQ(&str[2], sep);
|
||||||
EXPECT_STREQ("te-r\xe2\x98\xafial", suf);
|
EXPECT_STREQ("te-r\xe2\x98\xafial", suf);
|
||||||
}
|
}
|
||||||
@@ -314,8 +314,8 @@ TEST(string, StrPartitionExUtf8)
|
|||||||
const char *str = "mate\xe2\x98\xafrial";
|
const char *str = "mate\xe2\x98\xafrial";
|
||||||
|
|
||||||
/* "mate\xe2\x98\xafrial" over "mate" -> "mate\xe2\x98\xafrial", NULL, NULL, 4 */
|
/* "mate\xe2\x98\xafrial" over "mate" -> "mate\xe2\x98\xafrial", NULL, NULL, 4 */
|
||||||
pre_ln = BLI_str_partition_ex_utf8(str, str + 4, delim, &sep, &suf, true);
|
pre_len = BLI_str_partition_ex_utf8(str, str + 4, delim, &sep, &suf, true);
|
||||||
EXPECT_EQ(pre_ln, 4);
|
EXPECT_EQ(pre_len, 4);
|
||||||
EXPECT_EQ(sep, (void *)nullptr);
|
EXPECT_EQ(sep, (void *)nullptr);
|
||||||
EXPECT_EQ(suf, (void *)nullptr);
|
EXPECT_EQ(suf, (void *)nullptr);
|
||||||
}
|
}
|
||||||
|
@@ -1223,7 +1223,7 @@ typedef struct uiEditSourceStore {
|
|||||||
|
|
||||||
typedef struct uiEditSourceButStore {
|
typedef struct uiEditSourceButStore {
|
||||||
char py_dbg_fn[FILE_MAX];
|
char py_dbg_fn[FILE_MAX];
|
||||||
int py_dbg_ln;
|
int py_dbg_line_number;
|
||||||
} uiEditSourceButStore;
|
} uiEditSourceButStore;
|
||||||
|
|
||||||
/* should only ever be set while the edit source operator is running */
|
/* should only ever be set while the edit source operator is running */
|
||||||
@@ -1276,21 +1276,21 @@ void UI_editsource_active_but_test(uiBut *but)
|
|||||||
struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__);
|
struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__);
|
||||||
|
|
||||||
const char *fn;
|
const char *fn;
|
||||||
int lineno = -1;
|
int line_number = -1;
|
||||||
|
|
||||||
# if 0
|
# if 0
|
||||||
printf("comparing buttons: '%s' == '%s'\n", but->drawstr, ui_editsource_info->but_orig.drawstr);
|
printf("comparing buttons: '%s' == '%s'\n", but->drawstr, ui_editsource_info->but_orig.drawstr);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
PyC_FileAndNum_Safe(&fn, &lineno);
|
PyC_FileAndNum_Safe(&fn, &line_number);
|
||||||
|
|
||||||
if (lineno != -1) {
|
if (line_number != -1) {
|
||||||
BLI_strncpy(but_store->py_dbg_fn, fn, sizeof(but_store->py_dbg_fn));
|
BLI_strncpy(but_store->py_dbg_fn, fn, sizeof(but_store->py_dbg_fn));
|
||||||
but_store->py_dbg_ln = lineno;
|
but_store->py_dbg_line_number = line_number;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
but_store->py_dbg_fn[0] = '\0';
|
but_store->py_dbg_fn[0] = '\0';
|
||||||
but_store->py_dbg_ln = -1;
|
but_store->py_dbg_line_number = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_ghash_insert(ui_editsource_info->hash, but, but_store);
|
BLI_ghash_insert(ui_editsource_info->hash, but, but_store);
|
||||||
@@ -1375,8 +1375,8 @@ static int editsource_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (but_store) {
|
if (but_store) {
|
||||||
if (but_store->py_dbg_ln != -1) {
|
if (but_store->py_dbg_line_number != -1) {
|
||||||
ret = editsource_text_edit(C, op, but_store->py_dbg_fn, but_store->py_dbg_ln);
|
ret = editsource_text_edit(C, op, but_store->py_dbg_fn, but_store->py_dbg_line_number);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BKE_report(
|
BKE_report(
|
||||||
|
Reference in New Issue
Block a user