Change parameter name.

This commit is contained in:
Stephen Chung 2021-11-23 18:10:01 +08:00
parent 2e9807b172
commit 0c89a9c4c5
3 changed files with 9 additions and 10 deletions

View File

@ -69,7 +69,7 @@ mod array_functions {
}
#[rhai_fn(return_raw)]
pub fn pad(
_ctx: NativeCallContext,
ctx: NativeCallContext,
array: &mut Array,
len: INT,
item: Dynamic,
@ -78,6 +78,8 @@ mod array_functions {
return Ok(());
}
let _ctx = ctx;
// Check if array will be over max size limit
#[cfg(not(feature = "unchecked"))]
if _ctx.engine().max_array_size() > 0 && (len as usize) > _ctx.engine().max_array_size() {

View File

@ -30,11 +30,12 @@ mod blob_functions {
}
#[rhai_fn(name = "blob", return_raw)]
pub fn blob_with_capacity_and_value(
_ctx: NativeCallContext,
ctx: NativeCallContext,
len: INT,
value: INT,
) -> Result<Blob, Box<EvalAltResult>> {
let len = if len < 0 { 0 } else { len as usize };
let _ctx = ctx;
// Check if blob will be over max size limit
#[cfg(not(feature = "unchecked"))]
@ -46,11 +47,8 @@ mod blob_functions {
.into());
}
let value = (value & 0x000f) as u8;
let mut blob = Blob::with_capacity(len);
for _ in 0..len {
blob.push(value);
}
let mut blob = Blob::new();
blob.resize(len, (value & 0x000f) as u8);
Ok(blob)
}
#[rhai_fn(name = "len", get = "len", pure)]
@ -106,7 +104,7 @@ mod blob_functions {
}
#[rhai_fn(return_raw)]
pub fn pad(
_ctx: NativeCallContext,
ctx: NativeCallContext,
blob: &mut Blob,
len: INT,
item: INT,
@ -116,6 +114,7 @@ mod blob_functions {
}
let item = (item & 0x000f) as u8;
let _ctx = ctx;
// Check if blob will be over max size limit
#[cfg(not(feature = "unchecked"))]

View File

@ -469,7 +469,6 @@ mod string_functions {
if len <= 0 {
return Ok(());
}
let _ctx = ctx;
// Check if string will be over max size limit
@ -514,7 +513,6 @@ mod string_functions {
if len <= 0 {
return Ok(());
}
let _ctx = ctx;
// Check if string will be over max size limit