Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compatibility issues #158

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
};

Some(xsqlvar)
} else {
Expand Down
Loading