diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-01-31 17:09:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-03 14:07:57 -0500 |
commit | 7e7742ee005c887b86fd1fd38d5b48419329dfa0 (patch) | |
tree | d3bfe43e360fe53a2c07ce2014f2f4714aa24b4b /fs/hpfs/name.c | |
parent | 1f707137b55764740981d022d29c622832a61880 (diff) |
sanitize signedness/const for pointers to char in hpfs a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hpfs/name.c')
-rw-r--r-- | fs/hpfs/name.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/hpfs/name.c b/fs/hpfs/name.c index 1f4a964384eb..f24736d7a439 100644 --- a/fs/hpfs/name.c +++ b/fs/hpfs/name.c | |||
@@ -8,16 +8,16 @@ | |||
8 | 8 | ||
9 | #include "hpfs_fn.h" | 9 | #include "hpfs_fn.h" |
10 | 10 | ||
11 | static char *text_postfix[]={ | 11 | static const char *text_postfix[]={ |
12 | ".ASM", ".BAS", ".BAT", ".C", ".CC", ".CFG", ".CMD", ".CON", ".CPP", ".DEF", | 12 | ".ASM", ".BAS", ".BAT", ".C", ".CC", ".CFG", ".CMD", ".CON", ".CPP", ".DEF", |
13 | ".DOC", ".DPR", ".ERX", ".H", ".HPP", ".HTM", ".HTML", ".JAVA", ".LOG", ".PAS", | 13 | ".DOC", ".DPR", ".ERX", ".H", ".HPP", ".HTM", ".HTML", ".JAVA", ".LOG", ".PAS", |
14 | ".RC", ".TEX", ".TXT", ".Y", ""}; | 14 | ".RC", ".TEX", ".TXT", ".Y", ""}; |
15 | 15 | ||
16 | static char *text_prefix[]={ | 16 | static const char *text_prefix[]={ |
17 | "AUTOEXEC.", "CHANGES", "COPYING", "CONFIG.", "CREDITS", "FAQ", "FILE_ID.DIZ", | 17 | "AUTOEXEC.", "CHANGES", "COPYING", "CONFIG.", "CREDITS", "FAQ", "FILE_ID.DIZ", |
18 | "MAKEFILE", "READ.ME", "README", "TERMCAP", ""}; | 18 | "MAKEFILE", "READ.ME", "README", "TERMCAP", ""}; |
19 | 19 | ||
20 | void hpfs_decide_conv(struct inode *inode, unsigned char *name, unsigned len) | 20 | void hpfs_decide_conv(struct inode *inode, const unsigned char *name, unsigned len) |
21 | { | 21 | { |
22 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); | 22 | struct hpfs_inode_info *hpfs_inode = hpfs_i(inode); |
23 | int i; | 23 | int i; |
@@ -71,7 +71,7 @@ static inline unsigned char locase(unsigned char *dir, unsigned char a) | |||
71 | return dir[a]; | 71 | return dir[a]; |
72 | } | 72 | } |
73 | 73 | ||
74 | int hpfs_chk_name(unsigned char *name, unsigned *len) | 74 | int hpfs_chk_name(const unsigned char *name, unsigned *len) |
75 | { | 75 | { |
76 | int i; | 76 | int i; |
77 | if (*len > 254) return -ENAMETOOLONG; | 77 | if (*len > 254) return -ENAMETOOLONG; |
@@ -83,10 +83,10 @@ int hpfs_chk_name(unsigned char *name, unsigned *len) | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | char *hpfs_translate_name(struct super_block *s, unsigned char *from, | 86 | unsigned char *hpfs_translate_name(struct super_block *s, unsigned char *from, |
87 | unsigned len, int lc, int lng) | 87 | unsigned len, int lc, int lng) |
88 | { | 88 | { |
89 | char *to; | 89 | unsigned char *to; |
90 | int i; | 90 | int i; |
91 | if (hpfs_sb(s)->sb_chk >= 2) if (hpfs_is_name_long(from, len) != lng) { | 91 | if (hpfs_sb(s)->sb_chk >= 2) if (hpfs_is_name_long(from, len) != lng) { |
92 | printk("HPFS: Long name flag mismatch - name "); | 92 | printk("HPFS: Long name flag mismatch - name "); |
@@ -103,8 +103,9 @@ char *hpfs_translate_name(struct super_block *s, unsigned char *from, | |||
103 | return to; | 103 | return to; |
104 | } | 104 | } |
105 | 105 | ||
106 | int hpfs_compare_names(struct super_block *s, unsigned char *n1, unsigned l1, | 106 | int hpfs_compare_names(struct super_block *s, |
107 | unsigned char *n2, unsigned l2, int last) | 107 | const unsigned char *n1, unsigned l1, |
108 | const unsigned char *n2, unsigned l2, int last) | ||
108 | { | 109 | { |
109 | unsigned l = l1 < l2 ? l1 : l2; | 110 | unsigned l = l1 < l2 ? l1 : l2; |
110 | unsigned i; | 111 | unsigned i; |
@@ -120,7 +121,7 @@ int hpfs_compare_names(struct super_block *s, unsigned char *n1, unsigned l1, | |||
120 | return 0; | 121 | return 0; |
121 | } | 122 | } |
122 | 123 | ||
123 | int hpfs_is_name_long(unsigned char *name, unsigned len) | 124 | int hpfs_is_name_long(const unsigned char *name, unsigned len) |
124 | { | 125 | { |
125 | int i,j; | 126 | int i,j; |
126 | for (i = 0; i < len && name[i] != '.'; i++) | 127 | for (i = 0; i < len && name[i] != '.'; i++) |
@@ -134,7 +135,7 @@ int hpfs_is_name_long(unsigned char *name, unsigned len) | |||
134 | 135 | ||
135 | /* OS/2 clears dots and spaces at the end of file name, so we have to */ | 136 | /* OS/2 clears dots and spaces at the end of file name, so we have to */ |
136 | 137 | ||
137 | void hpfs_adjust_length(unsigned char *name, unsigned *len) | 138 | void hpfs_adjust_length(const unsigned char *name, unsigned *len) |
138 | { | 139 | { |
139 | if (!*len) return; | 140 | if (!*len) return; |
140 | if (*len == 1 && name[0] == '.') return; | 141 | if (*len == 1 && name[0] == '.') return; |