X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fjfs_unicode.h;h=3fbb3a22559077e0fbfd21ae4a44cb91ebd7605e;hb=refs%2Fheads%2Fvserver;hp=af6ccd2220ef567b6ec2fd4946d1c16101aedf11;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/jfs/jfs_unicode.h b/fs/jfs/jfs_unicode.h index af6ccd222..3fbb3a225 100644 --- a/fs/jfs/jfs_unicode.h +++ b/fs/jfs/jfs_unicode.h @@ -1,19 +1,19 @@ /* - * Copyright (c) International Business Machines Corp., 2000-2002 - * Portions Copyright (c) Christoph Hellwig, 2001-2002 + * Copyright (C) International Business Machines Corp., 2000-2002 + * Portions Copyright (C) Christoph Hellwig, 2001-2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _H_JFS_UNICODE @@ -31,7 +31,7 @@ typedef struct { extern signed char UniUpperTable[512]; extern UNICASERANGE UniUpperRange[]; extern int get_UCSname(struct component_name *, struct dentry *); -extern int jfs_strfromUCS_le(char *, const wchar_t *, int, struct nls_table *); +extern int jfs_strfromUCS_le(char *, const __le16 *, int, struct nls_table *); #define free_UCSname(COMP) kfree((COMP)->name) @@ -51,10 +51,10 @@ static inline wchar_t *UniStrcpy(wchar_t * ucs1, const wchar_t * ucs2) /* * UniStrncpy: Copy length limited string with pad */ -static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, +static inline __le16 *UniStrncpy_le(__le16 * ucs1, const __le16 * ucs2, size_t n) { - wchar_t *anchor = ucs1; + __le16 *anchor = ucs1; while (n-- && *ucs2) /* Copy the strings */ *ucs1++ = *ucs2++; @@ -68,7 +68,7 @@ static inline wchar_t *UniStrncpy(wchar_t * ucs1, const wchar_t * ucs2, /* * UniStrncmp_le: Compare length limited string - native to little-endian */ -static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, +static inline int UniStrncmp_le(const wchar_t * ucs1, const __le16 * ucs2, size_t n) { if (!n) @@ -81,10 +81,27 @@ static inline int UniStrncmp_le(const wchar_t * ucs1, const wchar_t * ucs2, } /* - * UniStrncpy_le: Copy length limited string with pad to little-endian + * UniStrncpy_to_le: Copy length limited string with pad to little-endian */ -static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, - size_t n) +static inline __le16 *UniStrncpy_to_le(__le16 * ucs1, const wchar_t * ucs2, + size_t n) +{ + __le16 *anchor = ucs1; + + while (n-- && *ucs2) /* Copy the strings */ + *ucs1++ = cpu_to_le16(*ucs2++); + + n++; + while (n--) /* Pad with nulls */ + *ucs1++ = 0; + return anchor; +} + +/* + * UniStrncpy_from_le: Copy length limited string with pad from little-endian + */ +static inline wchar_t *UniStrncpy_from_le(wchar_t * ucs1, const __le16 * ucs2, + size_t n) { wchar_t *anchor = ucs1; @@ -97,7 +114,6 @@ static inline wchar_t *UniStrncpy_le(wchar_t * ucs1, const wchar_t * ucs2, return anchor; } - /* * UniToupper: Convert a unicode character to upper case */