upcase.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) | upcase.c (1cf3109ffb26a6ea572fd02436bd10458b4b2187) |
---|---|
1/* 2 * upcase.c - Generate the full NTFS Unicode upcase table in little endian. 3 * Part of the Linux-NTFS project. 4 * 5 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org> | 1/* 2 * upcase.c - Generate the full NTFS Unicode upcase table in little endian. 3 * Part of the Linux-NTFS project. 4 * 5 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org> |
6 * Copyright (c) 2001-2004 Anton Altaparmakov | 6 * Copyright (c) 2001-2006 Anton Altaparmakov |
7 * | 7 * |
8 * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. 9 * Modified for kernel inclusion 10 September 2001 by Anton Altparmakov. 10 * | |
11 * This program is free software; you can redistribute it and/or modify it 12 * under the terms of the GNU General Public License as published by the Free 13 * Software Foundation; either version 2 of the License, or (at your option) 14 * any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 51 unchanged lines hidden (view full) --- 70 71 int i, r; 72 ntfschar *uc; 73 74 uc = ntfs_malloc_nofs(default_upcase_len * sizeof(ntfschar)); 75 if (!uc) 76 return uc; 77 memset(uc, 0, default_upcase_len * sizeof(ntfschar)); | 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by the Free 10 * Software Foundation; either version 2 of the License, or (at your option) 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- 51 unchanged lines hidden (view full) --- 67 68 int i, r; 69 ntfschar *uc; 70 71 uc = ntfs_malloc_nofs(default_upcase_len * sizeof(ntfschar)); 72 if (!uc) 73 return uc; 74 memset(uc, 0, default_upcase_len * sizeof(ntfschar)); |
75 /* Generate the little endian Unicode upcase table used by ntfs. */ |
|
78 for (i = 0; i < default_upcase_len; i++) 79 uc[i] = cpu_to_le16(i); 80 for (r = 0; uc_run_table[r][0]; r++) 81 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) | 76 for (i = 0; i < default_upcase_len; i++) 77 uc[i] = cpu_to_le16(i); 78 for (r = 0; uc_run_table[r][0]; r++) 79 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) |
82 uc[i] = cpu_to_le16((le16_to_cpu(uc[i]) + 83 uc_run_table[r][2])); | 80 uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) + 81 uc_run_table[r][2]); |
84 for (r = 0; uc_dup_table[r][0]; r++) 85 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) 86 uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); 87 for (r = 0; uc_word_table[r][0]; r++) 88 uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); 89 return uc; 90} | 82 for (r = 0; uc_dup_table[r][0]; r++) 83 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) 84 uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); 85 for (r = 0; uc_word_table[r][0]; r++) 86 uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); 87 return uc; 88} |