diff options
author | Steve French <sfrench@us.ibm.com> | 2005-11-11 18:18:19 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-11-11 18:18:19 -0500 |
commit | e89dc9209692293434da45ec31826a55becb91c0 (patch) | |
tree | 171ebb84c30467cbff8a5bf8213dbf40e64d84f7 /fs/cifs/cifs_unicode.c | |
parent | 8b94bcb923dff923a5a5b7c6f890702a54cb19cf (diff) |
[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.c | 13 |
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 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifs_unicode.c | 2 | * fs/cifs/cifs_unicode.c |
3 | * | 3 | * |
4 | * Copyright (c) International Business Machines Corp., 2000,2002 | 4 | * Copyright (c) International Business Machines Corp., 2000,2005 |
5 | * Modified by Steve French (sfrench@us.ibm.com) | 5 | * Modified by Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -31,7 +31,7 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | int | 33 | int |
34 | cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ | 34 | cifs_strfromUCS_le(char *to, const __le16 * from, |
35 | int len, const struct nls_table *codepage) | 35 | int len, const struct nls_table *codepage) |
36 | { | 36 | { |
37 | int i; | 37 | int i; |
@@ -60,25 +60,26 @@ cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ | |||
60 | * | 60 | * |
61 | */ | 61 | */ |
62 | int | 62 | int |
63 | cifs_strtoUCS(wchar_t * to, const char *from, int len, | 63 | cifs_strtoUCS(__le16 * to, const char *from, int len, |
64 | const struct nls_table *codepage) | 64 | const struct nls_table *codepage) |
65 | { | 65 | { |
66 | int charlen; | 66 | int charlen; |
67 | int i; | 67 | int i; |
68 | wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */ | ||
68 | 69 | ||
69 | for (i = 0; len && *from; i++, from += charlen, len -= charlen) { | 70 | for (i = 0; len && *from; i++, from += charlen, len -= charlen) { |
70 | 71 | ||
71 | /* works for 2.4.0 kernel or later */ | 72 | /* works for 2.4.0 kernel or later */ |
72 | charlen = codepage->char2uni(from, len, &to[i]); | 73 | charlen = codepage->char2uni(from, len, &wchar_to[i]); |
73 | if (charlen < 1) { | 74 | if (charlen < 1) { |
74 | cERROR(1, | 75 | cERROR(1, |
75 | ("cifs_strtoUCS: char2uni returned %d", | 76 | ("cifs_strtoUCS: char2uni returned %d", |
76 | charlen)); | 77 | charlen)); |
77 | /* A question mark */ | 78 | /* A question mark */ |
78 | to[i] = (wchar_t)cpu_to_le16(0x003f); | 79 | to[i] = cpu_to_le16(0x003f); |
79 | charlen = 1; | 80 | charlen = 1; |
80 | } else | 81 | } else |
81 | to[i] = (wchar_t)cpu_to_le16(to[i]); | 82 | to[i] = cpu_to_le16(wchar_to[i]); |
82 | 83 | ||
83 | } | 84 | } |
84 | 85 | ||