From patchwork Tue Jun 30 14:35:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiro TSUKADA X-Patchwork-Id: 6696621 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0BBC2C05AC for ; Tue, 30 Jun 2015 14:35:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0216D20622 for ; Tue, 30 Jun 2015 14:35:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC27D2061F for ; Tue, 30 Jun 2015 14:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753300AbbF3Ofj (ORCPT ); Tue, 30 Jun 2015 10:35:39 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:35532 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753349AbbF3Ofi (ORCPT ); Tue, 30 Jun 2015 10:35:38 -0400 Received: by pdbci14 with SMTP id ci14so7219437pdb.2 for ; Tue, 30 Jun 2015 07:35:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=liX5Fq+GTmk22yWUGpa21WJBVWvQLe2D6Zp8fx4hqo8=; b=NcQCpwZny5jr9xP1X57ZAWA6ZPb2fxFyxEauNEQ0RRk8WAd0opVDflVL/mb7vgPjG9 cKWj0DaDrwCV81s8w1RBM9NaMk9qCL91lem7zroecgCdFirGlvFOdVErlgywHNe1VAm0 NGW+8Y+VmRzi/Cfeg5wnhOZl/o6x4Ut0rRXDGjEkuZYDtxBne0YGUyghNnGi6amVH8WC pbogbTK3WTBNIEbzQzqhc96BX5aSWaTncRhl6t4x3hY8xA8KWF9R5scbiNmRRz2BdL+o cTLsEMJpV0VakBXOryqX/olqle8z6LSvC9OupMZyDXEvU5Uq0nAWU/VIUEk+nmCajLMX pL3g== X-Received: by 10.68.224.72 with SMTP id ra8mr44417034pbc.29.1435674936826; Tue, 30 Jun 2015 07:35:36 -0700 (PDT) Received: from seabird.localdomain (softbank219203027033.bbtec.net. [219.203.27.33]) by mx.google.com with ESMTPSA id fs16sm45901022pdb.12.2015.06.30.07.35.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jun 2015 07:35:35 -0700 (PDT) From: tskd08@gmail.com To: linux-media@vger.kernel.org Cc: m.chehab@samsung.com, Akihiro Tsukada Subject: [PATCH] v4l-utils/contrib/gconv: fix build error with glibc 2.21+ Date: Tue, 30 Jun 2015 23:35:23 +0900 Message-Id: <1435674923-27623-1-git-send-email-tskd08@gmail.com> X-Mailer: git-send-email 2.4.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Akihiro Tsukada Building this gconv module with glibc > 2.21 failed with errors. It has copies of glibc's iconv module files, and #includes them as the base of implemententation, which is the same impl. pattern as the other internal iconv modules. But those base files depend on the internal of iconv to some extent, and it had been changed in glibc 2.21. Signed-off-by: Akihiro Tsukada --- contrib/gconv/iconv/loop.c | 44 ++++++++++++++++++++++++++++++++++++++++++ contrib/gconv/iconv/skeleton.c | 10 ++++++++++ 2 files changed, 54 insertions(+) diff --git a/contrib/gconv/iconv/loop.c b/contrib/gconv/iconv/loop.c index a480c0c..127a466 100644 --- a/contrib/gconv/iconv/loop.c +++ b/contrib/gconv/iconv/loop.c @@ -211,6 +211,7 @@ transcription functions and ignoring of errors. Note that we cannot use the do while (0) trick since `break' and `continue' must reach certain points. */ +#if ! __GLIBC_PREREQ(2,21) #define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \ { \ struct __gconv_trans_data *trans; \ @@ -258,6 +259,49 @@ that "iconv -c" must give the same exitcode as "iconv". */ \ continue; \ } +#else +#define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \ + { \ + result = __GCONV_ILLEGAL_INPUT; \ + \ + if (irreversible == NULL) \ + /* This means we are in call from __gconv_transliterate. In this \ + case we are not doing any error recovery outself. */ \ + break; \ + \ + /* If needed, flush any conversion state, so that __gconv_transliterate \ + starts with current shift state. */ \ + UPDATE_PARAMS; \ + \ + /* First try the transliteration methods. */ \ + if ((step_data->__flags & __GCONV_TRANSLIT) != 0) \ + result = __gconv_transliterate \ + (step, step_data, *inptrp, \ + &inptr, inend, &outptr, irreversible); \ + \ + REINIT_PARAMS; \ + \ + /* If any of them recognized the input continue with the loop. */ \ + if (result != __GCONV_ILLEGAL_INPUT) \ + { \ + if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT)) \ + break; \ + \ + continue; \ + } \ + \ + /* Next see whether we have to ignore the error. If not, stop. */ \ + if (! ignore_errors_p ()) \ + break; \ + \ + /* When we come here it means we ignore the character. */ \ + ++*irreversible; \ + inptr += Incr; \ + /* But we keep result == __GCONV_ILLEGAL_INPUT, because of the constraint \ + that "iconv -c" must give the same exitcode as "iconv". */ \ + continue; \ + } +#endif \ /* Handling of Unicode 3.1 TAG characters. Unicode recommends diff --git a/contrib/gconv/iconv/skeleton.c b/contrib/gconv/iconv/skeleton.c index e64a414..9f7f80a 100644 --- a/contrib/gconv/iconv/skeleton.c +++ b/contrib/gconv/iconv/skeleton.c @@ -501,8 +501,14 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, } else { +#if ! __GLIBC_PREREQ(2,21) /* We preserve the initial values of the pointer variables. */ const unsigned char *inptr = *inptrp; +#else + /* We preserve the initial values of the pointer variables, + but only some conversion modules need it. */ + const unsigned char *inptr __attribute__ ((__unused__)) = *inptrp; +#endif unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1) ? data->__outbuf : *outbufstart); unsigned char *outend = data->__outbufend; @@ -592,8 +598,10 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, while (1) { +#if ! __GLIBC_PREREQ(2,21) struct __gconv_trans_data *trans; +#endif /* Remember the start value for this round. */ inptr = *inptrp; /* The outbuf buffer is empty. */ @@ -640,6 +648,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, return status; } +#if ! __GLIBC_PREREQ(2,21) /* Give the transliteration module the chance to store the original text and the result in case it needs a context. */ for (trans = data->__trans; trans != NULL; trans = trans->__next) @@ -647,6 +656,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data, DL_CALL_FCT (trans->__trans_context_fct, (trans->__data, inptr, *inptrp, outstart, outbuf)); +#endif /* We finished one use of the loops. */ ++data->__invocation_counter;