[librsvg: 1/2] Some minor type adjustments in the C API




commit c5fd084f2ca52721f1a442a59f659378cea4ccb7
Author: Sven Neumann <sven svenfoo org>
Date:   Fri Sep 25 08:33:50 2020 +0200

    Some minor type adjustments in the C API
    
    Try to match the types in the C header file as close as possible
    by using the type definitions from the libc crate.

 librsvg/c_api.rs        | 12 ++++++------
 librsvg/dpi.rs          |  4 ++--
 librsvg/pixbuf_utils.rs | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index f4c63fea..ca2e9aee 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -1166,7 +1166,7 @@ pub unsafe extern "C" fn rsvg_handle_get_base_uri(
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_set_dpi(handle: *const RsvgHandle, dpi: f64) {
+pub unsafe extern "C" fn rsvg_handle_set_dpi(handle: *const RsvgHandle, dpi: libc::c_double) {
     rsvg_return_if_fail! {
         rsvg_handle_set_dpi;
 
@@ -1181,8 +1181,8 @@ pub unsafe extern "C" fn rsvg_handle_set_dpi(handle: *const RsvgHandle, dpi: f64
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_set_dpi_x_y(
     handle: *const RsvgHandle,
-    dpi_x: f64,
-    dpi_y: f64,
+    dpi_x: libc::c_double,
+    dpi_y: libc::c_double,
 ) {
     rsvg_return_if_fail! {
         rsvg_handle_set_dpi_x_y;
@@ -1506,7 +1506,7 @@ pub unsafe extern "C" fn rsvg_handle_new() -> *const RsvgHandle {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rsvg_handle_new_with_flags(flags: u32) -> *const RsvgHandle {
+pub unsafe extern "C" fn rsvg_handle_new_with_flags(flags: RsvgHandleFlags) -> *const RsvgHandle {
     let obj: *mut gobject_sys::GObject =
         glib::Object::new(CHandle::get_type(), &[("flags", &flags)])
             .unwrap()
@@ -1544,7 +1544,7 @@ pub unsafe extern "C" fn rsvg_handle_new_from_file(
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_handle_new_from_gfile_sync(
     file: *mut gio_sys::GFile,
-    flags: u32,
+    flags: RsvgHandleFlags,
     cancellable: *mut gio_sys::GCancellable,
     error: *mut *mut glib_sys::GError,
 ) -> *const RsvgHandle {
@@ -1585,7 +1585,7 @@ pub unsafe extern "C" fn rsvg_handle_new_from_gfile_sync(
 pub unsafe extern "C" fn rsvg_handle_new_from_stream_sync(
     input_stream: *mut gio_sys::GInputStream,
     base_file: *mut gio_sys::GFile,
-    flags: u32,
+    flags: RsvgHandleFlags,
     cancellable: *mut gio_sys::GCancellable,
     error: *mut *mut glib_sys::GError,
 ) -> *const RsvgHandle {
diff --git a/librsvg/dpi.rs b/librsvg/dpi.rs
index ea0bcf24..f8e07edc 100644
--- a/librsvg/dpi.rs
+++ b/librsvg/dpi.rs
@@ -52,7 +52,7 @@ impl From<Dpi> for rsvg_internals::Dpi {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rsvg_set_default_dpi_x_y(dpi_x: f64, dpi_y: f64) {
+pub unsafe extern "C" fn rsvg_set_default_dpi_x_y(dpi_x: libc::c_double, dpi_y: libc::c_double) {
     if dpi_x <= 0.0 {
         DPI_X = DEFAULT_DPI_X;
     } else {
@@ -67,7 +67,7 @@ pub unsafe extern "C" fn rsvg_set_default_dpi_x_y(dpi_x: f64, dpi_y: f64) {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn rsvg_set_default_dpi(dpi: f64) {
+pub unsafe extern "C" fn rsvg_set_default_dpi(dpi: libc::c_double) {
     if dpi <= 0.0 {
         DPI_X = DEFAULT_DPI_X;
         DPI_Y = DEFAULT_DPI_Y;
diff --git a/librsvg/pixbuf_utils.rs b/librsvg/pixbuf_utils.rs
index 41dcd60d..a2e48939 100644
--- a/librsvg/pixbuf_utils.rs
+++ b/librsvg/pixbuf_utils.rs
@@ -296,8 +296,8 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file(
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_size(
     filename: *const libc::c_char,
-    width: i32,
-    height: i32,
+    width: libc::c_int,
+    height: libc::c_int,
     error: *mut *mut glib_sys::GError,
 ) -> *mut gdk_pixbuf_sys::GdkPixbuf {
     rsvg_return_val_if_fail! {
@@ -324,8 +324,8 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_size(
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom(
     filename: *const libc::c_char,
-    x_zoom: f64,
-    y_zoom: f64,
+    x_zoom: libc::c_double,
+    y_zoom: libc::c_double,
     error: *mut *mut glib_sys::GError,
 ) -> *mut gdk_pixbuf_sys::GdkPixbuf {
     rsvg_return_val_if_fail! {
@@ -352,10 +352,10 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom(
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom_with_max(
     filename: *const libc::c_char,
-    x_zoom: f64,
-    y_zoom: f64,
-    max_width: i32,
-    max_height: i32,
+    x_zoom: libc::c_double,
+    y_zoom: libc::c_double,
+    max_width: libc::c_int,
+    max_height: libc::c_int,
     error: *mut *mut glib_sys::GError,
 ) -> *mut gdk_pixbuf_sys::GdkPixbuf {
     rsvg_return_val_if_fail! {
@@ -383,8 +383,8 @@ pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_zoom_with_max(
 #[no_mangle]
 pub unsafe extern "C" fn rsvg_pixbuf_from_file_at_max_size(
     filename: *const libc::c_char,
-    max_width: i32,
-    max_height: i32,
+    max_width: libc::c_int,
+    max_height: libc::c_int,
     error: *mut *mut glib_sys::GError,
 ) -> *mut gdk_pixbuf_sys::GdkPixbuf {
     rsvg_return_val_if_fail! {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]