Skip to content

Windows: small fixes and fewer warnings #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deps/openssl/openssl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,11 @@
'WIN32_LEAN_AND_MEAN',
'OPENSSL_SYSNAME_WIN32',
],
'msvs_disabled_warnings': [
4244, # conversion from 'signed type', possible loss of data
4267, # conversion from 'unsigned type', possible loss of data
4996, # 'GetVersionExA': was declared deprecated
],
}, {
'defines': [
# ENGINESDIR must be defined if OPENSSLDIR is.
Expand Down
6 changes: 3 additions & 3 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@
],

'defines': [
'NODE_WANT_INTERNALS=1',
'ARCH="<(target_arch)"',
'PLATFORM="<(OS)"',
'NODE_ARCH="<(target_arch)"',
'NODE_PLATFORM="<(OS)"',
'NODE_TAG="<(node_tag)"',
'NODE_V8_OPTIONS="<(node_v8_options)"',
'NODE_WANT_INTERNALS=1',
],

'conditions': [
Expand Down
13 changes: 9 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2623,12 +2623,17 @@ void SetupProcessObject(Environment* env,
#endif

// process.arch
READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), ARCH));
READONLY_PROPERTY(process, "arch", OneByteString(env->isolate(), NODE_ARCH));

// process.platform
READONLY_PROPERTY(process,
"platform",
OneByteString(env->isolate(), PLATFORM));
#ifdef _WIN32
// As determined by gyp, NODE_PLATFORM equals 'win' on windows. However
// for historic reasons process.platform should be 'win32'.
Local<String> platform = OneByteString(env->isolate(), "win32");
#else
Local<String> platform = OneByteString(env->isolate(), NODE_PLATFORM);
#endif
READONLY_PROPERTY(process, "platform", platform);

// process.argv
Local<Array> arguments = Array::New(env->isolate(), argc);
Expand Down
9 changes: 6 additions & 3 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
return env->ThrowErrnoException(errno, "uname");
}
rval = info.release;
#else // __MINGW32__
#else // Windows
char release[256];
OSVERSIONINFO info;
OSVERSIONINFOW info;

info.dwOSVersionInfoSize = sizeof(info);
if (GetVersionEx(&info) == 0)

// Don't complain that GetVersionEx is deprecated; there is no alternative.
#pragma warning(suppress : 4996)
if (GetVersionExW(&info) == 0)
return;

snprintf(release,
Expand Down
5 changes: 3 additions & 2 deletions src/node_win32_etw_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ INLINE bool NODE_NET_SOCKET_READ_ENABLED();
INLINE bool NODE_NET_SOCKET_WRITE_ENABLED();
INLINE bool NODE_V8SYMBOL_ENABLED();

#define NODE_NET_SOCKET_READ(arg0, arg1, arg2, arg3)
#define NODE_NET_SOCKET_WRITE(arg0, arg1, arg2, arg3)
#define NODE_NET_SOCKET_READ(...) /* no-op */
#define NODE_NET_SOCKET_WRITE(...) /* no-op */

} // namespace node

#endif // SRC_NODE_WIN32_ETW_PROVIDER_H_