From patchwork Thu Jun 15 18:24:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9789821 X-Patchwork-Delegate: sameo@linux.intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9B3F6038E for ; Thu, 15 Jun 2017 18:26:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0E7D2862E for ; Thu, 15 Jun 2017 18:26:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95DD828647; Thu, 15 Jun 2017 18:26:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37B482862C for ; Thu, 15 Jun 2017 18:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbdFOSZ2 (ORCPT ); Thu, 15 Jun 2017 14:25:28 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50449 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750749AbdFOSZY (ORCPT ); Thu, 15 Jun 2017 14:25:24 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 5862320814; Thu, 15 Jun 2017 14:25:18 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 15 Jun 2017 14:25:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=0J2 I0l9amwdGmACMqE69MZ7ggBZMDtDfZ08DQys79i8=; b=RoQo8BUALl5MybDdgG3 LRJPeXNZj9Vp1/CO9Pn/IMD9jgTxFFbRgKRStfCepa7FEqDF5dlfR3r/8ArAd5ba Uo+FiRLWVIBX4Awlvqsr73YKDKK/OTbZDEkvbwxFglxWAEpTfdGDTGOcasq01gMs liVjUCKvi1PD7g+0LAoEwCgU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=0J2I0l9amwdGmACMqE69MZ7ggBZMDtDfZ08DQys79 i8=; b=ZhOGSRAs6MeCFxOmy5jldpeFTZ+sdwDI6GSovpSchxpsfZhQYhT1HdtAV gE6Ho11aTlOcXJGKkg3wICxJ0ZbkrmseWnk6SGoVltMb5sbFEUe771zL5tNh1iaN GbP5zFeuX5rvulZo3+wccvetiW6kUtKS/LYG7Km20KSRzMJEZWNcbQBlYZjJzG0r TuohQEt+p4MWyXKebRLVDcsbnMTddyyc+mysESWt4/isBaZ+CJpPDaThImMQIqT2 UrNpNuctyWmpRWrQ0WTLWk2CNRWho3j/fjlkYPTRPk6cuKXd215HuFvTlEjERfZi 81t6jWq7lS1+9AmLnXklB2GI0C+Cg== X-ME-Sender: X-Sasl-enc: cu4RO40SpQ1nCJamzYeOfZb1iq2kolhSpAZ35Boh6pK9 1497551118 Received: from blue.animalcreek.com (ip68-2-81-12.ph.ph.cox.net [68.2.81.12]) by mail.messagingengine.com (Postfix) with ESMTPA id 1F0B87E85D; Thu, 15 Jun 2017 14:25:18 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id 68B2FA20280; Thu, 15 Jun 2017 11:25:17 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Mark Greer Subject: [PATCH 01/23] ndef: Add default language ("en") for Text records Date: Thu, 15 Jun 2017 11:24:54 -0700 Message-Id: <20170615182516.4508-2-mgreer@animalcreek.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170615182516.4508-1-mgreer@animalcreek.com> References: <20170615182516.4508-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Despite section 3.3 of the NFC Forum RTD-Text 1.0 Technical Specification stating in part, "The language code MAY NOT be omitted", some tags have a 0-length language field. A 0-length language field currently causes neard to exit which isn't ideal so choose a default language (generic English) which will be used in these situations. There is no particular reason to choose English other than it is the native language of the patch author and it is the language neard is coded in. Signed-off-by: Mark Greer --- This is identical to an earlier patch submitted to the linux-nfc mail list in October (link below) so that patch can be discarded. https://lists.01.org/pipermail/linux-nfc/2016-October/004292.html --- src/ndef.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ndef.c b/src/ndef.c index 5656baf..b90205b 100644 --- a/src/ndef.c +++ b/src/ndef.c @@ -409,7 +409,10 @@ static const char *get_text_payload(const GDBusPropertyTable *property, if (!strcmp(property->name, "Encoding")) return text->encoding; else if (!strcmp(property->name, "Language")) - return text->language_code; + if (!text->language_code) + return "en"; + else + return text->language_code; else if (!strcmp(property->name, "Representation")) return text->data; else