Skip to content

Commit 91a4cb7

Browse files
zbjornsonTrott
authored andcommitted
lib: rename validateInteger to validateSafeInteger
PR-URL: #26572 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent c3b8e50 commit 91a4cb7

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎lib/fs.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const {
8585
isUint32,
8686
parseMode,
8787
validateBuffer,
88-
validateInteger,
88+
validateSafeInteger,
8989
validateInt32,
9090
validateUint32
9191
}=require('internal/validators');
@@ -621,7 +621,7 @@ function truncate(path, len, callback) {
621621
len=0;
622622
}
623623

624-
validateInteger(len,'len');
624+
validateSafeInteger(len,'len');
625625
callback=maybeCallback(callback);
626626
fs.open(path,'r+',(er,fd)=>{
627627
if(er)returncallback(er);
@@ -662,7 +662,7 @@ function ftruncate(fd, len = 0, callback) {
662662
len=0;
663663
}
664664
validateInt32(fd,'fd',0);
665-
validateInteger(len,'len');
665+
validateSafeInteger(len,'len');
666666
len=Math.max(0,len);
667667
constreq=newFSReqCallback();
668668
req.oncomplete=makeCallback(callback);
@@ -671,7 +671,7 @@ function ftruncate(fd, len = 0, callback) {
671671

672672
functionftruncateSync(fd,len=0){
673673
validateInt32(fd,'fd',0);
674-
validateInteger(len,'len');
674+
validateSafeInteger(len,'len');
675675
len=Math.max(0,len);
676676
constctx={};
677677
binding.ftruncate(fd,len,undefined,ctx);

‎lib/internal/crypto/scrypt.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const{ AsyncWrap, Providers }=internalBinding('async_wrap');
44
const{ Buffer }=require('buffer');
55
const{scrypt: _scrypt}=internalBinding('crypto');
6-
const{validateInteger, validateUint32 }=require('internal/validators');
6+
const{validateSafeInteger, validateUint32 }=require('internal/validators');
77
const{
88
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER,
99
ERR_CRYPTO_SCRYPT_NOT_SUPPORTED,
@@ -108,7 +108,7 @@ function check(password, salt, keylen, options) {
108108
}
109109
if(options.maxmem!==undefined){
110110
maxmem=options.maxmem;
111-
validateInteger(maxmem,'maxmem',0);
111+
validateSafeInteger(maxmem,'maxmem',0);
112112
}
113113
if(N===0)N=defaults.N;
114114
if(r===0)r=defaults.r;

‎lib/internal/fs/promises.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const {
3636
const{
3737
parseMode,
3838
validateBuffer,
39-
validateInteger,
39+
validateSafeInteger,
4040
validateUint32
4141
}=require('internal/validators');
4242
constpathModule=require('path');
@@ -270,7 +270,7 @@ async function truncate(path, len = 0) {
270270

271271
asyncfunctionftruncate(handle,len=0){
272272
validateFileHandle(handle);
273-
validateInteger(len,'len');
273+
validateSafeInteger(len,'len');
274274
len=Math.max(0,len);
275275
returnbinding.ftruncate(handle.fd,len,kUsePromises);
276276
}

‎lib/internal/validators.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function parseMode(value, name, def) {
6262
thrownewERR_INVALID_ARG_VALUE(name,value,modeDesc);
6363
}
6464

65-
constvalidateInteger=hideStackFrames(
65+
constvalidateSafeInteger=hideStackFrames(
6666
(value,name,min=MIN_SAFE_INTEGER,max=MAX_SAFE_INTEGER)=>{
6767
if(typeofvalue!=='number')
6868
thrownewERR_INVALID_ARG_TYPE(name,'number',value);
@@ -161,7 +161,7 @@ module.exports = {
161161
parseMode,
162162
validateBuffer,
163163
validateEncoding,
164-
validateInteger,
164+
validateSafeInteger,
165165
validateInt32,
166166
validateUint32,
167167
validateString,

0 commit comments

Comments
 (0)