From patchwork Wed Jun 19 10:50:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1467 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A5EC96194F for ; Wed, 19 Jun 2019 12:51:23 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2D2E7333 for ; Wed, 19 Jun 2019 12:51:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1560941483; bh=/iOvKFZJxaKLgsFICqXuOq6fX3HLjCKtzyAPwIrLFKY=; h=From:To:Subject:Date:From; b=okIGrphiUxIW2hDRwu38eCnFBmCw5MbGDWD+nfjx21AQYN1uOeC+npPdpMTYX7IwR qktnsgJqigCY0+40+cjABcfv6q2Wxl2NooZBzIvwBbICGG+vzNS4LrQ4PcwKVBCsju zgGByVvqSlLHCNfFIk/tWyS6jkQxYcfhLTfEElpY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Jun 2019 13:50:47 +0300 Message-Id: <20190619105047.15380-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] cam: Support base 16 and base 8 when parsing integer options X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jun 2019 10:51:23 -0000 Integer options have to use base 10. This isn't user-friendly when specifying pixel formats. Detect the base automatically to support base 16. As a side effect, integer values starting with 0 will be interpreted in base 8. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index bea4a600d1d5..7c3948df3b5c 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -79,7 +79,7 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, if (optarg) { char *endptr; - integer = strtoul(optarg, &endptr, 10); + integer = strtoul(optarg, &endptr, 0); if (*endptr != '\0') return false; } else {