From 8ce7edc7f6204b70b50c8c907688bea819a01ead Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Thu, 29 Sep 2022 12:09:10 -0400 Subject: [PATCH 1/6] removed -q flags --- binding.gyp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/binding.gyp b/binding.gyp index 986d7107..185d8b3c 100644 --- a/binding.gyp +++ b/binding.gyp @@ -35,11 +35,6 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden } }], - [ 'OS=="zos"', { - 'cflags': [ - '-qascii', - ], - }], ], }, { From ac42d3f26ddc934e3fa15e2543ab9005f12ae49e Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Fri, 30 Sep 2022 11:50:22 -0400 Subject: [PATCH 2/6] added node < v16 condition --- binding.gyp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/binding.gyp b/binding.gyp index 185d8b3c..10b4b9d7 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,4 +1,7 @@ { + "variables": { + "NODE_VERSION%":" Date: Fri, 30 Sep 2022 15:36:07 -0400 Subject: [PATCH 3/6] added napi exception flag --- binding.gyp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index 10b4b9d7..7dc7e884 100644 --- a/binding.gyp +++ b/binding.gyp @@ -38,10 +38,11 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden } }], - ['OS=="zos" and NODE_VERSION < 16',{ + ['OS=="zos" and NODE_VERSION < 17',{ 'cflags': [ '-qascii', ], + "defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ], }], ], }, From ee9117c7663852cde250b0f5a37b8958b21bdd55 Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Fri, 30 Sep 2022 17:09:33 -0400 Subject: [PATCH 4/6] changed node version <16 --- binding.gyp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index 7dc7e884..10b4b9d7 100644 --- a/binding.gyp +++ b/binding.gyp @@ -38,11 +38,10 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden } }], - ['OS=="zos" and NODE_VERSION < 17',{ + ['OS=="zos" and NODE_VERSION < 16',{ 'cflags': [ '-qascii', ], - "defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ], }], ], }, From 4c99e9ed504dbc23a41e80702ca237925bbc0be8 Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Mon, 3 Oct 2022 17:51:09 -0400 Subject: [PATCH 5/6] fix build errors --- bcrypt.js | 6 +++++- binding.gyp | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bcrypt.js b/bcrypt.js index 7fc281c4..dd8aed06 100644 --- a/bcrypt.js +++ b/bcrypt.js @@ -87,10 +87,14 @@ module.exports.genSalt = function genSalt(rounds, minor, cb) { /// @param {String} salt the salt to use when hashing /// @return {String} hash module.exports.hashSync = function hashSync(data, salt) { + if (data == null || salt == null) { throw new Error('data and salt arguments required'); } - + + if (salt === '') { + throw new Error('Salt cannot be empty'); + } if (typeof data !== 'string' || (typeof salt !== 'string' && typeof salt !== 'number')) { throw new Error('data must be a string and salt must either be a salt string or a number of rounds'); } diff --git a/binding.gyp b/binding.gyp index 10b4b9d7..181dca0f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -38,10 +38,11 @@ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden } }], - ['OS=="zos" and NODE_VERSION < 16',{ + ['OS=="zos" and NODE_VERSION <= 16',{ 'cflags': [ '-qascii', ], + 'defines': ["NAPI_DISABLE_CPP_EXCEPTIONS"], }], ], }, From fd00ae0819e654e806565b60b33f06d82fcdb2b3 Mon Sep 17 00:00:00 2001 From: Jonathan Lai Date: Tue, 4 Oct 2022 11:13:41 -0400 Subject: [PATCH 6/6] reverted bcrypt.js changes --- bcrypt.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bcrypt.js b/bcrypt.js index dd8aed06..7fc281c4 100644 --- a/bcrypt.js +++ b/bcrypt.js @@ -87,14 +87,10 @@ module.exports.genSalt = function genSalt(rounds, minor, cb) { /// @param {String} salt the salt to use when hashing /// @return {String} hash module.exports.hashSync = function hashSync(data, salt) { - if (data == null || salt == null) { throw new Error('data and salt arguments required'); } - - if (salt === '') { - throw new Error('Salt cannot be empty'); - } + if (typeof data !== 'string' || (typeof salt !== 'string' && typeof salt !== 'number')) { throw new Error('data must be a string and salt must either be a salt string or a number of rounds'); }