[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080131122341.GC1461@duck.suse.cz>
Date: Thu, 31 Jan 2008 13:23:42 +0100
From: Jan Kara <jack@...e.cz>
To: marcin.slusarz@...il.com
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/10] udf: udf_CS0toNLS cleanup
On Wed 30-01-08 22:03:53, marcin.slusarz@...il.com wrote:
> - fix error handling - always zero output variable
> - don't zero explicitely fields zeroed by memset
> - mark "in" paramater as const
>
> Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
> Cc: Jan Kara <jack@...e.cz>
Acked-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/udf/unicode.c | 19 ++++++++-----------
> 1 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
> index f4e54e5..d068d33 100644
> --- a/fs/udf/unicode.c
> +++ b/fs/udf/unicode.c
> @@ -248,35 +248,32 @@ error_out:
> }
>
> static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
> - struct ustr *ocu_i)
> + const struct ustr *ocu_i)
> {
> - uint8_t *ocu;
> - uint32_t c;
> + const uint8_t *ocu;
> uint8_t cmp_id, ocu_len;
> int i;
>
> - ocu = ocu_i->u_name;
>
> ocu_len = ocu_i->u_len;
> - cmp_id = ocu_i->u_cmpID;
> - utf_o->u_len = 0;
> -
> if (ocu_len == 0) {
> memset(utf_o, 0, sizeof(struct ustr));
> - utf_o->u_cmpID = 0;
> - utf_o->u_len = 0;
> return 0;
> }
>
> - if ((cmp_id != 8) && (cmp_id != 16)) {
> + cmp_id = ocu_i->u_cmpID;
> + if (cmp_id != 8 && cmp_id != 16) {
> + memset(utf_o, 0, sizeof(struct ustr));
> printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n",
> cmp_id, ocu_i->u_name);
> return 0;
> }
>
> + ocu = ocu_i->u_name;
> + utf_o->u_len = 0;
> for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) {
> /* Expand OSTA compressed Unicode to Unicode */
> - c = ocu[i++];
> + uint32_t c = ocu[i++];
> if (cmp_id == 16)
> c = (c << 8) | ocu[i++];
>
> --
> 1.5.3.7
>
--
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists