Browse Source

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>
v6.x
Ben Noordhuis 9 years ago
committed by Jeremiah Senkpiel
parent
commit
3b1c19f90a
  1. 12
      src/fs_event_wrap.cc

12
src/fs_event_wrap.cc

@ -34,6 +34,8 @@ class FSEventWrap: public HandleWrap {
size_t self_size() const override { return sizeof(*this); } size_t self_size() const override { return sizeof(*this); }
private: private:
static const encoding kDefaultEncoding = UTF8;
FSEventWrap(Environment* env, Local<Object> object); FSEventWrap(Environment* env, Local<Object> object);
~FSEventWrap() override; ~FSEventWrap() override;
@ -41,8 +43,8 @@ class FSEventWrap: public HandleWrap {
int status); int status);
uv_fs_event_t handle_; uv_fs_event_t handle_;
bool initialized_; bool initialized_ = false;
enum encoding encoding_; enum encoding encoding_ = kDefaultEncoding;
}; };
@ -50,9 +52,7 @@ FSEventWrap::FSEventWrap(Environment* env, Local<Object> object)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&handle_), reinterpret_cast<uv_handle_t*>(&handle_),
AsyncWrap::PROVIDER_FSEVENTWRAP) { AsyncWrap::PROVIDER_FSEVENTWRAP) {}
initialized_ = false;
}
FSEventWrap::~FSEventWrap() { FSEventWrap::~FSEventWrap() {
@ -101,7 +101,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
if (args[2]->IsTrue()) if (args[2]->IsTrue())
flags |= UV_FS_EVENT_RECURSIVE; 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_); int err = uv_fs_event_init(wrap->env()->event_loop(), &wrap->handle_);
if (err == 0) { if (err == 0) {

Loading…
Cancel
Save