Skip to content

Commit 8e29ce9

Browse files
committed
src: lint c++ code
1 parent 3c6b5d5 commit 8e29ce9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+964
-875
lines changed

src/cares_wrap.cc

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343

4444
namespace node {
45-
4645
namespace cares_wrap {
4746

4847
using v8::Array;
@@ -230,7 +229,7 @@ static Local<Array> HostentToNames(struct hostent* host) {
230229

231230
class QueryWrap {
232231
public:
233-
QueryWrap(Local<Object> req_wrap_obj) {
232+
explicit QueryWrap(Local<Object> req_wrap_obj) {
234233
HandleScope scope(node_isolate);
235234
persistent().Reset(node_isolate, req_wrap_obj);
236235
}
@@ -333,7 +332,7 @@ class QueryWrap {
333332

334333
class QueryAWrap: public QueryWrap {
335334
public:
336-
QueryAWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
335+
explicit QueryAWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
337336
}
338337

339338
int Send(const char* name) {
@@ -363,7 +362,7 @@ class QueryAWrap: public QueryWrap {
363362

364363
class QueryAaaaWrap: public QueryWrap {
365364
public:
366-
QueryAaaaWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
365+
explicit QueryAaaaWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
367366
}
368367

369368
int Send(const char* name) {
@@ -398,7 +397,8 @@ class QueryAaaaWrap: public QueryWrap {
398397

399398
class QueryCnameWrap: public QueryWrap {
400399
public:
401-
QueryCnameWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
400+
explicit QueryCnameWrap(Local<Object> req_wrap_obj)
401+
: QueryWrap(req_wrap_obj) {
402402
}
403403

404404
int Send(const char* name) {
@@ -436,7 +436,7 @@ class QueryCnameWrap: public QueryWrap {
436436

437437
class QueryMxWrap: public QueryWrap {
438438
public:
439-
QueryMxWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
439+
explicit QueryMxWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
440440
}
441441

442442
int Send(const char* name) {
@@ -478,7 +478,7 @@ class QueryMxWrap: public QueryWrap {
478478

479479
class QueryNsWrap: public QueryWrap {
480480
public:
481-
QueryNsWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
481+
explicit QueryNsWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
482482
}
483483

484484
int Send(const char* name) {
@@ -506,7 +506,7 @@ class QueryNsWrap: public QueryWrap {
506506

507507
class QueryTxtWrap: public QueryWrap {
508508
public:
509-
QueryTxtWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
509+
explicit QueryTxtWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
510510
}
511511

512512
int Send(const char* name) {
@@ -541,7 +541,7 @@ class QueryTxtWrap: public QueryWrap {
541541

542542
class QuerySrvWrap: public QueryWrap {
543543
public:
544-
QuerySrvWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
544+
explicit QuerySrvWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
545545
}
546546

547547
int Send(const char* name) {
@@ -593,7 +593,8 @@ class QuerySrvWrap: public QueryWrap {
593593

594594
class QueryNaptrWrap: public QueryWrap {
595595
public:
596-
QueryNaptrWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
596+
explicit QueryNaptrWrap(Local<Object> req_wrap_obj)
597+
: QueryWrap(req_wrap_obj) {
597598
}
598599

599600
int Send(const char* name) {
@@ -630,7 +631,6 @@ class QueryNaptrWrap: public QueryWrap {
630631
for (ares_naptr_reply* naptr_current = naptr_start;
631632
naptr_current;
632633
naptr_current = naptr_current->next) {
633-
634634
Local<Object> naptr_record = Object::New();
635635

636636
naptr_record->Set(flags_symbol,
@@ -658,7 +658,8 @@ class QueryNaptrWrap: public QueryWrap {
658658

659659
class GetHostByAddrWrap: public QueryWrap {
660660
public:
661-
GetHostByAddrWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
661+
explicit GetHostByAddrWrap(Local<Object> req_wrap_obj)
662+
: QueryWrap(req_wrap_obj) {
662663
}
663664

664665
int Send(const char* name) {
@@ -695,7 +696,8 @@ class GetHostByAddrWrap: public QueryWrap {
695696

696697
class GetHostByNameWrap: public QueryWrap {
697698
public:
698-
GetHostByNameWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
699+
explicit GetHostByNameWrap(Local<Object> req_wrap_obj)
700+
: QueryWrap(req_wrap_obj) {
699701
}
700702

701703
int Send(const char* name, int family) {
@@ -768,7 +770,8 @@ static void QueryWithFamily(const FunctionCallbackInfo<Value>& args) {
768770
void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
769771
HandleScope scope(node_isolate);
770772

771-
GetAddrInfoReqWrap* req_wrap = (GetAddrInfoReqWrap*) req->data;
773+
GetAddrInfoReqWrap* req_wrap =
774+
reinterpret_cast<GetAddrInfoReqWrap*>(req->data);
772775

773776
Local<Value> argv[] = {
774777
Integer::New(status, node_isolate),
@@ -802,7 +805,8 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
802805
// Ignore random ai_family types.
803806
if (address->ai_family == AF_INET) {
804807
// Juggle pointers
805-
addr = (char*) &((struct sockaddr_in*) address->ai_addr)->sin_addr;
808+
addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in*>(
809+
address->ai_addr)->sin_addr));
806810
int err = uv_inet_ntop(address->ai_family,
807811
addr,
808812
ip,
@@ -828,7 +832,8 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
828832
// Ignore random ai_family types.
829833
if (address->ai_family == AF_INET6) {
830834
// Juggle pointers
831-
addr = (char*) &((struct sockaddr_in6*) address->ai_addr)->sin6_addr;
835+
addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in6*>(
836+
address->ai_addr)->sin6_addr));
832837
int err = uv_inet_ntop(address->ai_family,
833838
addr,
834839
ip,
@@ -1075,9 +1080,7 @@ static void Initialize(Handle<Object> target) {
10751080
oncomplete_sym = String::New("oncomplete");
10761081
}
10771082

1078-
1079-
} // namespace cares_wrap
1080-
1083+
} // namespace cares_wrap
10811084
} // namespace node
10821085

10831086
NODE_MODULE(node_cares_wrap, node::cares_wrap::Initialize)

src/fs_event_wrap.cc

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ static Cached<String> onchange_sym;
4141
static Cached<String> rename_sym;
4242

4343
class FSEventWrap: public HandleWrap {
44-
public:
44+
public:
4545
static void Initialize(Handle<Object> target);
4646
static void New(const FunctionCallbackInfo<Value>& args);
4747
static void Start(const FunctionCallbackInfo<Value>& args);
4848
static void Close(const FunctionCallbackInfo<Value>& args);
4949

50-
private:
51-
FSEventWrap(Handle<Object> object);
50+
private:
51+
explicit FSEventWrap(Handle<Object> object);
5252
virtual ~FSEventWrap();
5353

5454
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
@@ -147,14 +147,11 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
147147
// unreasonable, right? Still, we should revisit this before v1.0.
148148
if (status) {
149149
eventStr = String::Empty(node_isolate);
150-
}
151-
else if (events & UV_RENAME) {
150+
} else if (events & UV_RENAME) {
152151
eventStr = rename_sym;
153-
}
154-
else if (events & UV_CHANGE) {
152+
} else if (events & UV_CHANGE) {
155153
eventStr = change_sym;
156-
}
157-
else {
154+
} else {
158155
assert(0 && "bad fs events flag");
159156
abort();
160157
}
@@ -190,7 +187,6 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
190187
HandleWrap::Close(args);
191188
}
192189

193-
194-
} // namespace node
190+
} // namespace node
195191

196192
NODE_MODULE(node_fs_event_wrap, node::FSEventWrap::Initialize)

src/handle_wrap.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22-
#ifndef HANDLE_WRAP_H_
23-
#define HANDLE_WRAP_H_
22+
#ifndef SRC_HANDLE_WRAP_H_
23+
#define SRC_HANDLE_WRAP_H_
2424

2525
#include "queue.h"
2626

@@ -53,16 +53,16 @@ namespace node {
5353
args.This()->GetAlignedPointerFromInternalField(0));
5454

5555
class HandleWrap {
56-
public:
56+
public:
5757
static void Initialize(v8::Handle<v8::Object> target);
5858
static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
5959
static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args);
6060
static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args);
6161

62-
inline uv_handle_t* GetHandle() { return handle__; };
62+
inline uv_handle_t* GetHandle() { return handle__; }
6363

64-
protected:
65-
HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
64+
protected:
65+
explicit HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
6666
virtual ~HandleWrap();
6767

6868
inline v8::Local<v8::Object> object() {
@@ -73,7 +73,7 @@ class HandleWrap {
7373
return object_;
7474
}
7575

76-
private:
76+
private:
7777
friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);
7878
static void OnClose(uv_handle_t* handle);
7979
v8::Persistent<v8::Object> object_;
@@ -91,4 +91,4 @@ class HandleWrap {
9191
} // namespace node
9292

9393

94-
#endif // HANDLE_WRAP_H_
94+
#endif // SRC_HANDLE_WRAP_H_

0 commit comments

Comments
 (0)