Skip to content

Commit ca60c39

Browse files
committed
Tune: Rename functions
1 parent bfe1fc0 commit ca60c39

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

cutf.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ size_t utf8ztowchar(const char* s, wchar_t* out, size_t outsize)
437437
return utf8towchar(s, SIZE_MAX, out, outsize);
438438
}
439439

440-
size_t utf8zlength(const char* s)
440+
size_t utf8zestimate(const char* s)
441441
{
442442
return utf8towchar(s, SIZE_MAX, NULL, 0);
443443
}
@@ -461,7 +461,7 @@ size_t wcharztoutf8(const wchar_t* s, char* out, size_t outsize)
461461
return wchartoutf8(s, SIZE_MAX, out, outsize);
462462
}
463463

464-
size_t wcharzlength(const wchar_t* ws)
464+
size_t wcharzestimate(const wchar_t* ws)
465465
{
466466
return wchartoutf8(ws, SIZE_MAX, NULL, 0);
467467
}

cutf.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ extern "C"
1818
//----------------------------------------------------------------------------------------
1919

2020
//
21-
// Estimates how much buffer length is required to convert utf-8 to wchar_t
21+
// Estimates how much buffer length is required to convert utf-8 to wchar_t (string length + 1)
2222
//
23-
size_t utf8zlength(const char* s);
23+
size_t utf8zestimate(const char* s);
2424

2525
//
2626
// Converts utf-8 string to wide version.
@@ -38,9 +38,9 @@ size_t utf8ztowchar(const char* s, wchar_t* out, size_t outsize);
3838

3939

4040
//
41-
// Estimates how much buffer length is required to convert wide string to utf-8.
41+
// Estimates how much many elements in characters is required to convert wide string to utf-8 (string length + 1)
4242
//
43-
size_t wcharzlength(const wchar_t* ws);
43+
size_t wcharzestimate(const wchar_t* ws);
4444

4545
//
4646
// Converts wide string to utf-8 string.

test2.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int simpleStringTest()
2626
size_t r = 0;
2727
const wchar_t* chineseText = L"主体";
2828

29-
ok(wcharzlength(chineseText) == 7);
29+
ok(wcharzestimate(chineseText) == 7);
3030

3131
auto s = widetoutf8(chineseText);
3232

@@ -39,7 +39,7 @@ int simpleStringTest()
3939
ok(((uint8_t)s[i]) == utf8_array[i]);
4040

4141
// 2 chars + zero
42-
ok(utf8zlength((char*)utf8_array) == 3);
42+
ok(utf8zestimate((char*)utf8_array) == 3);
4343

4444
auto ws = utf8towide(s);
4545
ok(ws.length() == 2);

0 commit comments

Comments
 (0)