Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3b1c19f

Browse filesBrowse files
bnoordhuisFishrock123
authored andcommitted
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: #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>
1 parent c795d1e commit 3b1c19f
Copy full SHA for 3b1c19f

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Collapse file

‎src/fs_event_wrap.cc‎

Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ class FSEventWrap: public HandleWrap {
3434
size_t self_size() const override { return sizeof(*this); }
3535

3636
private:
37+
static const encoding kDefaultEncoding = UTF8;
38+
3739
FSEventWrap(Environment* env, Local<Object> object);
3840
~FSEventWrap() override;
3941

4042
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
4143
int status);
4244

4345
uv_fs_event_t handle_;
44-
bool initialized_;
45-
enum encoding encoding_;
46+
bool initialized_ = false;
47+
enum encoding encoding_ = kDefaultEncoding;
4648
};
4749

4850

4951
FSEventWrap::FSEventWrap(Environment* env, Local<Object> object)
5052
: HandleWrap(env,
5153
object,
5254
reinterpret_cast<uv_handle_t*>(&handle_),
53-
AsyncWrap::PROVIDER_FSEVENTWRAP) {
54-
initialized_ = false;
55-
}
55+
AsyncWrap::PROVIDER_FSEVENTWRAP) {}
5656

5757

5858
FSEventWrap::~FSEventWrap() {
@@ -101,7 +101,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
101101
if (args[2]->IsTrue())
102102
flags |= UV_FS_EVENT_RECURSIVE;
103103

104-
wrap->encoding_ = ParseEncoding(env->isolate(), args[3], UTF8);
104+
wrap->encoding_ = ParseEncoding(env->isolate(), args[3], kDefaultEncoding);
105105

106106
int err = uv_fs_event_init(wrap->env()->event_loop(), &wrap->handle_);
107107
if (err == 0) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.