Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Apr 11, 2024
1 parent 5f6669b commit 40b18ef
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bindings/cpp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn new_operator(scheme: &str, configs: Vec<ffi::HashMapValue>) -> Result<Box<Ope

impl Operator {
fn read(&self, path: &str) -> Result<Vec<u8>> {
Ok(self.0.read(path)?)
Ok(self.0.read(path)?.to_vec())
}

// To avoid copying the bytes, we use &'static [u8] here.
Expand Down
2 changes: 1 addition & 1 deletion bindings/dotnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub unsafe extern "C" fn blocking_operator_read(
) -> *const c_char {
let op = &*(op);
let path = std::ffi::CStr::from_ptr(path).to_str().unwrap();
let mut res = op.read(path).unwrap();
let mut res = op.read(path).unwrap().to_vec();
res.push(0);
std::ffi::CString::from_vec_with_nul(res)
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion bindings/haskell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub unsafe extern "C" fn blocking_read(
};

let res = match op.read(path_str) {
Ok(bytes) => FFIResult::ok(ByteSlice::from_vec(bytes)),
Ok(bytes) => FFIResult::ok(ByteSlice::from_vec(bytes.to_vec())),
Err(e) => FFIResult::err_with_source("Failed to read", e),
};

Expand Down
2 changes: 1 addition & 1 deletion bindings/lua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn operator_read<'a>(
let path = path.as_str();
let data = op.read(path);
match data {
Ok(data) => Ok(lua.create_string(&data)?),
Ok(data) => Ok(lua.create_string(&data.to_vec())?),
Err(e) => Err(LuaError::external(e)),
}
}
Expand Down
2 changes: 1 addition & 1 deletion bindings/ocaml/src/operator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn blocking_create_dir(operator: &mut Operator, path: String) -> Result<(),
#[ocaml::func]
#[ocaml::sig("operator -> string -> (char array, string) Result.t ")]
pub fn blocking_read(operator: &mut Operator, path: String) -> Result<Vec<u8>, String> {
map_res_error(operator.0.read(path.as_str()))
map_res_error(operator.0.read(path.as_str()).map(|v| v.to_vec()))
}

#[ocaml::func]
Expand Down
2 changes: 1 addition & 1 deletion bindings/ocaml/src/operator/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ use super::*;
#[ocaml::sig("reader -> bytes -> int64 -> (int, string) Result.t ")]
pub fn reader_pread(reader: &mut Reader, mut buf: &mut [u8], offset: u64) -> Result<usize, String> {
let size = buf.len();
let n = map_res_error(reader.0.read(&mut buf, offset, size))?;
let n = map_res_error(reader.0.read_into(&mut buf, offset..offset + size as u64))?;
Ok(n)
}
2 changes: 1 addition & 1 deletion bindings/ruby/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Operator {
/// Read the whole path into string.
pub fn read(&self, path: String) -> Result<RString> {
let bytes = self.0.read(&path).map_err(format_magnus_error)?;
Ok(RString::from_slice(&bytes))
Ok(RString::from_slice(&bytes.to_vec()))
}

/// Write string into given path.
Expand Down

0 comments on commit 40b18ef

Please sign in to comment.