Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
src: lint c++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Jul 31, 2013
1 parent 3c6b5d5 commit 8e29ce9
Show file tree
Hide file tree
Showing 63 changed files with 964 additions and 875 deletions.
41 changes: 22 additions & 19 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@


namespace node {

namespace cares_wrap {

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

class QueryWrap {
public:
QueryWrap(Local<Object> req_wrap_obj) {
explicit QueryWrap(Local<Object> req_wrap_obj) {
HandleScope scope(node_isolate);
persistent().Reset(node_isolate, req_wrap_obj);
}
Expand Down Expand Up @@ -333,7 +332,7 @@ class QueryWrap {

class QueryAWrap: public QueryWrap {
public:
QueryAWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryAWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QueryAaaaWrap: public QueryWrap {
public:
QueryAaaaWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryAaaaWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QueryCnameWrap: public QueryWrap {
public:
QueryCnameWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryCnameWrap(Local<Object> req_wrap_obj)
: QueryWrap(req_wrap_obj) {
}

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

class QueryMxWrap: public QueryWrap {
public:
QueryMxWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryMxWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QueryNsWrap: public QueryWrap {
public:
QueryNsWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryNsWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QueryTxtWrap: public QueryWrap {
public:
QueryTxtWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryTxtWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QuerySrvWrap: public QueryWrap {
public:
QuerySrvWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QuerySrvWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
}

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

class QueryNaptrWrap: public QueryWrap {
public:
QueryNaptrWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit QueryNaptrWrap(Local<Object> req_wrap_obj)
: QueryWrap(req_wrap_obj) {
}

int Send(const char* name) {
Expand Down Expand Up @@ -630,7 +631,6 @@ class QueryNaptrWrap: public QueryWrap {
for (ares_naptr_reply* naptr_current = naptr_start;
naptr_current;
naptr_current = naptr_current->next) {

Local<Object> naptr_record = Object::New();

naptr_record->Set(flags_symbol,
Expand Down Expand Up @@ -658,7 +658,8 @@ class QueryNaptrWrap: public QueryWrap {

class GetHostByAddrWrap: public QueryWrap {
public:
GetHostByAddrWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit GetHostByAddrWrap(Local<Object> req_wrap_obj)
: QueryWrap(req_wrap_obj) {
}

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

class GetHostByNameWrap: public QueryWrap {
public:
GetHostByNameWrap(Local<Object> req_wrap_obj) : QueryWrap(req_wrap_obj) {
explicit GetHostByNameWrap(Local<Object> req_wrap_obj)
: QueryWrap(req_wrap_obj) {
}

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

GetAddrInfoReqWrap* req_wrap = (GetAddrInfoReqWrap*) req->data;
GetAddrInfoReqWrap* req_wrap =
reinterpret_cast<GetAddrInfoReqWrap*>(req->data);

Local<Value> argv[] = {
Integer::New(status, node_isolate),
Expand Down Expand Up @@ -802,7 +805,8 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
// Ignore random ai_family types.
if (address->ai_family == AF_INET) {
// Juggle pointers
addr = (char*) &((struct sockaddr_in*) address->ai_addr)->sin_addr;
addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in*>(
address->ai_addr)->sin_addr));
int err = uv_inet_ntop(address->ai_family,
addr,
ip,
Expand All @@ -828,7 +832,8 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
// Ignore random ai_family types.
if (address->ai_family == AF_INET6) {
// Juggle pointers
addr = (char*) &((struct sockaddr_in6*) address->ai_addr)->sin6_addr;
addr = reinterpret_cast<char*>(&(reinterpret_cast<struct sockaddr_in6*>(
address->ai_addr)->sin6_addr));
int err = uv_inet_ntop(address->ai_family,
addr,
ip,
Expand Down Expand Up @@ -1075,9 +1080,7 @@ static void Initialize(Handle<Object> target) {
oncomplete_sym = String::New("oncomplete");
}


} // namespace cares_wrap

} // namespace cares_wrap
} // namespace node

NODE_MODULE(node_cares_wrap, node::cares_wrap::Initialize)
18 changes: 7 additions & 11 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ static Cached<String> onchange_sym;
static Cached<String> rename_sym;

class FSEventWrap: public HandleWrap {
public:
public:
static void Initialize(Handle<Object> target);
static void New(const FunctionCallbackInfo<Value>& args);
static void Start(const FunctionCallbackInfo<Value>& args);
static void Close(const FunctionCallbackInfo<Value>& args);

private:
FSEventWrap(Handle<Object> object);
private:
explicit FSEventWrap(Handle<Object> object);
virtual ~FSEventWrap();

static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
Expand Down Expand Up @@ -147,14 +147,11 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename,
// unreasonable, right? Still, we should revisit this before v1.0.
if (status) {
eventStr = String::Empty(node_isolate);
}
else if (events & UV_RENAME) {
} else if (events & UV_RENAME) {
eventStr = rename_sym;
}
else if (events & UV_CHANGE) {
} else if (events & UV_CHANGE) {
eventStr = change_sym;
}
else {
} else {
assert(0 && "bad fs events flag");
abort();
}
Expand Down Expand Up @@ -190,7 +187,6 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleWrap::Close(args);
}


} // namespace node
} // namespace node

NODE_MODULE(node_fs_event_wrap, node::FSEventWrap::Initialize)
16 changes: 8 additions & 8 deletions src/handle_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef HANDLE_WRAP_H_
#define HANDLE_WRAP_H_
#ifndef SRC_HANDLE_WRAP_H_
#define SRC_HANDLE_WRAP_H_

#include "queue.h"

Expand Down Expand Up @@ -53,16 +53,16 @@ namespace node {
args.This()->GetAlignedPointerFromInternalField(0));

class HandleWrap {
public:
public:
static void Initialize(v8::Handle<v8::Object> target);
static void Close(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args);

inline uv_handle_t* GetHandle() { return handle__; };
inline uv_handle_t* GetHandle() { return handle__; }

protected:
HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
protected:
explicit HandleWrap(v8::Handle<v8::Object> object, uv_handle_t* handle);
virtual ~HandleWrap();

inline v8::Local<v8::Object> object() {
Expand All @@ -73,7 +73,7 @@ class HandleWrap {
return object_;
}

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


#endif // HANDLE_WRAP_H_
#endif // SRC_HANDLE_WRAP_H_
Loading

0 comments on commit 8e29ce9

Please sign in to comment.