From 4bad757012bcb11646868930683ec330f11e91d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Wed, 10 May 2023 15:20:04 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/47845 Reviewed-By: James M Snell Reviewed-By: Darshan Sen Reviewed-By: Shelley Vohr --- src/node_main.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node_main.cc b/src/node_main.cc index d486bbc31c1f6b..8099b2a3a1941d 100644 --- a/src/node_main.cc +++ b/src/node_main.cc @@ -28,18 +28,18 @@ #include #define SKIP_CHECK_VAR "NODE_SKIP_PLATFORM_CHECK" -#define SKIP_CHECK_SIZE 1 #define SKIP_CHECK_VALUE "1" +#define SKIP_CHECK_STRLEN (sizeof(SKIP_CHECK_VALUE) - 1) int wmain(int argc, wchar_t* wargv[]) { // Windows Server 2012 (not R2) is supported until 10/10/2023, so we allow it // to run in the experimental support tier. - char buf[SKIP_CHECK_SIZE + 1]; + char buf[SKIP_CHECK_STRLEN + 1]; if (!IsWindows8Point1OrGreater() && !(IsWindowsServer() && IsWindows8OrGreater()) && (GetEnvironmentVariableA(SKIP_CHECK_VAR, buf, sizeof(buf)) != - SKIP_CHECK_SIZE || - strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_SIZE + 1) != 0)) { + SKIP_CHECK_STRLEN || + strncmp(buf, SKIP_CHECK_VALUE, SKIP_CHECK_STRLEN) != 0)) { fprintf(stderr, "Node.js is only supported on Windows 8.1, Windows " "Server 2012 R2, or higher.\n" "Setting the " SKIP_CHECK_VAR " environment variable "