Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4bad757

Browse filesBrowse files
tniessenMoLow
authored andcommitted
src: rename SKIP_CHECK_SIZE to SKIP_CHECK_STRLEN
SKIP_CHECK_VALUE is a string literal, so its size is the length of the string in chars plus one. The buffer buf is also always null-terminated, so its size should match the size of SKIP_CHECK_VALUE, which is _not_ SKIP_CHECK_SIZE. Rename SKIP_CHECK_SIZE to be consistent with C/C++ terminology. PR-URL: #47845 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
1 parent 9b44c56 commit 4bad757
Copy full SHA for 4bad757

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎src/node_main.cc‎

Copy file name to clipboardExpand all lines: src/node_main.cc
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
#include <WinError.h>
2929

3030
#define SKIP_CHECK_VAR "NODE_SKIP_PLATFORM_CHECK"
31-
#define SKIP_CHECK_SIZE 1
3231
#define SKIP_CHECK_VALUE "1"
32+
#define SKIP_CHECK_STRLEN (sizeof(SKIP_CHECK_VALUE) - 1)
3333

3434
int wmain(int argc, wchar_t* wargv[]) {
3535
// Windows Server 2012 (not R2) is supported until 10/10/2023, so we allow it
3636
// to run in the experimental support tier.
37-
char buf[SKIP_CHECK_SIZE + 1];
37+
char buf[SKIP_CHECK_STRLEN + 1];
3838
if (!IsWindows8Point1OrGreater() &&
3939
!(IsWindowsServer() && IsWindows8OrGreater()) &&
4040
(GetEnvironmentVariableA(SKIP_CHECK_VAR, buf, sizeof(buf)) !=
41-
SKIP_CHECK_SIZE ||
42-
strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_SIZE + 1) != 0)) {
41+
SKIP_CHECK_STRLEN ||
42+
strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_STRLEN) != 0)) {
4343
fprintf(stderr, "Node.js is only supported on Windows 8.1, Windows "
4444
"Server 2012 R2, or higher.\n"
4545
"Setting the " SKIP_CHECK_VAR " environment variable "

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.