From patchwork Tue Apr 16 22:08:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1011 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EF4C60004 for ; Wed, 17 Apr 2019 00:08:52 +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 F375C2D2 for ; Wed, 17 Apr 2019 00:08:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1555452532; bh=iwgyLW0MWnGp2TxvsW836wfzPZek82oY/7CT1iPNJy8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oPGiXEKquckO8HknOi7JXF4IY7c82RFKQhdX0mx9OmboOW5p1QEpJ0yP5VtEMUGp6 nW00RL2KxyYh4LbsXQS1qbvXiN3+h5c6vYfD8HKh6mULrf8dX0jeXPYMjpryGIt5TN Hz7QeqU/JPgROcevon4rz2lACUM9Q0zVfXWsAJzc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Apr 2019 01:08:28 +0300 Message-Id: <20190416220839.1577-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190416220839.1577-1-laurent.pinchart@ideasonboard.com> References: <20190416220839.1577-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/13] libcamera: log: Mark Loggable::_log() methods as const 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: Tue, 16 Apr 2019 22:08:52 -0000 The methods don't modify the object instance, mark them as const. This allows using the LOG() macro from a const method of a Loggable object. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/include/log.h | 5 +++-- src/libcamera/log.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libcamera/include/log.h b/src/libcamera/include/log.h index 8ea5a1eb673a..35a6fc105448 100644 --- a/src/libcamera/include/log.h +++ b/src/libcamera/include/log.h @@ -76,9 +76,10 @@ protected: virtual std::string logPrefix() const = 0; LogMessage _log(const char *file, unsigned int line, - LogSeverity severity); + LogSeverity severity) const; LogMessage _log(const char *file, unsigned int line, - const LogCategory &category, LogSeverity severity); + const LogCategory &category, + LogSeverity severity) const; }; LogMessage _log(const char *file, unsigned int line, LogSeverity severity); diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 71cfbc422ba0..77927ec35b62 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -506,7 +506,7 @@ Loggable::~Loggable() * \return A log message */ LogMessage Loggable::_log(const char *fileName, unsigned int line, - LogSeverity severity) + LogSeverity severity) const { LogMessage msg(fileName, line, severity); @@ -527,7 +527,8 @@ LogMessage Loggable::_log(const char *fileName, unsigned int line, * \return A log message */ LogMessage Loggable::_log(const char *fileName, unsigned int line, - const LogCategory &category, LogSeverity severity) + const LogCategory &category, + LogSeverity severity) const { LogMessage msg(fileName, line, category, severity);