Skip to content

Commit

Permalink
Merge pull request #158 from Noriebalbinot/master
Browse files Browse the repository at this point in the history
fix compatibility issues
  • Loading branch information
fernandobatels authored Aug 28, 2024
2 parents 38589cd + 1d7ab60 commit 3dcdc94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rsfbclient-native/src/varchar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ impl Varchar {
pub fn as_bytes(&self) -> &[u8] {
let len = u16::min(self.capacity, unsafe { self.ptr.as_ref().len }) as usize;

unsafe { self.ptr.as_ref().data.get_unchecked(..len) }
unsafe {
let ptr = self.ptr.as_ref().data.as_ptr();
std::slice::from_raw_parts(ptr, len).get_unchecked(..len)
}
}

/// Get the pointer to the inner type
Expand Down
6 changes: 5 additions & 1 deletion rsfbclient-native/src/xsqlda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ impl XSqlDa {
/// Returns a mutable reference to a XSQLVAR
pub fn get_xsqlvar_mut(&mut self, col: usize) -> Option<&mut ibase::XSQLVAR> {
if col < self.len as usize {
let xsqlvar = unsafe { self.ptr.as_mut().sqlvar.get_unchecked_mut(col as usize) };
let xsqlvar = unsafe {
let ptr = self.ptr.as_mut().sqlvar.as_mut_ptr();
std::slice::from_raw_parts_mut(ptr, self.len as usize)
.get_unchecked_mut(col as usize)

Check warning on line 42 in rsfbclient-native/src/xsqlda.rs

View workflow job for this annotation

GitHub Actions / clippy

casting to the same type is unnecessary (`usize` -> `usize`)

warning: casting to the same type is unnecessary (`usize` -> `usize`) --> rsfbclient-native/src/xsqlda.rs:42:40 | 42 | .get_unchecked_mut(col as usize) | ^^^^^^^^^^^^ help: try: `col` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
};

Some(xsqlvar)
} else {
Expand Down

0 comments on commit 3dcdc94

Please sign in to comment.