Skip to content

Commit 19f3641

Browse files
author
Joshua Nelson
committed
Allow test suite to compile on x32
1 parent 2b67fee commit 19f3641

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ mod test {
112112
#[ignore]
113113
fn test_invalid_exit() {
114114
use std::env::set_var;
115+
use std::os::raw::c_ulong;
115116
use crate::craw::ydb_string_t;
116117

117118
set_var("ydb_routines", "examples/m-ffi");
@@ -122,7 +123,7 @@ mod test {
122123
let mut buf = Vec::<u8>::with_capacity(1000);
123124

124125
let mut status =
125-
ydb_string_t { address: buf.as_mut_ptr() as *mut _, length: buf.capacity() as u64 };
126+
ydb_string_t { address: buf.as_mut_ptr() as *mut _, length: buf.capacity() as c_ulong };
126127
let exit = CString::new("ydb_exit").unwrap();
127128
unsafe {
128129
ci_t!(YDB_NOTTP, Vec::new(), &exit, &mut status as *mut ydb_string_t).unwrap();

src/simple_api/call_in.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ pub fn ci_tab_switch_t(
142142
/// ```
143143
/// use std::env;
144144
/// use std::ffi::CString;
145+
/// use std::os::raw::c_char;
145146
/// use yottadb::{craw, ci_t, TpToken};
146147
///
147148
/// env::set_var("ydb_routines", "examples/m-ffi");
148149
/// env::set_var("ydb_ci", "examples/m-ffi/calltab.ci");
149150
///
150151
/// let mut buf = Vec::<u8>::with_capacity(100);
151-
/// let mut msg = craw::ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut i8 };
152+
/// let mut msg = craw::ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut c_char };
152153
/// let routine = CString::new("HelloWorld1").unwrap();
153154
/// unsafe {
154155
/// ci_t!(TpToken::default(), Vec::with_capacity(100), &routine, &mut msg as *mut _).unwrap();
@@ -236,13 +237,14 @@ impl Drop for CallInDescriptor {
236237
/// ```
237238
/// use std::env;
238239
/// use std::ffi::CString;
240+
/// use std::os::raw::c_char;
239241
/// use yottadb::{craw, cip_t, CallInDescriptor, TpToken};
240242
///
241243
/// env::set_var("ydb_routines", "examples/m-ffi");
242244
/// env::set_var("ydb_ci", "examples/m-ffi/calltab.ci");
243245
///
244246
/// let mut buf = Vec::<u8>::with_capacity(100);
245-
/// let mut msg = craw::ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut i8 };
247+
/// let mut msg = craw::ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut c_char };
246248
/// let mut routine = CallInDescriptor::new(CString::new("HelloWorld1").unwrap());
247249
/// unsafe {
248250
/// cip_t!(TpToken::default(), Vec::with_capacity(100), &mut routine, &mut msg as *mut _).unwrap();
@@ -268,6 +270,7 @@ mod test {
268270
use serial_test::serial;
269271
use std::env;
270272
use std::ffi::CString;
273+
use std::os::raw::c_char;
271274
use super::*;
272275
use crate::craw::{self, ydb_string_t, ydb_long_t};
273276
use crate::YDB_NOTTP;
@@ -286,16 +289,16 @@ mod test {
286289

287290
let mut ret_buf = Vec::<u8>::with_capacity(100);
288291
let mut ret_msg =
289-
ydb_string_t { length: 100, address: ret_buf.as_mut_ptr() as *mut i8 };
292+
ydb_string_t { length: 100, address: ret_buf.as_mut_ptr() as *mut c_char };
290293

291294
let buf1 = b"parm1";
292-
let mut msg1 = ydb_string_t { length: 5, address: buf1.as_ptr() as *mut i8 };
295+
let mut msg1 = ydb_string_t { length: 5, address: buf1.as_ptr() as *mut c_char };
293296

294297
let buf2 = b"parm2";
295-
let mut msg2 = ydb_string_t { length: 5, address: buf2.as_ptr() as *mut i8 };
298+
let mut msg2 = ydb_string_t { length: 5, address: buf2.as_ptr() as *mut c_char };
296299

297300
let buf3 = b"parm3";
298-
let mut msg3 = ydb_string_t { length: 5, address: buf3.as_ptr() as *mut i8 };
301+
let mut msg3 = ydb_string_t { length: 5, address: buf3.as_ptr() as *mut c_char };
299302

300303
unsafe {
301304
cip_t!(
@@ -359,7 +362,7 @@ mod test {
359362

360363
// same as doc-test for `ci_t`
361364
let mut buf = Vec::<u8>::with_capacity(100);
362-
let mut msg = ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut i8 };
365+
let mut msg = ydb_string_t { length: 100, address: buf.as_mut_ptr() as *mut c_char };
363366
let routine = CString::new("HelloWorld1").unwrap();
364367
unsafe {
365368
ci_t!(YDB_NOTTP, Vec::with_capacity(100), &routine, &mut msg as *mut _).unwrap();

0 commit comments

Comments
 (0)