| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c3b8e50 commit 91a4cb7
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,7 +85,7 @@ const { | |||
| 85 | 85 | isUint32, | |
| 86 | 86 | parseMode, | |
| 87 | 87 | validateBuffer, | |
| 88 | - validateInteger, | ||
| 88 | + validateSafeInteger, | ||
| 89 | 89 | validateInt32, | |
| 90 | 90 | validateUint32 | |
| 91 | 91 | } = require('internal/validators'); | |
@@ -621,7 +621,7 @@ function truncate(path, len, callback) { | |||
| 621 | 621 | len = 0; | |
| 622 | 622 | } | |
| 623 | 623 | ||
| 624 | - validateInteger(len, 'len'); | ||
| 624 | + validateSafeInteger(len, 'len'); | ||
| 625 | 625 | callback = maybeCallback(callback); | |
| 626 | 626 | fs.open(path, 'r+', (er, fd) => { | |
| 627 | 627 | if (er) return callback(er); | |
@@ -662,7 +662,7 @@ function ftruncate(fd, len = 0, callback) { | |||
| 662 | 662 | len = 0; | |
| 663 | 663 | } | |
| 664 | 664 | validateInt32(fd, 'fd', 0); | |
| 665 | - validateInteger(len, 'len'); | ||
| 665 | + validateSafeInteger(len, 'len'); | ||
| 666 | 666 | len = Math.max(0, len); | |
| 667 | 667 | const req = new FSReqCallback(); | |
| 668 | 668 | req.oncomplete = makeCallback(callback); | |
@@ -671,7 +671,7 @@ function ftruncate(fd, len = 0, callback) { | |||
| 671 | 671 | ||
| 672 | 672 | function ftruncateSync(fd, len = 0) { | |
| 673 | 673 | validateInt32(fd, 'fd', 0); | |
| 674 | - validateInteger(len, 'len'); | ||
| 674 | + validateSafeInteger(len, 'len'); | ||
| 675 | 675 | len = Math.max(0, len); | |
| 676 | 676 | const ctx = {}; | |
| 677 | 677 | binding.ftruncate(fd, len, undefined, ctx); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | const { AsyncWrap, Providers } = internalBinding('async_wrap'); | |
| 4 | 4 | const { Buffer } = require('buffer'); | |
| 5 | 5 | const { scrypt: _scrypt } = internalBinding('crypto'); | |
| 6 | - const { validateInteger, validateUint32 } = require('internal/validators'); | ||
| 6 | + const { validateSafeInteger, validateUint32 } = require('internal/validators'); | ||
| 7 | 7 | const { | |
| 8 | 8 | ERR_CRYPTO_SCRYPT_INVALID_PARAMETER, | |
| 9 | 9 | ERR_CRYPTO_SCRYPT_NOT_SUPPORTED, | |
@@ -108,7 +108,7 @@ function check(password, salt, keylen, options) { | |||
| 108 | 108 | } | |
| 109 | 109 | if (options.maxmem !== undefined) { | |
| 110 | 110 | maxmem = options.maxmem; | |
| 111 | - validateInteger(maxmem, 'maxmem', 0); | ||
| 111 | + validateSafeInteger(maxmem, 'maxmem', 0); | ||
| 112 | 112 | } | |
| 113 | 113 | if (N === 0) N = defaults.N; | |
| 114 | 114 | if (r === 0) r = defaults.r; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ const { | |||
| 36 | 36 | const { | |
| 37 | 37 | parseMode, | |
| 38 | 38 | validateBuffer, | |
| 39 | - validateInteger, | ||
| 39 | + validateSafeInteger, | ||
| 40 | 40 | validateUint32 | |
| 41 | 41 | } = require('internal/validators'); | |
| 42 | 42 | const pathModule = require('path'); | |
@@ -270,7 +270,7 @@ async function truncate(path, len = 0) { | |||
| 270 | 270 | ||
| 271 | 271 | async function ftruncate(handle, len = 0) { | |
| 272 | 272 | validateFileHandle(handle); | |
| 273 | - validateInteger(len, 'len'); | ||
| 273 | + validateSafeInteger(len, 'len'); | ||
| 274 | 274 | len = Math.max(0, len); | |
| 275 | 275 | return binding.ftruncate(handle.fd, len, kUsePromises); | |
| 276 | 276 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,7 @@ function parseMode(value, name, def) { | |||
| 62 | 62 | throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc); | |
| 63 | 63 | } | |
| 64 | 64 | ||
| 65 | - const validateInteger = hideStackFrames( | ||
| 65 | + const validateSafeInteger = hideStackFrames( | ||
| 66 | 66 | (value, name, min = MIN_SAFE_INTEGER, max = MAX_SAFE_INTEGER) => { | |
| 67 | 67 | if (typeof value !== 'number') | |
| 68 | 68 | throw new ERR_INVALID_ARG_TYPE(name, 'number', value); | |
@@ -161,7 +161,7 @@ module.exports = { | |||
| 161 | 161 | parseMode, | |
| 162 | 162 | validateBuffer, | |
| 163 | 163 | validateEncoding, | |
| 164 | - validateInteger, | ||
| 164 | + validateSafeInteger, | ||
| 165 | 165 | validateInt32, | |
| 166 | 166 | validateUint32, | |
| 167 | 167 | validateString, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments