Skip to content

Commit c99962e

Browse files
committed
Misc. cleanups
casts, unused vars, function ordering, /* within comment, etc.
1 parent e0f47be commit c99962e

8 files changed

Lines changed: 13 additions & 13 deletions

src/node_cares.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#endif // __OpenBSD__
2626

2727
/*
28-
* HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it /*
28+
* HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it
2929
* This trick is used in node_net.cc as well
3030
* TODO fixme
3131
*/

src/node_child_process.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ChildProcess : ObjectWrap {
7575
// called still.
7676
int Kill(int sig);
7777

78-
private:
78+
private:
7979
void OnExit(int code);
8080

8181
#ifdef __POSIX__ // Shouldn't this just move to node_child_process.cc?

src/node_file.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,32 @@
2424
#define PATH_MAX 4096
2525
#endif
2626

27-
/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it /*
27+
/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it */
2828
/* TODO fixme */
2929
#ifdef __MINGW32__
3030
# define pread eio__pread
3131
# define pwrite eio__pwrite
3232
#endif
3333

34-
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
35-
3634
namespace node {
3735

3836
using namespace v8;
3937

38+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
4039
#define MIN(a,b) ((a) < (b) ? (a) : (b))
4140
#define THROW_BAD_ARGS \
4241
ThrowException(Exception::TypeError(String::New("Bad argument")))
42+
4343
static Persistent<String> encoding_symbol;
4444
static Persistent<String> errno_symbol;
4545
static Persistent<String> buf_symbol;
4646

4747
// Buffer for readlink() and other misc callers; keep this scoped at
4848
// file-level rather than method-level to avoid excess stack usage.
49-
static char getbuf[PATH_MAX + 1];
49+
// Not used on windows atm
50+
#ifdef __POSIX__
51+
static char getbuf[PATH_MAX + 1];
52+
#endif
5053

5154
static int After(eio_req *req) {
5255
HandleScope scope;

src/node_net.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#endif
4343

4444
/*
45-
* HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it /*
45+
* HACK to use inet_pton/inet_ntop from c-ares because mingw32 doesn't have it
4646
* This trick is used in node_ares.cc as well
4747
* TODO fixme
4848
*/

src/node_os.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ static Handle<Value> GetOSRelease(const Arguments& args) {
7373
return Undefined();
7474
}
7575

76-
sprintf(release, "%d.%d.%d", info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber);
76+
sprintf(release, "%d.%d.%d", static_cast<int>(info.dwMajorVersion),
77+
static_cast<int>(info.dwMinorVersion), static_cast<int>(info.dwBuildNumber));
7778
#endif
7879

7980
return scope.Close(String::New(release));

src/platform_win32.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace node {
1717

1818
using namespace v8;
1919

20-
static char buf[MAXPATHLEN + 1];
2120
static char *process_title = NULL;
2221

2322

src/platform_win32_winsock.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace node {
1313

14-
1514
/*
1615
* Guids and typedefs for winsock extension functions
1716
* Mingw32 doesn't have these :-(
@@ -386,8 +385,6 @@ static void wsa_get_proto_info(int af, int type, int proto, WSAPROTOCOL_INFOW *t
386385
* Initializes (fills) the WSAPROTOCOL_INFOW structure cache
387386
*/
388387
static void wsa_init_proto_info_cache() {
389-
WSAPROTOCOL_INFOW *cache = (WSAPROTOCOL_INFOW*)&proto_info_cache;
390-
391388
wsa_get_proto_info(AF_INET, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[0]);
392389
wsa_get_proto_info(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &proto_info_cache[1]);
393390
wsa_get_proto_info(AF_INET6, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[2]);

src/platform_win32_winsock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ void wsa_init();
1414

1515
void wsa_perror(const char* prefix = "");
1616

17+
SOCKET wsa_sync_socket(int af, int type, int proto);
1718
BOOL wsa_disconnect_ex(SOCKET socket, OVERLAPPED *overlapped, DWORD flags, DWORD reserved);
1819

19-
SOCKET wsa_sync_socket(int af, int type, int proto);
2020
int wsa_socketpair(int af, int type, int proto, SOCKET sock[2]);
2121
int wsa_sync_async_socketpair(int af, int type, int proto, SOCKET *syncSocket, SOCKET *asyncSocket);
2222

0 commit comments

Comments
 (0)