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); }
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) {

Loading…
Cancel
Save