From c99962e4cdef1dfc87c5337de9dbde14df39c9a3 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 17 Jan 2011 22:53:12 +0100 Subject: [PATCH] Misc. cleanups casts, unused vars, function ordering, /* within comment, etc. --- src/node_cares.cc | 2 +- src/node_child_process.h | 2 +- src/node_file.cc | 11 +++++++---- src/node_net.cc | 2 +- src/node_os.cc | 3 ++- src/platform_win32.cc | 1 - src/platform_win32_winsock.cc | 3 --- src/platform_win32_winsock.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/node_cares.cc b/src/node_cares.cc index 66a2fe42bd..0cffbda34d 100644 --- a/src/node_cares.cc +++ b/src/node_cares.cc @@ -25,7 +25,7 @@ #endif // __OpenBSD__ /* - * HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it /* + * HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it * This trick is used in node_net.cc as well * TODO fixme */ diff --git a/src/node_child_process.h b/src/node_child_process.h index 29aedb96e4..05e8d851ad 100644 --- a/src/node_child_process.h +++ b/src/node_child_process.h @@ -75,7 +75,7 @@ class ChildProcess : ObjectWrap { // called still. int Kill(int sig); -private: + private: void OnExit(int code); #ifdef __POSIX__ // Shouldn't this just move to node_child_process.cc? diff --git a/src/node_file.cc b/src/node_file.cc index a4527ff688..5681f9f742 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -24,29 +24,32 @@ #define PATH_MAX 4096 #endif -/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it /* +/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it */ /* TODO fixme */ #ifdef __MINGW32__ # define pread eio__pread # define pwrite eio__pwrite #endif -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) - namespace node { using namespace v8; +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define THROW_BAD_ARGS \ ThrowException(Exception::TypeError(String::New("Bad argument"))) + static Persistent encoding_symbol; static Persistent errno_symbol; static Persistent buf_symbol; // Buffer for readlink() and other misc callers; keep this scoped at // file-level rather than method-level to avoid excess stack usage. -static char getbuf[PATH_MAX + 1]; +// Not used on windows atm +#ifdef __POSIX__ + static char getbuf[PATH_MAX + 1]; +#endif static int After(eio_req *req) { HandleScope scope; diff --git a/src/node_net.cc b/src/node_net.cc index de45b2f923..2bc0a00a9c 100644 --- a/src/node_net.cc +++ b/src/node_net.cc @@ -42,7 +42,7 @@ #endif /* - * HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it /* + * HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it * This trick is used in node_ares.cc as well * TODO fixme */ diff --git a/src/node_os.cc b/src/node_os.cc index 1c98b04975..b5b97af6e9 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -73,7 +73,8 @@ static Handle GetOSRelease(const Arguments& args) { return Undefined(); } - sprintf(release, "%d.%d.%d", info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber); + sprintf(release, "%d.%d.%d", static_cast(info.dwMajorVersion), + static_cast(info.dwMinorVersion), static_cast(info.dwBuildNumber)); #endif return scope.Close(String::New(release)); diff --git a/src/platform_win32.cc b/src/platform_win32.cc index 5dd425e356..cb1e9295eb 100644 --- a/src/platform_win32.cc +++ b/src/platform_win32.cc @@ -17,7 +17,6 @@ namespace node { using namespace v8; -static char buf[MAXPATHLEN + 1]; static char *process_title = NULL; diff --git a/src/platform_win32_winsock.cc b/src/platform_win32_winsock.cc index 37c0ed6cf5..22a4d5e2b1 100644 --- a/src/platform_win32_winsock.cc +++ b/src/platform_win32_winsock.cc @@ -11,7 +11,6 @@ namespace node { - /* * Guids and typedefs for winsock extension functions * Mingw32 doesn't have these :-( @@ -386,8 +385,6 @@ error: * Initializes (fills) the WSAPROTOCOL_INFOW structure cache */ static void wsa_init_proto_info_cache() { - WSAPROTOCOL_INFOW *cache = (WSAPROTOCOL_INFOW*)&proto_info_cache; - wsa_get_proto_info(AF_INET, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[0]); wsa_get_proto_info(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &proto_info_cache[1]); wsa_get_proto_info(AF_INET6, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[2]); diff --git a/src/platform_win32_winsock.h b/src/platform_win32_winsock.h index 7206e5b14e..f292682243 100644 --- a/src/platform_win32_winsock.h +++ b/src/platform_win32_winsock.h @@ -14,9 +14,9 @@ void wsa_init(); void wsa_perror(const char* prefix = ""); +SOCKET wsa_sync_socket(int af, int type, int proto); BOOL wsa_disconnect_ex(SOCKET socket, OVERLAPPED *overlapped, DWORD flags, DWORD reserved); -SOCKET wsa_sync_socket(int af, int type, int proto); int wsa_socketpair(int af, int type, int proto, SOCKET sock[2]); int wsa_sync_async_socketpair(int af, int type, int proto, SOCKET *syncSocket, SOCKET *asyncSocket);