From patchwork Thu Dec 9 09:31:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gautier X-Patchwork-Id: 48705 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EEBA385802D for ; Thu, 9 Dec 2021 09:32:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EEBA385802D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639042367; bh=enFfnCawzZ1G2WfyVUqyztKu/AdO9+4v9Wt2AHD7yUY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=lTVfkCUQIc+Mj0GrHJpu1YwUDQj9GM8GMhZV/Dh8kvDvJUdVdATMFxGZQZ5pKyBZJ FHPYen2yZCBFNmjIyd0/lFCXTtLmUMgt4kGZ4h4eBqovHB/B+P8L/x2VRTeD9DfXGA u4q95QLVm1ZvHCwp5EMRwZctDCdE+a9URK1qC1qw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by sourceware.org (Postfix) with ESMTPS id E6C473858C27 for ; Thu, 9 Dec 2021 09:32:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6C473858C27 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4J8pj23Mb6zQjBM; Thu, 9 Dec 2021 10:32:22 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de To: libc-alpha@sourceware.org Subject: [PATCH v4 1/4] iconv: Always encode "optional direct" UTF-7 characters Date: Thu, 9 Dec 2021 10:31:49 +0100 Message-Id: <20211209093152.313872-2-mg@max.gautier.name> In-Reply-To: <20211209093152.313872-1-mg@max.gautier.name> References: <87blcw9ptq.fsf@oldenburg.str.redhat.com> <20211209093152.313872-1-mg@max.gautier.name> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Max Gautier via Libc-alpha From: Max Gautier Reply-To: Max Gautier Cc: Max Gautier Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Max Gautier Reviewed-by: Adhemerval Zanella --- iconvdata/utf-7.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/iconvdata/utf-7.c b/iconvdata/utf-7.c index 0ed46c948d..9ba0974959 100644 --- a/iconvdata/utf-7.c +++ b/iconvdata/utf-7.c @@ -29,14 +29,6 @@ #include -/* Define this to 1 if you want the so-called "optional direct" characters - ! " # $ % & * ; < = > @ [ ] ^ _ ` { | } - to be encoded. Define to 0 if you want them to be passed straight - through, like the so-called "direct" characters. - We set this to 1 because it's safer. - */ -#define UTF7_ENCODE_OPTIONAL_CHARS 1 - /* The set of "direct characters": A-Z a-z 0-9 ' ( ) , - . / : ? space tab lf cr @@ -323,7 +315,7 @@ base64 (unsigned int i) if ((statep->__count & 0x18) == 0) \ { \ /* base64 encoding inactive */ \ - if (UTF7_ENCODE_OPTIONAL_CHARS ? isdirect (ch) : isxdirect (ch)) \ + if (isdirect (ch)) \ { \ *outptr++ = (unsigned char) ch; \ } \ @@ -375,7 +367,7 @@ base64 (unsigned int i) else \ { \ /* base64 encoding active */ \ - if (UTF7_ENCODE_OPTIONAL_CHARS ? isdirect (ch) : isxdirect (ch)) \ + if (isdirect (ch)) \ { \ /* deactivate base64 encoding */ \ size_t count; \