Module Name: src
Committed By: christos
Date: Thu Sep 7 10:23:33 UTC 2017
Modified Files:
src/sbin/gpt: backup.c biosboot.c gpt.c restore.c show.c
Log Message:
use __arraycount
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sbin/gpt/backup.c
cvs rdiff -u -r1.29 -r1.30 src/sbin/gpt/biosboot.c
cvs rdiff -u -r1.72 -r1.73 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.16 -r1.17 src/sbin/gpt/restore.c
cvs rdiff -u -r1.40 -r1.41 src/sbin/gpt/show.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/backup.c
diff -u src/sbin/gpt/backup.c:1.17 src/sbin/gpt/backup.c:1.18
--- src/sbin/gpt/backup.c:1.17 Wed Sep 6 14:17:18 2017
+++ src/sbin/gpt/backup.c Thu Sep 7 06:23:33 2017
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: backup.c,v 1.17 2017/09/06 18:17:18 christos Exp $");
+__RCSID("$NetBSD: backup.c,v 1.18 2017/09/07 10:23:33 christos Exp $");
#endif
#include <sys/bootblock.h>
@@ -231,8 +231,8 @@ store_tbl(gpt_t gpt, const map_t m, prop
PROP_ERR(propnum);
rc = prop_dictionary_set(gpt_dict, "attributes", propnum);
PROP_ERR(rc);
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name), utfbuf,
- sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name, __arraycount(ent->ent_name),
+ utfbuf, __arraycount(utfbuf));
if (utfbuf[0] != '\0') {
propstr = prop_string_create_cstring((char *)utfbuf);
PROP_ERR(propstr);
Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.29 src/sbin/gpt/biosboot.c:1.30
--- src/sbin/gpt/biosboot.c:1.29 Wed Sep 6 14:17:18 2017
+++ src/sbin/gpt/biosboot.c Thu Sep 7 06:23:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: biosboot.c,v 1.29 2017/09/06 18:17:18 christos Exp $ */
+/* $NetBSD: biosboot.c,v 1.30 2017/09/07 10:23:33 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.29 2017/09/06 18:17:18 christos Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.30 2017/09/07 10:23:33 christos Exp $");
#endif
#include <sys/stat.h>
@@ -219,8 +219,9 @@ biosboot(gpt_t gpt, daddr_t start, uint6
break;
if (label != NULL) {
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name),
- utfbuf, sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name,
+ __arraycount(ent->ent_name), utfbuf,
+ __arraycount(utfbuf));
if (strcmp((char *)label, (char *)utfbuf) == 0)
break;
}
Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.72 src/sbin/gpt/gpt.c:1.73
--- src/sbin/gpt/gpt.c:1.72 Wed Sep 6 14:17:18 2017
+++ src/sbin/gpt/gpt.c Thu Sep 7 06:23:33 2017
@@ -35,7 +35,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.72 2017/09/06 18:17:18 christos Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.73 2017/09/07 10:23:33 christos Exp $");
#endif
#include <sys/param.h>
@@ -1040,8 +1040,9 @@ gpt_change_ent(gpt_t gpt, const struct g
ent = gpt_ent_primary(gpt, i);
if (find->label != NULL) {
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name),
- utfbuf, sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name,
+ __arraycount(ent->ent_name),
+ utfbuf, __arraycount(utfbuf));
if (strcmp((char *)find->label, (char *)utfbuf) == 0)
continue;
}
Index: src/sbin/gpt/restore.c
diff -u src/sbin/gpt/restore.c:1.16 src/sbin/gpt/restore.c:1.17
--- src/sbin/gpt/restore.c:1.16 Wed Dec 2 21:02:43 2015
+++ src/sbin/gpt/restore.c Thu Sep 7 06:23:33 2017
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: restore.c,v 1.16 2015/12/03 02:02:43 christos Exp $");
+__RCSID("$NetBSD: restore.c,v 1.17 2017/09/07 10:23:33 christos Exp $");
#endif
#include <sys/types.h>
@@ -178,7 +178,7 @@ restore_ent(gpt_t gpt, prop_dictionary_t
if (propstr != NULL) {
s = prop_string_cstring_nocopy(propstr);
utf8_to_utf16((const uint8_t *)s, ent.ent_name,
- __arraycount(ent.ent_name));
+ __arraycount(ent.ent_name));
}
propnum = prop_dictionary_get(gpt_dict, "index");
PROP_ERR(propnum);
Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.40 src/sbin/gpt/show.c:1.41
--- src/sbin/gpt/show.c:1.40 Wed Sep 6 14:17:18 2017
+++ src/sbin/gpt/show.c Thu Sep 7 06:23:33 2017
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.40 2017/09/06 18:17:18 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.41 2017/09/07 10:23:33 christos Exp $");
#endif
#include <sys/bootblock.h>
@@ -129,8 +129,9 @@ print_part_type(int map_type, int flags,
printf("GPT part ");
ent = map_data;
if (flags & SHOW_LABEL) {
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name),
- utfbuf, sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name,
+ __arraycount(ent->ent_name), utfbuf,
+ __arraycount(utfbuf));
b = (char *)utfbuf;
} else if (flags & SHOW_GUID) {
gpt_uuid_snprintf( buf, sizeof(buf), "%d",
@@ -215,8 +216,8 @@ show_one(gpt_t gpt, unsigned int entry)
gpt_uuid_snprintf(s2, sizeof(s1), "%d", ent->ent_guid);
printf("GUID: %s\n", s2);
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name), utfbuf,
- sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name, __arraycount(ent->ent_name), utfbuf,
+ __arraycount(utfbuf));
printf("Label: %s\n", (char *)utfbuf);
printf("Attributes: ");
@@ -285,8 +286,9 @@ show_all(gpt_t gpt)
#endif
putchar('\n');
- utf16_to_utf8(ent->ent_name, sizeof(ent->ent_name),
- utfbuf, sizeof(utfbuf));
+ utf16_to_utf8(ent->ent_name,
+ __arraycount(ent->ent_name), utfbuf,
+ __arraycount(utfbuf));
printf(PFX "Label: %s\n", (char *)utfbuf);
printf(PFX "Attributes: ");