You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/04/11 12:29:56 UTC

(opendal) branch fix-ci created (now 40b18ef1f2)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a change to branch fix-ci
in repository https://gitbox.apache.org/repos/asf/opendal.git


      at 40b18ef1f2 Fix CI

This branch includes the following new commits:

     new 40b18ef1f2 Fix CI

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(opendal) 01/01: Fix CI

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch fix-ci
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit 40b18ef1f27fa6bd02c9055907ffae3c482fd266
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Apr 11 20:29:45 2024 +0800

    Fix CI
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 bindings/cpp/src/lib.rs               | 2 +-
 bindings/dotnet/src/lib.rs            | 2 +-
 bindings/haskell/src/lib.rs           | 2 +-
 bindings/lua/src/lib.rs               | 2 +-
 bindings/ocaml/src/operator/mod.rs    | 2 +-
 bindings/ocaml/src/operator/reader.rs | 2 +-
 bindings/ruby/src/lib.rs              | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bindings/cpp/src/lib.rs b/bindings/cpp/src/lib.rs
index 88d6c0092a..8cc88fddb0 100644
--- a/bindings/cpp/src/lib.rs
+++ b/bindings/cpp/src/lib.rs
@@ -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.
diff --git a/bindings/dotnet/src/lib.rs b/bindings/dotnet/src/lib.rs
index ba2415b9dd..de2c1a5f37 100644
--- a/bindings/dotnet/src/lib.rs
+++ b/bindings/dotnet/src/lib.rs
@@ -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()
diff --git a/bindings/haskell/src/lib.rs b/bindings/haskell/src/lib.rs
index 602706e497..17f7313b27 100644
--- a/bindings/haskell/src/lib.rs
+++ b/bindings/haskell/src/lib.rs
@@ -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),
     };
 
diff --git a/bindings/lua/src/lib.rs b/bindings/lua/src/lib.rs
index 8d0d55181e..182fce8e3d 100644
--- a/bindings/lua/src/lib.rs
+++ b/bindings/lua/src/lib.rs
@@ -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)),
     }
 }
diff --git a/bindings/ocaml/src/operator/mod.rs b/bindings/ocaml/src/operator/mod.rs
index 4d9386f018..e6cddc3e27 100644
--- a/bindings/ocaml/src/operator/mod.rs
+++ b/bindings/ocaml/src/operator/mod.rs
@@ -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]
diff --git a/bindings/ocaml/src/operator/reader.rs b/bindings/ocaml/src/operator/reader.rs
index 8cae9ca88c..2f069148d5 100644
--- a/bindings/ocaml/src/operator/reader.rs
+++ b/bindings/ocaml/src/operator/reader.rs
@@ -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)
 }
diff --git a/bindings/ruby/src/lib.rs b/bindings/ruby/src/lib.rs
index f69f52baa2..a2c319a61c 100644
--- a/bindings/ruby/src/lib.rs
+++ b/bindings/ruby/src/lib.rs
@@ -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.