From 75d23ab2a038134c3bae5cbb86e1327e0b353fa0 Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Fri, 23 Mar 2018 17:31:04 -0700 Subject: [PATCH] src: fix warnings in aliased_buffer * Unary minus usages on unsigned type * Implicit casts to/from input parameters PR-URL: https://github.com/nodejs/node/pull/19665 Reviewed-By: Anna Henningsen Reviewed-By: Daniel Bevenius Reviewed-By: Khaidi Chu Reviewed-By: James M Snell Reviewed-By: Tiancheng "Timothy" Gu --- src/aliased_buffer.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/aliased_buffer.h b/src/aliased_buffer.h index 8b103f4949030c..10659f6d529f02 100644 --- a/src/aliased_buffer.h +++ b/src/aliased_buffer.h @@ -126,13 +126,11 @@ class AliasedBuffer { index_(that.index_) { } - template - inline Reference& operator=(const T& val) { + inline Reference& operator=(const NativeT& val) { aliased_buffer_->SetValue(index_, val); return *this; } - // This is not caught by the template operator= above. inline Reference& operator=(const Reference& val) { return *this = static_cast(val); } @@ -141,9 +139,8 @@ class AliasedBuffer { return aliased_buffer_->GetValue(index_); } - template - inline Reference& operator+=(const T& val) { - const T current = aliased_buffer_->GetValue(index_); + inline Reference& operator+=(const NativeT& val) { + const NativeT current = aliased_buffer_->GetValue(index_); aliased_buffer_->SetValue(index_, current + val); return *this; } @@ -152,9 +149,10 @@ class AliasedBuffer { return this->operator+=(static_cast(val)); } - template - inline Reference& operator-=(const T& val) { - return this->operator+=(-val); + inline Reference& operator-=(const NativeT& val) { + const NativeT current = aliased_buffer_->GetValue(index_); + aliased_buffer_->SetValue(index_, current - val); + return *this; } private: