Skip to content

Commit

Permalink
Merge branch 'main' into vec
Browse files Browse the repository at this point in the history
  • Loading branch information
nyovaya committed Aug 24, 2024
2 parents 285d9d2 + d037573 commit 75816b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/connection/_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl Connection {
let success = unsafe {
pq_sys::PQputCopyData(
self.into(),
buffer.as_ptr() as *const libc::c_char,
buffer.as_ptr() as *const raw::c_char,
buffer.len() as i32,
)
};
Expand Down
4 changes: 2 additions & 2 deletions src/connection/_notice_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl Connection {
pub unsafe fn set_notice_processor(
&self,
proc: NoticeProcessor,
arg: *mut libc::c_void,
arg: *mut raw::c_void,
) -> NoticeProcessor {
pq_sys::PQsetNoticeProcessor(self.into(), proc, arg)
}
Expand All @@ -23,7 +23,7 @@ impl Connection {
pub unsafe fn set_notice_receiver(
&self,
proc: NoticeReceiver,
arg: *mut libc::c_void,
arg: *mut raw::c_void,
) -> NoticeReceiver {
pq_sys::PQsetNoticeReceiver(self.into(), proc, arg)
}
Expand Down
6 changes: 4 additions & 2 deletions src/connection/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::os::raw;

/**
* PqBytes is used as smart pointer to `std::ffi::c_void` pointer that was allocated by libpq.
*
Expand Down Expand Up @@ -143,7 +145,7 @@ impl PqBytes {
*/
#[derive(Debug)]
pub struct PqString {
ptr: *const libc::c_char,
ptr: *const raw::c_char,
}

impl std::ops::Deref for PqString {
Expand Down Expand Up @@ -183,7 +185,7 @@ impl Drop for PqString {
}

impl PqString {
pub(crate) fn from_raw(ptr: *const libc::c_char) -> PqString {
pub(crate) fn from_raw(ptr: *const raw::c_char) -> PqString {
debug_assert!(!ptr.is_null(), "ptr must be not null");
PqString { ptr }
}
Expand Down
4 changes: 3 additions & 1 deletion src/connection/info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::os::raw;

#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Info {
pub keyword: String,
Expand Down Expand Up @@ -40,7 +42,7 @@ impl Info {
let c_dsn = crate::ffi::to_cstr(dsn);

unsafe {
let mut errmsg: *mut libc::c_char = std::ptr::null_mut();
let mut errmsg: *mut raw::c_char = std::ptr::null_mut();
let raw = pq_sys::PQconninfoParse(c_dsn.as_ptr(), &mut errmsg);

if raw.is_null() {
Expand Down
6 changes: 4 additions & 2 deletions src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub use status::*;
pub type NoticeProcessor = pq_sys::PQnoticeProcessor;
pub type NoticeReceiver = pq_sys::PQnoticeReceiver;

use std::os::raw;

#[derive(Clone)]
pub struct Connection {
conn: *mut pq_sys::PGconn,
Expand Down Expand Up @@ -82,7 +84,7 @@ impl Connection {
fn transform_params(
param_values: &[Option<&[u8]>],
param_formats: &[crate::Format],
) -> (Vec<*const libc::c_char>, Vec<i32>, Vec<i32>) {
) -> (Vec<*const raw::c_char>, Vec<i32>, Vec<i32>) {
if param_values.is_empty() {
return Default::default();
}
Expand All @@ -99,7 +101,7 @@ impl Connection {
if format == &crate::Format::Text && v.last() != Some(&b'\0') {
panic!("Param value as text should be null terminated");
}
values.push(v.as_ptr() as *const libc::c_char);
values.push(v.as_ptr() as *const raw::c_char);
lengths.push(v.len() as i32);
} else {
values.push(std::ptr::null());
Expand Down
10 changes: 6 additions & 4 deletions src/result/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mod error_field;
pub use attribute::*;
pub use error_field::*;

use std::os::raw;

#[derive(Clone)]
pub struct PQResult {
result: *mut pq_sys::PGresult,
Expand Down Expand Up @@ -278,10 +280,10 @@ impl PQResult {
html3: option.html3 as pq_sys::pqbool,
expanded: option.expanded as pq_sys::pqbool,
pager: option.pager as pq_sys::pqbool,
fieldSep: c_field_sep.as_ptr() as *mut libc::c_char,
tableOpt: c_table_opt.as_ptr() as *mut libc::c_char,
caption: c_caption.as_ptr() as *mut libc::c_char,
fieldName: ptr_field_name.as_ptr() as *mut *mut libc::c_char,
fieldSep: c_field_sep.as_ptr() as *mut raw::c_char,
tableOpt: c_table_opt.as_ptr() as *mut raw::c_char,
caption: c_caption.as_ptr() as *mut raw::c_char,
fieldName: ptr_field_name.as_ptr() as *mut *mut raw::c_char,
};

unsafe {
Expand Down

0 comments on commit 75816b4

Please sign in to comment.