New API function ntfs_ucsnlen().

(Logical change 1.52)
edge.strict_endians
cantab.net!aia21 2002-12-25 19:17:56 +00:00
parent a8d091270f
commit 0e871e83b2
3 changed files with 27 additions and 0 deletions

View File

@ -165,6 +165,8 @@
- Don't free extent inodes in attrib.c! (Szakacsits Szabolcs)
- Return the attribute list attribute when enumerating attributes, too.
Thanks to Szakacsits Szabolcs for pointing this problem out.
- New API function provided by unistr.[hc] and use it in mkntfs:
ntfs_ucsnlen().
12/03/2002 - 1.6.0 - More mkntfs options and cleanups.
Fix typo in usage information of mkntfs. Thanks to Richard Russon for

View File

@ -42,6 +42,8 @@ extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n);
extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
const uchar_t *upcase, const u32 upcase_size);
extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen);
extern void ntfs_name_upcase(uchar_t *name, u32 name_len,
const uchar_t *upcase, const u32 upcase_len);

View File

@ -227,6 +227,29 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
return 0;
}
/**
* ntfs_ucsnlen - determine the length of a little endian Unicode string
* @s: pointer to Unicode string
* @maxlen: maximum length of string @s
*
* Return the number of Unicode characters in the little endian Unicode
* string @s up to a maximum of maxlen Unicode characters, not including
* the terminating (uchar_t)'\0'. If there is no (uchar_t)'\0' between @s
* and @s + @maxlen, @maxlen is returned.
*
* This function never looks beyond @s + @maxlen.
*/
u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen)
{
u32 i;
for (i = 0; i < maxlen; i++) {
if (!le16_to_cpu(s[i]))
break;
}
return i;
}
/**
* ntfs_name_upcase
*/