Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin Iterate over fields of struct seperately to avoid warni...
details: https://anonhg.NetBSD.org/src/rev/cb4064afdb92
branches: trunk
changeset: 795255:cb4064afdb92
user: justin <justin%NetBSD.org@localhost>
date: Sat Apr 05 12:32:27 2014 +0000
description:
Iterate over fields of struct seperately to avoid warnings from pedantic compilers
diffstat:
sbin/fsck_ffs/inode.c | 14 ++++++++++----
sbin/newfs/mkfs.c | 12 ++++++++----
2 files changed, 18 insertions(+), 8 deletions(-)
diffs (86 lines):
diff -r d803b3d7d3cb -r cb4064afdb92 sbin/fsck_ffs/inode.c
--- a/sbin/fsck_ffs/inode.c Sat Apr 05 11:18:03 2014 +0000
+++ b/sbin/fsck_ffs/inode.c Sat Apr 05 12:32:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inode.c,v 1.70 2013/12/02 18:46:52 bouyer Exp $ */
+/* $NetBSD: inode.c,v 1.71 2014/04/05 12:32:27 justin Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: inode.c,v 1.70 2013/12/02 18:46:52 bouyer Exp $");
+__RCSID("$NetBSD: inode.c,v 1.71 2014/04/05 12:32:27 justin Exp $");
#endif
#endif /* not lint */
@@ -358,8 +358,10 @@
doinglevel2 ||
(maxsymlinklen < 0) ||
(iswap64(dp1->di_size) > (uint64_t)maxsymlinklen)) {
- for (j = 0; j < (UFS_NDADDR + UFS_NIADDR); j++)
+ for (j = 0; j < UFS_NDADDR; j++)
dp1->di_db[j] = bswap32(dp1->di_db[j]);
+ for (j = 0; j < UFS_NIADDR; j++)
+ dp1->di_ib[j] = bswap32(dp1->di_ib[j]);
}
}
}
@@ -374,8 +376,12 @@
for (i = 0; i < n; i++, dp2++) {
ffs_dinode2_swap(dp2, dp2);
if ((iswap16(dp2->di_mode) & IFMT) != IFLNK) {
- for (j = 0; j < (UFS_NDADDR + UFS_NIADDR + UFS_NXADDR); j++)
+ for (j = 0; j < UFS_NXADDR; j++)
dp2->di_extb[j] = bswap64(dp2->di_extb[j]);
+ for (j = 0; j < UFS_NDADDR; j++)
+ dp2->di_db[j] = bswap64(dp2->di_db[j]);
+ for (j = 0; j < UFS_NIADDR; j++)
+ dp2->di_ib[j] = bswap64(dp2->di_ib[j]);
}
}
}
diff -r d803b3d7d3cb -r cb4064afdb92 sbin/newfs/mkfs.c
--- a/sbin/newfs/mkfs.c Sat Apr 05 11:18:03 2014 +0000
+++ b/sbin/newfs/mkfs.c Sat Apr 05 12:32:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkfs.c,v 1.120 2013/06/23 22:03:34 dholland Exp $ */
+/* $NetBSD: mkfs.c,v 1.121 2014/04/05 12:32:27 justin Exp $ */
/*
* Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
-__RCSID("$NetBSD: mkfs.c,v 1.120 2013/06/23 22:03:34 dholland Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.121 2014/04/05 12:32:27 justin Exp $");
#endif
#endif /* not lint */
@@ -1372,8 +1372,10 @@
if (needswap) {
ffs_dinode1_swap(&ip->dp1, dp1);
/* ffs_dinode1_swap() doesn't swap blocks addrs */
- for (i=0; i<UFS_NDADDR + UFS_NIADDR; i++)
+ for (i=0; i<UFS_NDADDR; i++)
dp1->di_db[i] = bswap32(ip->dp1.di_db[i]);
+ for (i=0; i<UFS_NIADDR; i++)
+ dp1->di_ib[i] = bswap32(ip->dp1.di_ib[i]);
} else
*dp1 = ip->dp1;
dp1->di_gen = arc4random() & INT32_MAX;
@@ -1382,8 +1384,10 @@
dp2 += ino_to_fsbo(&sblock, ino);
if (needswap) {
ffs_dinode2_swap(&ip->dp2, dp2);
- for (i=0; i<UFS_NDADDR + UFS_NIADDR; i++)
+ for (i=0; i<UFS_NDADDR; i++)
dp2->di_db[i] = bswap64(ip->dp2.di_db[i]);
+ for (i=0; i<UFS_NIADDR; i++)
+ dp2->di_ib[i] = bswap64(ip->dp2.di_ib[i]);
} else
*dp2 = ip->dp2;
dp2->di_gen = arc4random() & INT32_MAX;
Home |
Main Index |
Thread Index |
Old Index