From cd948e75c0f9c0402ad2f0d6ff376e57b11ab534 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 4 Feb 2006 06:06:04 +0000 Subject: [PATCH] Fix upcase table to be little endian. With this bug fixed the volumes produced by mkntfs on little and big endian machines are identical (except for the volume serial number - probably ought to standardize that when using the -T switch). --- ntfsprogs/upcase.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index 505e7275..a967cdd0 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -2,9 +2,7 @@ * upcase - Part of the Linux-NTFS project. * * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2004 Anton Altaparmakov - * - * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. + * Copyright (c) 2001-2006 Anton Altaparmakov * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -28,6 +26,7 @@ #include #endif +#include "endians.h" #include "types.h" #include "upcase.h" @@ -74,8 +73,9 @@ void init_upcase_table(ntfschar *uc, u32 uc_len) }; int i, r; - memset((char*)uc, 0, uc_len); + memset(uc, 0, uc_len); uc_len >>= 1; + /* Generate the upcase table in cpu byte order. */ for (i = 0; (u32)i < uc_len; i++) uc[i] = i; for (r = 0; uc_run_table[r][0]; r++) @@ -86,5 +86,7 @@ void init_upcase_table(ntfschar *uc, u32 uc_len) uc[i + 1]--; for (r = 0; uc_byte_table[r][0]; r++) uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; + /* Convert the upcase table from cpu byte order to little endian. */ + for (i = 0; (u32)i < uc_len; i++) + uc[i] = cpu_to_le16(uc[i]); } -