]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/hfsplus/unicode.c
hfsplus: add support of manipulation by attributes file
[karo-tx-linux.git] / fs / hfsplus / unicode.c
index a32998f29f0b7f1f3ef28563013ccbb878541a23..2c2e47dcfdd8aaceb0b297e7e340f02e8df6fe5d 100644 (file)
@@ -295,7 +295,8 @@ static inline u16 *decompose_unichar(wchar_t uc, int *size)
        return hfsplus_decompose_table + (off / 4);
 }
 
-int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr,
+int hfsplus_asc2uni(struct super_block *sb,
+                   struct hfsplus_unistr *ustr, int max_unistr_len,
                    const char *astr, int len)
 {
        int size, dsize, decompose;
@@ -303,7 +304,7 @@ int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr,
        wchar_t c;
 
        decompose = !test_bit(HFSPLUS_SB_NODECOMPOSE, &HFSPLUS_SB(sb)->flags);
-       while (outlen < HFSPLUS_MAX_STRLEN && len > 0) {
+       while (outlen < max_unistr_len && len > 0) {
                size = asc2unichar(sb, astr, len, &c);
 
                if (decompose)
@@ -311,7 +312,7 @@ int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr,
                else
                        dstr = NULL;
                if (dstr) {
-                       if (outlen + dsize > HFSPLUS_MAX_STRLEN)
+                       if (outlen + dsize > max_unistr_len)
                                break;
                        do {
                                ustr->unicode[outlen++] = cpu_to_be16(*dstr++);