Browse Source

Misc. cleanups

casts, unused vars, function ordering, /* within comment, etc.
v0.7.4-release
Bert Belder 14 years ago
parent
commit
c99962e4cd
  1. 2
      src/node_cares.cc
  2. 2
      src/node_child_process.h
  3. 11
      src/node_file.cc
  4. 2
      src/node_net.cc
  5. 3
      src/node_os.cc
  6. 1
      src/platform_win32.cc
  7. 3
      src/platform_win32_winsock.cc
  8. 2
      src/platform_win32_winsock.h

2
src/node_cares.cc

@ -25,7 +25,7 @@
#endif // __OpenBSD__ #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 * This trick is used in node_net.cc as well
* TODO fixme * TODO fixme
*/ */

2
src/node_child_process.h

@ -75,7 +75,7 @@ class ChildProcess : ObjectWrap {
// called still. // called still.
int Kill(int sig); int Kill(int sig);
private: private:
void OnExit(int code); void OnExit(int code);
#ifdef __POSIX__ // Shouldn't this just move to node_child_process.cc? #ifdef __POSIX__ // Shouldn't this just move to node_child_process.cc?

11
src/node_file.cc

@ -24,29 +24,32 @@
#define PATH_MAX 4096 #define PATH_MAX 4096
#endif #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 */ /* TODO fixme */
#ifdef __MINGW32__ #ifdef __MINGW32__
# define pread eio__pread # define pread eio__pread
# define pwrite eio__pwrite # define pwrite eio__pwrite
#endif #endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
namespace node { namespace node {
using namespace v8; using namespace v8;
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
#define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b))
#define THROW_BAD_ARGS \ #define THROW_BAD_ARGS \
ThrowException(Exception::TypeError(String::New("Bad argument"))) ThrowException(Exception::TypeError(String::New("Bad argument")))
static Persistent<String> encoding_symbol; static Persistent<String> encoding_symbol;
static Persistent<String> errno_symbol; static Persistent<String> errno_symbol;
static Persistent<String> buf_symbol; static Persistent<String> buf_symbol;
// Buffer for readlink() and other misc callers; keep this scoped at // Buffer for readlink() and other misc callers; keep this scoped at
// file-level rather than method-level to avoid excess stack usage. // 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) { static int After(eio_req *req) {
HandleScope scope; HandleScope scope;

2
src/node_net.cc

@ -42,7 +42,7 @@
#endif #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 * This trick is used in node_ares.cc as well
* TODO fixme * TODO fixme
*/ */

3
src/node_os.cc

@ -73,7 +73,8 @@ static Handle<Value> GetOSRelease(const Arguments& args) {
return Undefined(); return Undefined();
} }
sprintf(release, "%d.%d.%d", info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber); sprintf(release, "%d.%d.%d", static_cast<int>(info.dwMajorVersion),
static_cast<int>(info.dwMinorVersion), static_cast<int>(info.dwBuildNumber));
#endif #endif
return scope.Close(String::New(release)); return scope.Close(String::New(release));

1
src/platform_win32.cc

@ -17,7 +17,6 @@ namespace node {
using namespace v8; using namespace v8;
static char buf[MAXPATHLEN + 1];
static char *process_title = NULL; static char *process_title = NULL;

3
src/platform_win32_winsock.cc

@ -11,7 +11,6 @@
namespace node { namespace node {
/* /*
* Guids and typedefs for winsock extension functions * Guids and typedefs for winsock extension functions
* Mingw32 doesn't have these :-( * Mingw32 doesn't have these :-(
@ -386,8 +385,6 @@ error:
* Initializes (fills) the WSAPROTOCOL_INFOW structure cache * Initializes (fills) the WSAPROTOCOL_INFOW structure cache
*/ */
static void wsa_init_proto_info_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_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_INET, SOCK_DGRAM, IPPROTO_UDP, &proto_info_cache[1]);
wsa_get_proto_info(AF_INET6, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[2]); wsa_get_proto_info(AF_INET6, SOCK_STREAM, IPPROTO_TCP, &proto_info_cache[2]);

2
src/platform_win32_winsock.h

@ -14,9 +14,9 @@ void wsa_init();
void wsa_perror(const char* prefix = ""); 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); 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_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); int wsa_sync_async_socketpair(int af, int type, int proto, SOCKET *syncSocket, SOCKET *asyncSocket);

Loading…
Cancel
Save