From patchwork Tue Nov 20 11:37:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10690295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0FAB71923 for ; Tue, 20 Nov 2018 11:37:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F23CC2906E for ; Tue, 20 Nov 2018 11:37:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E64AF2A7F2; Tue, 20 Nov 2018 11:37:46 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 9244D2906E for ; Tue, 20 Nov 2018 11:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729181AbeKTWG2 (ORCPT ); Tue, 20 Nov 2018 17:06:28 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:46400 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729099AbeKTWG2 (ORCPT ); Tue, 20 Nov 2018 17:06:28 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3EAB860B7F; Tue, 20 Nov 2018 11:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542713865; bh=42NVwJoZVgcYcWZcdwBKTohQZGGfXyWgSO2JuvcH2gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UDaA+tyhKp8YmMmaiZovoEuabUOLC5O2MMpG5qOoYVP+UkOpeoXypkRhGGlVSZor+ hwWtUnZzwzLYPUfgcOQtGABs4Y+JVb4tTdjQYiTzdnlhUscMY+DgdvWmnCMygpdG4G Jnyqu3O5CgVB4Fj/ncLDgI3kxPwCUFZFCcpTkOoo= Received: from smasetty-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smasetty@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AFD6460B0D; Tue, 20 Nov 2018 11:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1542713864; bh=42NVwJoZVgcYcWZcdwBKTohQZGGfXyWgSO2JuvcH2gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b4P4fCFf4FgYjGkvETSFJkjkyIz+ekZUdX1KNhvwtJUPUGCA+fGBMSCzHO/tUYuO3 dczM6dKCLOvALSqzGt86aogi01CuXaoI5DUc59V3kkDXw5i0Nykutks+TUrNsLis8u M+aurRfvnLfpz193Imp3OKtO8rS+kgiNLri1LKDQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AFD6460B0D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smasetty@codeaurora.org From: Sharat Masetty To: freedreno@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, jcrouse@codeaurora.org, Sharat Masetty Subject: [PATCH 2/4] include/linux/ascii85: Update ascii85_encode() Date: Tue, 20 Nov 2018 17:07:29 +0530 Message-Id: <1542713851-14375-2-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542713851-14375-1-git-send-email-smasetty@codeaurora.org> References: <1542713851-14375-1-git-send-email-smasetty@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current implementation of ascii85_encode() does not copy the encoded buffer 'z' to the output buffer in case the input is zero. This patch simply adds this missing piece. This makes it easier to use this function to encode large buffers. Signed-off-by: Sharat Masetty --- include/linux/ascii85.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/ascii85.h b/include/linux/ascii85.h index 4cc4020..00646fc 100644 --- a/include/linux/ascii85.h +++ b/include/linux/ascii85.h @@ -23,8 +23,12 @@ { int i; - if (in == 0) - return "z"; + if (in == 0) { + out[0] = 'z'; + out[1] = '\0'; + + return out; + } out[5] = '\0'; for (i = 5; i--; ) {