Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/newfs_udf Fix memset() arguments to use the right type ...



details:   https://anonhg.NetBSD.org/src/rev/4692ea17e9c8
branches:  trunk
changeset: 789056:4692ea17e9c8
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Aug 05 16:44:58 2013 +0000

description:
Fix memset() arguments to use the right type for sizeof() and streamline its
use of sizeof() to allways use the right type.

diffstat:

 sbin/newfs_udf/udf_create.c |  10 +++++-----
 sbin/newfs_udf/udf_write.c  |   8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r 5a035018a90c -r 4692ea17e9c8 sbin/newfs_udf/udf_create.c
--- a/sbin/newfs_udf/udf_create.c       Mon Aug 05 16:43:46 2013 +0000
+++ b/sbin/newfs_udf/udf_create.c       Mon Aug 05 16:44:58 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.c,v 1.18 2013/08/05 14:11:30 reinoud Exp $ */
+/* $NetBSD: udf_create.c,v 1.19 2013/08/05 16:44:58 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: udf_create.c,v 1.18 2013/08/05 14:11:30 reinoud Exp $");
+__RCSID("$NetBSD: udf_create.c,v 1.19 2013/08/05 16:44:58 reinoud Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -1550,7 +1550,7 @@
        uint32_t endfid;
        uint32_t fidsize, lb_rest;
 
-       memset(fid, 0, sizeof(struct fileid_desc *));
+       memset(fid, 0, sizeof(*fid));
        udf_inittag(&fid->tag, TAGID_FID, udf_rw32(ref->loc.lb_num));
        fid->file_version_num = udf_rw16(1);    /* UDF 2.3.4.1 */
        fid->file_char = file_char;
@@ -1993,7 +1993,7 @@
        max_len = (max_len / layout.meta_blockingnr) * layout.meta_blockingnr;
        max_len = max_len * context.sector_size;
 
-       memset(&mapping, 0, sizeof(struct short_ad));
+       memset(&mapping, 0, sizeof(mapping));
        while (len) {
                part_len = MIN(len, max_len);
                mapping.lb_num   = udf_rw32(lb_num);
@@ -2227,7 +2227,7 @@
 
        assert((layout.rootdir < 2) && (layout.fsd < 2));
 
-       memset(&dataloc, 0, sizeof(struct long_ad));
+       memset(&dataloc, 0, sizeof(dataloc));
        dataloc.len = udf_rw32(context.vat_size);
        dataloc.loc.part_num = udf_rw16(context.data_part);
        dataloc.loc.lb_num   = udf_rw32(layout.vat);
diff -r 5a035018a90c -r 4692ea17e9c8 sbin/newfs_udf/udf_write.c
--- a/sbin/newfs_udf/udf_write.c        Mon Aug 05 16:43:46 2013 +0000
+++ b/sbin/newfs_udf/udf_write.c        Mon Aug 05 16:44:58 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_write.c,v 1.3 2013/08/05 14:11:30 reinoud Exp $ */
+/* $NetBSD: udf_write.c,v 1.4 2013/08/05 16:44:58 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: udf_write.c,v 1.3 2013/08/05 14:11:30 reinoud Exp $");
+__RCSID("$NetBSD: udf_write.c,v 1.4 2013/08/05 16:44:58 reinoud Exp $");
 #endif /* not lint */
 
 #define _EXPOSE_MMC
@@ -127,7 +127,7 @@
 void
 udf_metadata_alloc(int nblk, struct long_ad *pos)
 {
-       memset(pos, 0, sizeof(struct long_ad));
+       memset(pos, 0, sizeof(*pos));
        pos->len          = udf_rw32(nblk * context.sector_size);
        pos->loc.lb_num   = udf_rw32(context.metadata_alloc_pos);
        pos->loc.part_num = udf_rw16(context.metadata_part);
@@ -144,7 +144,7 @@
 void
 udf_data_alloc(int nblk, struct long_ad *pos)
 {
-       memset(pos, 0, sizeof(struct long_ad));
+       memset(pos, 0, sizeof(*pos));
        pos->len          = udf_rw32(nblk * context.sector_size);
        pos->loc.lb_num   = udf_rw32(context.data_alloc_pos);
        pos->loc.part_num = udf_rw16(context.data_part);



Home | Main Index | Thread Index | Old Index