From cbc3dd997eb90d629d1b9912b7a5a40eb82343df Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 16 May 2018 11:50:48 +0200 Subject: [PATCH] src, tools: add check for left leaning pointers This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: https://github.com/nodejs/node/pull/21010 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- src/cares_wrap.cc | 4 ++-- src/env-inl.h | 2 +- src/env.h | 2 +- src/exceptions.cc | 10 +++++----- src/node.cc | 12 ++++++------ src/node.h | 14 +++++++------- src/node_api_types.h | 20 ++++++++++---------- src/node_crypto.cc | 4 ++-- src/node_crypto.h | 14 +++++++------- src/node_dtrace.cc | 4 ++-- src/node_errors.h | 4 ++-- src/node_file.cc | 2 +- src/node_http2.cc | 2 +- src/node_http2.h | 2 +- src/node_internals.h | 2 +- src/node_main.cc | 4 ++-- src/node_platform.cc | 2 +- src/node_win32_etw_provider-inl.h | 16 ++++++++-------- src/node_win32_etw_provider.h | 22 +++++++++++----------- src/node_win32_perfctr_provider.cc | 22 +++++++++++----------- src/node_zlib.cc | 6 +++--- src/tcp_wrap.cc | 4 ++-- tools/cpplint.py | 27 +++++++++++++++++++++++++++ 23 files changed, 114 insertions(+), 87 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 24d424f73221e8..cc29ddad5586d9 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -633,7 +633,7 @@ class QueryWrap : public AsyncWrap { wrap->env()->CloseHandle(handle, CaresAsyncClose); } - static void Callback(void *arg, int status, int timeouts, + static void Callback(void* arg, int status, int timeouts, unsigned char* answer_buf, int answer_len) { QueryWrap* wrap = static_cast(arg); @@ -661,7 +661,7 @@ class QueryWrap : public AsyncWrap { uv_async_send(async_handle); } - static void Callback(void *arg, int status, int timeouts, + static void Callback(void* arg, int status, int timeouts, struct hostent* host) { QueryWrap* wrap = static_cast(arg); diff --git a/src/env-inl.h b/src/env-inl.h index eeb419b4a0fad2..165244895582ef 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -349,7 +349,7 @@ inline uv_idle_t* Environment::immediate_idle_handle() { inline void Environment::RegisterHandleCleanup(uv_handle_t* handle, HandleCleanupCb cb, - void *arg) { + void* arg) { handle_cleanup_queue_.push_back(HandleCleanup{handle, cb, arg}); } diff --git a/src/env.h b/src/env.h index cf6873e5fe7c6a..ee734fe92058b6 100644 --- a/src/env.h +++ b/src/env.h @@ -615,7 +615,7 @@ class Environment { // Register clean-up cb to be called on environment destruction. inline void RegisterHandleCleanup(uv_handle_t* handle, HandleCleanupCb cb, - void *arg); + void* arg); template inline void CloseHandle(T* handle, OnCloseCallback callback); diff --git a/src/exceptions.cc b/src/exceptions.cc index 1bcc7651a28d2c..0007854595a467 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -22,9 +22,9 @@ using v8::Value; Local ErrnoException(Isolate* isolate, int errorno, - const char *syscall, - const char *msg, - const char *path) { + const char* syscall, + const char* msg, + const char* path) { Environment* env = Environment::GetCurrent(isolate); Local e; @@ -143,8 +143,8 @@ Local UVException(Isolate* isolate, #ifdef _WIN32 // Does about the same as strerror(), // but supports all windows error messages -static const char *winapi_strerror(const int errorno, bool* must_free) { - char *errmsg = nullptr; +static const char* winapi_strerror(const int errorno, bool* must_free) { + char* errmsg = nullptr; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, errorno, diff --git a/src/node.cc b/src/node.cc index 663e4a222eba91..2088f505d8c328 100644 --- a/src/node.cc +++ b/src/node.cc @@ -320,7 +320,7 @@ static struct { } #if HAVE_INSPECTOR - bool StartInspector(Environment *env, const char* script_path, + bool StartInspector(Environment* env, const char* script_path, const DebugOptions& options) { // Inspector agent can't fail to start, but if it was configured to listen // right away on the websocket port and fails to bind/etc, this will return @@ -328,7 +328,7 @@ static struct { return env->inspector_agent()->Start(platform_, script_path, options); } - bool InspectorStarted(Environment *env) { + bool InspectorStarted(Environment* env) { return env->inspector_agent()->IsStarted(); } #endif // HAVE_INSPECTOR @@ -357,7 +357,7 @@ static struct { void Dispose() {} void DrainVMTasks(Isolate* isolate) {} void CancelVMTasks(Isolate* isolate) {} - bool StartInspector(Environment *env, const char* script_path, + bool StartInspector(Environment* env, const char* script_path, const DebugOptions& options) { env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0"); return true; @@ -379,7 +379,7 @@ static struct { #endif // !NODE_USE_V8_PLATFORM #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR - bool InspectorStarted(Environment *env) { + bool InspectorStarted(Environment* env) { return false; } #endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR @@ -424,7 +424,7 @@ static void PrintErrorString(const char* format, ...) { va_end(ap); } -const char *signo_string(int signo) { +const char* signo_string(int signo) { #define SIGNO_CASE(e) case e: return #e; switch (signo) { #ifdef SIGHUP @@ -2442,7 +2442,7 @@ static void EnvEnumerator(const PropertyCallbackInfo& info) { Local envarr = Array::New(isolate); WCHAR* p = environment; while (*p) { - WCHAR *s; + WCHAR* s; if (*p == L'=') { // If the key starts with '=' it is a hidden environment variable. p += wcslen(p) + 1; diff --git a/src/node.h b/src/node.h index 44c89afdb7134c..deaafb009d9713 100644 --- a/src/node.h +++ b/src/node.h @@ -208,7 +208,7 @@ NODE_EXTERN extern bool force_fips_crypto; # endif #endif -NODE_EXTERN int Start(int argc, char *argv[]); +NODE_EXTERN int Start(int argc, char* argv[]); NODE_EXTERN void Init(int* argc, const char** argv, int* exec_argc, @@ -455,14 +455,14 @@ NODE_DEPRECATED("Use DecodeWrite(isolate, ...)", NODE_EXTERN v8::Local WinapiErrnoException( v8::Isolate* isolate, int errorno, - const char *syscall = nullptr, - const char *msg = "", - const char *path = nullptr); + const char* syscall = nullptr, + const char* msg = "", + const char* path = nullptr); NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)", inline v8::Local WinapiErrnoException(int errorno, - const char *syscall = nullptr, const char *msg = "", - const char *path = nullptr) { + const char* syscall = nullptr, const char* msg = "", + const char* path = nullptr) { return WinapiErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, @@ -471,7 +471,7 @@ NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)", }) #endif -const char *signo_string(int errorno); +const char* signo_string(int errorno); typedef void (*addon_register_func)( diff --git a/src/node_api_types.h b/src/node_api_types.h index 76f38802e83e2e..f7f3ee62755b11 100644 --- a/src/node_api_types.h +++ b/src/node_api_types.h @@ -10,16 +10,16 @@ // JSVM API types are all opaque pointers for ABI stability // typedef undefined structs instead of void* for compile time type safety -typedef struct napi_env__ *napi_env; -typedef struct napi_value__ *napi_value; -typedef struct napi_ref__ *napi_ref; -typedef struct napi_handle_scope__ *napi_handle_scope; -typedef struct napi_escapable_handle_scope__ *napi_escapable_handle_scope; -typedef struct napi_callback_scope__ *napi_callback_scope; -typedef struct napi_callback_info__ *napi_callback_info; -typedef struct napi_async_context__ *napi_async_context; -typedef struct napi_async_work__ *napi_async_work; -typedef struct napi_deferred__ *napi_deferred; +typedef struct napi_env__* napi_env; +typedef struct napi_value__* napi_value; +typedef struct napi_ref__* napi_ref; +typedef struct napi_handle_scope__* napi_handle_scope; +typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; +typedef struct napi_callback_scope__* napi_callback_scope; +typedef struct napi_callback_info__* napi_callback_info; +typedef struct napi_async_context__* napi_async_context; +typedef struct napi_async_work__* napi_async_work; +typedef struct napi_deferred__* napi_deferred; typedef enum { napi_default = 0, diff --git a/src/node_crypto.cc b/src/node_crypto.cc index d81853331ba86b..d5d1b031c5e535 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3985,8 +3985,8 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) { dh_.reset(DH_new()); - BIGNUM *bn_p = BN_bin2bn(reinterpret_cast(p), p_len, 0); - BIGNUM *bn_g = BN_bin2bn(reinterpret_cast(g), g_len, 0); + BIGNUM* bn_p = BN_bin2bn(reinterpret_cast(p), p_len, 0); + BIGNUM* bn_g = BN_bin2bn(reinterpret_cast(g), g_len, 0); if (!DH_set0_pqg(dh_.get(), bn_p, nullptr, bn_g)) { BN_free(bn_p); BN_free(bn_g); diff --git a/src/node_crypto.h b/src/node_crypto.h index 0bc808aa17d2be..8d40f85099daca 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -368,12 +368,12 @@ class CipherBase : public BaseObject { const char* iv, int iv_len, unsigned int auth_tag_len); - bool InitAuthenticated(const char *cipher_type, int iv_len, + bool InitAuthenticated(const char* cipher_type, int iv_len, unsigned int auth_tag_len); bool CheckCCMMessageLength(int message_len); UpdateResult Update(const char* data, int len, unsigned char** out, int* out_len); - bool Final(unsigned char** out, int *out_len); + bool Final(unsigned char** out, int* out_len); bool SetAutoPadding(bool auto_padding); bool IsAuthenticatedMode() const; @@ -492,7 +492,7 @@ class Sign : public SignBase { int key_pem_len, const char* passphrase, unsigned char* sig, - unsigned int *sig_len, + unsigned int* sig_len, int padding, int saltlen); @@ -532,10 +532,10 @@ class Verify : public SignBase { class PublicKeyCipher { public: - typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX *ctx); - typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX *ctx, - unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); + typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX* ctx); + typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX* ctx, + unsigned char* out, size_t* outlen, + const unsigned char* in, size_t inlen); enum Operation { kPublic, diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 29e6276824ae6d..66e24afcacd974 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -194,7 +194,7 @@ void DTRACE_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo& args) { void DTRACE_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo& args) { node_dtrace_http_client_request_t req; - char *header; + char* header; if (!NODE_HTTP_CLIENT_REQUEST_ENABLED()) return; @@ -259,7 +259,7 @@ void InitDTrace(Environment* env, Local target) { HandleScope scope(env->isolate()); static struct { - const char *name; + const char* name; void (*func)(const FunctionCallbackInfo&); } tab[] = { #define NODE_PROBE(name) #name, name diff --git a/src/node_errors.h b/src/node_errors.h index 2c97088cc553b4..f767b414fa1f34 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -96,7 +96,7 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env, THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str()); } -inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate *isolate) { +inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { char message[128]; snprintf(message, sizeof(message), "Cannot create a Buffer larger than 0x%lx bytes", @@ -104,7 +104,7 @@ inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate *isolate) { return ERR_BUFFER_TOO_LARGE(isolate, message); } -inline v8::Local ERR_STRING_TOO_LONG(v8::Isolate *isolate) { +inline v8::Local ERR_STRING_TOO_LONG(v8::Isolate* isolate) { char message[128]; snprintf(message, sizeof(message), "Cannot create a string longer than 0x%x characters", diff --git a/src/node_file.cc b/src/node_file.cc index 789269d7122829..d4f3cbfcfb99d7 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -659,7 +659,7 @@ inline int SyncCall(Environment* env, Local ctx, FSReqWrapSync* req_wrap, if (err < 0) { Local context = env->context(); Local ctx_obj = ctx.As(); - Isolate *isolate = env->isolate(); + Isolate* isolate = env->isolate(); ctx_obj->Set(context, env->errno_string(), Integer::New(isolate, err)).FromJust(); diff --git a/src/node_http2.cc b/src/node_http2.cc index be43cc1e69067b..5629298eb94a20 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -840,7 +840,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle, } int Http2Session::OnInvalidFrame(nghttp2_session* handle, - const nghttp2_frame *frame, + const nghttp2_frame* frame, int lib_error_code, void* user_data) { Http2Session* session = static_cast(user_data); diff --git a/src/node_http2.h b/src/node_http2.h index e0a93c8f0fdc46..eb06d740ba0c6c 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -965,7 +965,7 @@ class Http2Session : public AsyncWrap, public StreamListener { void* user_data); static int OnInvalidFrame( nghttp2_session* session, - const nghttp2_frame *frame, + const nghttp2_frame* frame, int lib_error_code, void* user_data); diff --git a/src/node_internals.h b/src/node_internals.h index 7760eb26c6c15c..f76aacd7e88a5d 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -549,7 +549,7 @@ int ThreadPoolWork::CancelWork() { return uv_cancel(reinterpret_cast(&work_req_)); } -static inline const char *errno_string(int errorno) { +static inline const char* errno_string(int errorno) { #define ERRNO_CASE(e) case e: return #e; switch (errorno) { #ifdef EACCES diff --git a/src/node_main.cc b/src/node_main.cc index 8907c47ae0ea4c..bea1af7bdde5e3 100644 --- a/src/node_main.cc +++ b/src/node_main.cc @@ -27,7 +27,7 @@ #include #include -int wmain(int argc, wchar_t *wargv[]) { +int wmain(int argc, wchar_t* wargv[]) { if (!IsWindows7OrGreater()) { fprintf(stderr, "This application is only supported on Windows 7, " "Windows Server 2008 R2, or higher."); @@ -91,7 +91,7 @@ namespace node { extern bool linux_at_secure; } // namespace node -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { #if defined(__POSIX__) && defined(NODE_SHARED_MODE) // In node::PlatformInit(), we squash all signal handlers for non-shared lib // build. In order to run test cases against shared lib build, we also need diff --git a/src/node_platform.cc b/src/node_platform.cc index f2407f5be2d3c8..a8258ed74b120f 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc @@ -16,7 +16,7 @@ using v8::Platform; using v8::Task; using v8::TracingController; -static void BackgroundRunner(void *data) { +static void BackgroundRunner(void* data) { TRACE_EVENT_METADATA1("__metadata", "thread_name", "name", "BackgroundTaskRunner"); TaskQueue *background_tasks = static_cast *>(data); diff --git a/src/node_win32_etw_provider-inl.h b/src/node_win32_etw_provider-inl.h index 98a28f14f45a15..a7846f413a204c 100644 --- a/src/node_win32_etw_provider-inl.h +++ b/src/node_win32_etw_provider-inl.h @@ -120,8 +120,8 @@ extern int events_enabled; void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char *remote, int port, - const char *method, const char *url, int fd) { + node_dtrace_connection_t* conn, const char* remote, int port, + const char* method, const char* url, int fd) { EVENT_DATA_DESCRIPTOR descriptors[7]; ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req); ETW_WRITE_NET_CONNECTION(descriptors + 3, conn); @@ -130,7 +130,7 @@ void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char *remote, int port, int fd) { + const char* remote, int port, int fd) { EVENT_DATA_DESCRIPTOR descriptors[4]; ETW_WRITE_NET_CONNECTION(descriptors, conn); ETW_WRITE_EVENT(NODE_HTTP_SERVER_RESPONSE_EVENT, descriptors); @@ -138,8 +138,8 @@ void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char *remote, int port, - const char *method, const char *url, int fd) { + node_dtrace_connection_t* conn, const char* remote, int port, + const char* method, const char* url, int fd) { EVENT_DATA_DESCRIPTOR descriptors[6]; ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req); ETW_WRITE_NET_CONNECTION(descriptors + 2, conn); @@ -148,7 +148,7 @@ void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char *remote, int port, int fd) { + const char* remote, int port, int fd) { EVENT_DATA_DESCRIPTOR descriptors[4]; ETW_WRITE_NET_CONNECTION(descriptors, conn); ETW_WRITE_EVENT(NODE_HTTP_CLIENT_RESPONSE_EVENT, descriptors); @@ -156,7 +156,7 @@ void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char *remote, int port, int fd) { + const char* remote, int port, int fd) { EVENT_DATA_DESCRIPTOR descriptors[4]; ETW_WRITE_NET_CONNECTION(descriptors, conn); ETW_WRITE_EVENT(NODE_NET_SERVER_CONNECTION_EVENT, descriptors); @@ -164,7 +164,7 @@ void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char *remote, int port, int fd) { + const char* remote, int port, int fd) { EVENT_DATA_DESCRIPTOR descriptors[4]; ETW_WRITE_NET_CONNECTION(descriptors, conn); ETW_WRITE_EVENT(NODE_NET_STREAM_END_EVENT, descriptors); diff --git a/src/node_win32_etw_provider.h b/src/node_win32_etw_provider.h index 53b9529b539b04..0f84a86f0ac3fc 100644 --- a/src/node_win32_etw_provider.h +++ b/src/node_win32_etw_provider.h @@ -35,18 +35,18 @@ namespace node { # define INLINE inline #endif -typedef ULONG (NTAPI *EventRegisterFunc)( +typedef ULONG (NTAPI* EventRegisterFunc)( LPCGUID ProviderId, PENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle ); -typedef ULONG (NTAPI *EventUnregisterFunc)( +typedef ULONG (NTAPI* EventUnregisterFunc)( REGHANDLE RegHandle ); -typedef ULONG (NTAPI *EventWriteFunc)( +typedef ULONG (NTAPI* EventWriteFunc)( REGHANDLE RegHandle, PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount, @@ -57,19 +57,19 @@ void init_etw(); void shutdown_etw(); INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req, - node_dtrace_connection_t* conn, const char *remote, int port, - const char *method, const char *url, int fd); + node_dtrace_connection_t* conn, const char* remote, int port, + const char* method, const char* url, int fd); INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn, - const char *remote, int port, int fd); + const char* remote, int port, int fd); INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req, - node_dtrace_connection_t* conn, const char *remote, int port, - const char *method, const char *url, int fd); + node_dtrace_connection_t* conn, const char* remote, int port, + const char* method, const char* url, int fd); INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn, - const char *remote, int port, int fd); + const char* remote, int port, int fd); INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn, - const char *remote, int port, int fd); + const char* remote, int port, int fd); INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn, - const char *remote, int port, int fd); + const char* remote, int port, int fd); INLINE void NODE_GC_START(v8::GCType type, v8::GCCallbackFlags flags, v8::Isolate* isolate); diff --git a/src/node_win32_perfctr_provider.cc b/src/node_win32_perfctr_provider.cc index 6ec3cbd5cfae69..7e94db9fed97ea 100644 --- a/src/node_win32_perfctr_provider.cc +++ b/src/node_win32_perfctr_provider.cc @@ -28,60 +28,60 @@ #include "node_perfctr_provider.h" -typedef ULONG (WINAPI *PerfStartProviderExFunc)( +typedef ULONG (WINAPI* PerfStartProviderExFunc)( __in LPGUID ProviderGuid, __in_opt PPERF_PROVIDER_CONTEXT ProviderContext, __out PHANDLE Provider); -typedef ULONG (WINAPI *PerfStopProviderFunc)( +typedef ULONG (WINAPI* PerfStopProviderFunc)( __in HANDLE ProviderHandle); -typedef ULONG (WINAPI *PerfSetCounterSetInfoFunc)( +typedef ULONG (WINAPI* PerfSetCounterSetInfoFunc)( __in HANDLE ProviderHandle, __inout_bcount(TemplateSize) PPERF_COUNTERSET_INFO Template, __in ULONG TemplateSize); -typedef PPERF_COUNTERSET_INSTANCE (WINAPI *PerfCreateInstanceFunc)( +typedef PPERF_COUNTERSET_INSTANCE (WINAPI* PerfCreateInstanceFunc)( __in HANDLE ProviderHandle, __in LPCGUID CounterSetGuid, __in PCWSTR Name, __in ULONG Id); -typedef ULONG (WINAPI *PerfDeleteInstanceFunc)( +typedef ULONG (WINAPI* PerfDeleteInstanceFunc)( __in HANDLE Provider, __in PPERF_COUNTERSET_INSTANCE InstanceBlock); -typedef ULONG (WINAPI *PerfSetULongCounterValueFunc)( +typedef ULONG (WINAPI* PerfSetULongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, __in ULONG Value); -typedef ULONG (WINAPI *PerfSetULongLongCounterValueFunc)( +typedef ULONG (WINAPI* PerfSetULongLongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, __in ULONGLONG Value); -typedef ULONG (WINAPI *PerfIncrementULongCounterValueFunc)( +typedef ULONG (WINAPI* PerfIncrementULongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, __in ULONG Value); -typedef ULONG (WINAPI *PerfIncrementULongLongCounterValueFunc)( +typedef ULONG (WINAPI* PerfIncrementULongLongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, __in ULONGLONG Value); -typedef ULONG (WINAPI *PerfDecrementULongCounterValueFunc)( +typedef ULONG (WINAPI* PerfDecrementULongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, __in ULONG Value); -typedef ULONG (WINAPI *PerfDecrementULongLongCounterValueFunc)( +typedef ULONG (WINAPI* PerfDecrementULongLongCounterValueFunc)( __in HANDLE Provider, __inout PPERF_COUNTERSET_INSTANCE Instance, __in ULONG CounterId, diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 87415eb5758712..de8b0335892f65 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -164,8 +164,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { CHECK(0 && "Invalid flush value"); } - Bytef *in; - Bytef *out; + Bytef* in; + Bytef* out; size_t in_off, in_len, out_off, out_len; Environment* env = ctx->env(); @@ -500,7 +500,7 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork { SetDictionary(ctx); } - static bool Init(ZCtx *ctx, int level, int windowBits, int memLevel, + static bool Init(ZCtx* ctx, int level, int windowBits, int memLevel, int strategy, uint32_t* write_result, Local write_js_callback, char* dictionary, size_t dictionary_len) { diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 8200353b17bf99..01c7d253e66a16 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -341,8 +341,8 @@ Local AddressToJS(Environment* env, Local info) { EscapableHandleScope scope(env->isolate()); char ip[INET6_ADDRSTRLEN]; - const sockaddr_in *a4; - const sockaddr_in6 *a6; + const sockaddr_in* a4; + const sockaddr_in6* a6; int port; if (info.IsEmpty()) diff --git a/tools/cpplint.py b/tools/cpplint.py index ee103ef7161ba1..a4f786f01a941f 100644 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -527,6 +527,10 @@ _NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') +_RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]' + r'(?