From nobody Mon Nov 29 15:43:18 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A468B18BCDB3; Mon, 29 Nov 2021 15:43:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J2qPj2b5zz4nTK; Mon, 29 Nov 2021 15:43:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AA4C2540D; Mon, 29 Nov 2021 15:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ATFhIjI066052; Mon, 29 Nov 2021 15:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ATFhI0n066051; Mon, 29 Nov 2021 15:43:18 GMT (envelope-from git) Date: Mon, 29 Nov 2021 15:43:18 GMT Message-Id: <202111291543.1ATFhI0n066051@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 181751a8b6ef - main - citrus_prop.c: do not ignore sign List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 181751a8b6ef580c44d49ef3cac1c6627bfa461e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638200603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gwh7ON89X2+ntm/KXEPfkSBC4XYDlMq8sHUiaty4PKo=; b=jR4MTBqN7BXuTE4WQRQO9B+L+MlTn+WooVB83YqkS1g9wSiFGpIsn+463fvoWsFmjcfSG7 ia3IwEw+COAJNpuXVNzN9J1eIJLj6o6LiPvDPwtiGoVVH4XHhKjSG1H9S3GWAjp2Wks0aw pxtr9Q9PWvd6V9C5HJtPViXAXVzrWWIRbW5tQInVag0zv2q5bZVcVzxnbnxSFNNYbGDOBA sb7s83S79zuOTqbChbi1u505KhVAEO9WfxjWRwVKuL2SKrFyZkwr8oO5JwIspL5YMXoJpn nyfD8HyEzlIQQvawvsm7mDvYG/wwpQCjYsYyqvmQxAdxgPjxKyL/QYA6sfokmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638200603; a=rsa-sha256; cv=none; b=RwaZL9Y6h1/QMIkHVSShfWqvb/ysiZNkSKQTH2KYTar2RX9xa9UG4PjRLEWIGGexNX/0C3 BfQJ5XBxJzSleamHYJz+PS/el7oWM8SYY6rN8Lq3U8B9W50hm0iI4rjKKUDCqeWUTidT8O NSzrntjYd+XM2C+RuMG4RJ6r8TKe2ow+nTvXBxWpoA2diW3EOV5z6Q1zmWgWM9yBdBNt9e +SGXaToz6XUibHSPX68LJWvrK5n2qSqVQHalA9Ndrbmkq7Jg5MnxlocOn9SC9qw/Sy0CJf EzPWO/jlzWqxulxVgr5eBWHM2SJnJ64nVGhKcAT4SswbrD7Z+4kUvebb611a1g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=181751a8b6ef580c44d49ef3cac1c6627bfa461e commit 181751a8b6ef580c44d49ef3cac1c6627bfa461e Author: Konstantin Belousov AuthorDate: 2021-11-28 03:03:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-29 15:39:54 +0000 citrus_prop.c: do not ignore sign In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed '-' sign, negate the value as appropriate. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33146 --- lib/libc/iconv/citrus_prop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libc/iconv/citrus_prop.c b/lib/libc/iconv/citrus_prop.c index 7ac39bbee6e5..0b627f362c22 100644 --- a/lib/libc/iconv/citrus_prop.c +++ b/lib/libc/iconv/citrus_prop.c @@ -79,7 +79,7 @@ static const char *xdigit = "0123456789ABCDEF"; #define _CITRUS_PROP_READ_UINT_COMMON(_func_, _type_, _max_) \ static int \ _citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \ - _type_ * __restrict result, int base) \ + _type_ * __restrict result, int base, int neg) \ { \ _type_ acc, cutoff; \ int ch, cutlim, n; \ @@ -99,7 +99,7 @@ _citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \ acc += n; \ } \ _memstream_ungetc(ms, ch); \ - *result = acc; \ + *result = neg ? -acc : acc; \ return (0); \ } _CITRUS_PROP_READ_UINT_COMMON(chr, int, UCHAR_MAX) @@ -139,7 +139,7 @@ _citrus_prop_read_##_func_(struct _memstream * __restrict ms, \ return (EINVAL); \ _memstream_ungetc(ms, ch); \ return (_citrus_prop_read_##_func_##_common \ - (ms, &obj->u._func_, base)); \ + (ms, &obj->u._func_, base, neg)); \ } _CITRUS_PROP_READ_INT(chr, int) _CITRUS_PROP_READ_INT(num, uint64_t) @@ -185,7 +185,8 @@ _citrus_prop_read_character_common(struct _memstream * __restrict ms, base -= 8; /*FALLTHROUGH*/ case 'x': - return (_citrus_prop_read_chr_common(ms, result, base)); + return (_citrus_prop_read_chr_common(ms, result, + base, 0)); /*NOTREACHED*/ default: /* unknown escape */