[PATCH] nls: Fix utf16s_to_utf8s parameter type in declaration and definition

From: ye.xingchen
Date: Thu Mar 13 2025 - 04:53:05 EST


From: YeXingchen <ye.xingchen@xxxxxxxxxx>

The declaration of utf16s_to_utf8s in the header file uses
different parameter type with definition.

This patch aligns the parameter name in the definition with the
declaration,changing maxout to maxlen, inlen to len to ensure consistency.

Signed-off-by: YeXingchen <ye.xingchen@xxxxxxxxxx>
---
fs/nls/nls_base.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 18d597e49a19..09b6dbc599c9 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -183,27 +183,27 @@ static inline unsigned long get_utf16(unsigned c, enum utf16_endian endian)
}
}

-int utf16s_to_utf8s(const wchar_t *pwcs, int inlen, enum utf16_endian endian,
- u8 *s, int maxout)
+int utf16s_to_utf8s(const wchar_t *pwcs, int len, enum utf16_endian endian,
+ u8 *s, int maxlen)
{
u8 *op;
int size;
unsigned long u, v;

op = s;
- while (inlen > 0 && maxout > 0) {
+ while (len > 0 && maxlen > 0) {
u = get_utf16(*pwcs, endian);
if (!u)
break;
pwcs++;
- inlen--;
+ len--;
if (u > 0x7f) {
if ((u & SURROGATE_MASK) == SURROGATE_PAIR) {
if (u & SURROGATE_LOW) {
/* Ignore character and move on */
continue;
}
- if (inlen <= 0)
+ if (len <= 0)
break;
v = get_utf16(*pwcs, endian);
if ((v & SURROGATE_MASK) != SURROGATE_PAIR ||
@@ -214,18 +214,18 @@ int utf16s_to_utf8s(const wchar_t *pwcs, int inlen, enum utf16_endian endian,
u = PLANE_SIZE + ((u & SURROGATE_BITS) << 10)
+ (v & SURROGATE_BITS);
pwcs++;
- inlen--;
+ len--;
}
- size = utf32_to_utf8(u, op, maxout);
+ size = utf32_to_utf8(u, op, maxlen);
if (size == -1) {
/* Ignore character and move on */
} else {
op += size;
- maxout -= size;
+ maxlen -= size;
}
} else {
*op++ = (u8) u;
- maxout--;
+ maxlen--;
}
}
return op - s;
--
2.25.1