Lines Matching +full:4 +full:- +full:wire

1 // SPDX-License-Identifier: GPL-2.0-or-later
17 * cifs_mapchar() - convert a host-endian char to proper char in codepage
19 * @from: host-endian source string
73 len = cp->uni2char(src_char, target, NLS_MAX_CHARSET_SIZE); in cifs_mapchar()
81 if (strcmp(cp->charset, "utf8")) in cifs_mapchar()
95 * smb_utf16_bytes() - compute converted string length
137 * smb_from_utf16() - convert utf16le string to local charset
145 * Convert a little-endian utf16le string (as sent by the server) to a string
153 * Note that some windows versions actually send multiword UTF-16 characters
154 * instead of straight UTF16-2. The linux nls routines however aren't able to
168 __u16 ftmp[3]; /* ftmp[3] = 3array x 2bytes = 6bytes UTF-16 */ in smb_from_utf16()
176 safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize); in smb_from_utf16()
195 if ((outlen + charlen) > (tolen - nullsize)) in smb_from_utf16()
204 * charlen (=bytes of UTF-8 for 1 character) in smb_from_utf16()
205 * 4bytes UTF-8(surrogate pair) is charlen=4 in smb_from_utf16()
206 * (4bytes UTF-16 code) in smb_from_utf16()
207 * 7-8bytes UTF-8(IVS) is charlen=3+4 or 4+4 in smb_from_utf16()
208 * (2 UTF-8 pairs divided to 2 UTF-16 pairs) in smb_from_utf16()
210 if (charlen == 4) in smb_from_utf16()
213 /* 5-6bytes UTF-8 */ in smb_from_utf16()
217 /* properly null-terminate string */ in smb_from_utf16()
225 * smb_strtoUTF16() - Convert character string to unicode string
241 if (!strcmp(codepage->charset, "utf8")) { in smb_strtoUTF16()
243 * convert utf8 -> utf16, we assume we have enough space in smb_strtoUTF16()
261 for (i = 0; len > 0 && *from; i++, from += charlen, len -= charlen) { in smb_strtoUTF16()
262 charlen = codepage->char2uni(from, len, &wchar_to); in smb_strtoUTF16()
277 * smb_strndup_from_utf16() - copy a string from wire format to the local
302 return ERR_PTR(-ENOMEM); in smb_strndup_from_utf16()
307 return ERR_PTR(-EINVAL); in smb_strndup_from_utf16()
314 return ERR_PTR(-ENOMEM); in smb_strndup_from_utf16()
322 * Convert 16 bit Unicode pathname to wire format from string in current code
324 * only legal in POSIX-like OS (if they are present in the string). Path
325 * names are little endian 16 bit Unicode on the wire
328 * smbConvertToUTF16() - convert string from local charset to utf16
335 * Convert 16 bit Unicode pathname to wire format from string in current code
337 * only legal in POSIX-like OS (if they are present in the string). Path
338 * names are little endian 16 bit Unicode on the wire
349 wchar_t wchar_to[6]; /* UTF-16 */ in smbConvertToUTF16()
387 charlen = cp->char2uni(source + i, srclen - i, &tmp); in smbConvertToUTF16()
398 if (strcmp(cp->charset, "utf8")) in smbConvertToUTF16()
415 /* 1-3bytes UTF-8 to 2bytes UTF-16 */ in smbConvertToUTF16()
417 else if (charlen == 4) { in smbConvertToUTF16()
419 * 4bytes UTF-8(surrogate pair) to 4bytes UTF-16 in smbConvertToUTF16()
420 * 7-8bytes UTF-8(IVS) divided to 2 UTF-16 in smbConvertToUTF16()
421 * (charlen=3+4 or 4+4) in smbConvertToUTF16()
428 /* 5-6bytes UTF-8 to 6bytes UTF-16 */ in smbConvertToUTF16()