summaryrefslogtreecommitdiff
path: root/src/fs_event_wrap.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2016-06-22 13:13:58 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2016-06-29 12:20:57 +0200
commit88a87482123c2e9047a247ccb3007d6b0f1900bc (patch)
treedddbc6c85f1e40235746aef32a826a857d62255f /src/fs_event_wrap.cc
parent5e60ded244fb1651a76070d541de12d5b96d7719 (diff)
downloadandroid-node-v8-88a87482123c2e9047a247ccb3007d6b0f1900bc.tar.gz
android-node-v8-88a87482123c2e9047a247ccb3007d6b0f1900bc.tar.bz2
android-node-v8-88a87482123c2e9047a247ccb3007d6b0f1900bc.zip
src: initialize encoding_ data member
Pointed out by Coverity. Not really a bug because it's assigned before use but explicit assignment in the constructor is more obviously correct. PR-URL: https://github.com/nodejs/node/pull/7374 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'src/fs_event_wrap.cc')
-rw-r--r--src/fs_event_wrap.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc
index 10af967def..cf9559df9d 100644
--- a/src/fs_event_wrap.cc
+++ b/src/fs_event_wrap.cc
@@ -34,6 +34,8 @@ class FSEventWrap: public HandleWrap {
size_t self_size() const override { return sizeof(*this); }
private:
+ static const encoding kDefaultEncoding = UTF8;
+
FSEventWrap(Environment* env, Local<Object> object);
~FSEventWrap() override;
@@ -41,8 +43,8 @@ class FSEventWrap: public HandleWrap {
int status);
uv_fs_event_t handle_;
- bool initialized_;
- enum encoding encoding_;
+ bool initialized_ = false;
+ enum encoding encoding_ = kDefaultEncoding;
};
@@ -50,9 +52,7 @@ FSEventWrap::FSEventWrap(Environment* env, Local<Object> object)
: HandleWrap(env,
object,
reinterpret_cast<uv_handle_t*>(&handle_),
- AsyncWrap::PROVIDER_FSEVENTWRAP) {
- initialized_ = false;
-}
+ AsyncWrap::PROVIDER_FSEVENTWRAP) {}
FSEventWrap::~FSEventWrap() {
@@ -101,7 +101,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
if (args[2]->IsTrue())
flags |= UV_FS_EVENT_RECURSIVE;
- wrap->encoding_ = ParseEncoding(env->isolate(), args[3], UTF8);
+ wrap->encoding_ = ParseEncoding(env->isolate(), args[3], kDefaultEncoding);
int err = uv_fs_event_init(wrap->env()->event_loop(), &wrap->handle_);
if (err == 0) {