Module Name: src
Committed By: roy
Date: Sat Mar 28 15:19:56 UTC 2020
Modified Files:
src/usr.bin/tic: tic.c
Log Message:
tic: promote record type when merging newer into older
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/tic/tic.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/tic/tic.c
diff -u src/usr.bin/tic/tic.c:1.34 src/usr.bin/tic/tic.c:1.35
--- src/usr.bin/tic/tic.c:1.34 Fri Mar 27 17:42:36 2020
+++ src/usr.bin/tic/tic.c Sat Mar 28 15:19:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $ */
+/* $NetBSD: tic.c,v 1.35 2020/03/28 15:19:56 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tic.c,v 1.34 2020/03/27 17:42:36 christos Exp $");
+__RCSID("$NetBSD: tic.c,v 1.35 2020/03/28 15:19:56 roy Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -228,6 +228,22 @@ merge(TIC *rtic, TIC *utic, int flags)
int num;
size_t n;
+ /* Promote record type if needed. */
+ if (rtic->rtype < utic->rtype) {
+ cap = rtic->nums.buf;
+ rtic->nums.buf = NULL;
+ rtic->nums.buflen = rtic->nums.bufpos = 0;
+ for (n = rtic->nums.entries; n > 0; n--) {
+ ind = _ti_decode_16(&cap);
+ num = _ti_decode_num(&cap, rtic->rtype);
+ if (VALID_NUMERIC(num) &&
+ !_ti_encode_buf_id_num(&rtic->nums, ind, num,
+ _ti_numsize(utic)))
+ err(1, "encode num");
+ }
+ rtic->rtype = utic->rtype;
+ }
+
cap = utic->flags.buf;
for (n = utic->flags.entries; n > 0; n--) {
ind = _ti_decode_16(&cap);