summaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_unicode.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-11 15:18:19 -0800
committerSteve French <sfrench@us.ibm.com>2005-11-11 15:18:19 -0800
commite89dc9209692293434da45ec31826a55becb91c0 (patch)
tree171ebb84c30467cbff8a5bf8213dbf40e64d84f7 /fs/cifs/cifs_unicode.c
parent8b94bcb923dff923a5a5b7c6f890702a54cb19cf (diff)
downloadblackbird-op-linux-e89dc9209692293434da45ec31826a55becb91c0.tar.gz
blackbird-op-linux-e89dc9209692293434da45ec31826a55becb91c0.zip
[CIFS] Cleanup sparse warnings for unicode little endian casts
Following Shaggy's suggestion, do a better job on the unicode string handling routines in cifs in specifying that the wchar_t are really little endian widechars (__le16). Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifs_unicode.c')
-rw-r--r--fs/cifs/cifs_unicode.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 4e12053f0806..d2b128255944 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -1,7 +1,7 @@
/*
* fs/cifs/cifs_unicode.c
*
- * Copyright (c) International Business Machines Corp., 2000,2002
+ * Copyright (c) International Business Machines Corp., 2000,2005
* Modified by Steve French (sfrench@us.ibm.com)
*
* This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
*
*/
int
-cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
+cifs_strfromUCS_le(char *to, const __le16 * from,
int len, const struct nls_table *codepage)
{
int i;
@@ -60,25 +60,26 @@ cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
*
*/
int
-cifs_strtoUCS(wchar_t * to, const char *from, int len,
+cifs_strtoUCS(__le16 * to, const char *from, int len,
const struct nls_table *codepage)
{
int charlen;
int i;
+ wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
/* works for 2.4.0 kernel or later */
- charlen = codepage->char2uni(from, len, &to[i]);
+ charlen = codepage->char2uni(from, len, &wchar_to[i]);
if (charlen < 1) {
cERROR(1,
("cifs_strtoUCS: char2uni returned %d",
charlen));
/* A question mark */
- to[i] = (wchar_t)cpu_to_le16(0x003f);
+ to[i] = cpu_to_le16(0x003f);
charlen = 1;
} else
- to[i] = (wchar_t)cpu_to_le16(to[i]);
+ to[i] = cpu_to_le16(wchar_to[i]);
}
OpenPOWER on IntegriCloud