[librsvg: 4/8] Do all simple argument checks in Rust
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/8] Do all simple argument checks in Rust
- Date: Thu, 9 Apr 2020 05:22:03 +0000 (UTC)
commit 5072e759495a4e69d942d0225305a26d2b854d48
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Apr 8 18:50:58 2020 -0500
Do all simple argument checks in Rust
These are the ones which are just comparisons; we'll do GObject type
checks later.
Some arguments on the Rust side are renamed to match their C
counterparts, for consistency and to be able to cut&paste the
conditions into the code.
Also, rsvg_rust_handle_write() now returns a gboolean, per the C API,
even if it always returns true.
librsvg/c_api.rs | 126 ++++++++++++++++++++++++++++++++++++++++++++++--
librsvg/pixbuf_utils.rs | 49 ++++++++++++++++---
librsvg/rsvg-handle.c | 36 +-------------
librsvg/rsvg-pixbuf.c | 28 ++---------
4 files changed, 168 insertions(+), 71 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 563b8c72..4cec4d57 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -1015,6 +1015,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_read_stream_sync(
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_read_stream_sync => false.to_glib();
+
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let stream = gio::InputStream::from_glib_none(stream);
@@ -1035,10 +1041,20 @@ pub unsafe extern "C" fn rsvg_rust_handle_write(
handle: *const RsvgHandle,
buf: *const u8,
count: usize,
-) {
+ error: *mut *mut glib_sys::GError,
+) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_write => false.to_glib();
+
+ error.is_null() || (*error).is_null(),
+ (!buf.is_null() && count != 0) || (count == 0),
+ }
+
let rhandle = get_rust_handle(handle);
let buffer = slice::from_raw_parts(buf, count);
rhandle.write(buffer);
+
+ true.to_glib()
}
#[no_mangle]
@@ -1046,6 +1062,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_close(
handle: *const RsvgHandle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_close => false.to_glib();
+
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
match rhandle.close() {
@@ -1078,6 +1100,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_render_cairo_sub(
cr: *mut cairo_sys::cairo_t,
id: *const libc::c_char,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_render_cairo_sub => false.to_glib();
+
+ !cr.is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let cr = from_glib_none(cr);
let id: Option<String> = from_glib_none(id);
@@ -1114,6 +1142,11 @@ pub unsafe extern "C" fn rsvg_rust_handle_get_dimensions(
handle: *const RsvgHandle,
dimension_data: *mut RsvgDimensionData,
) {
+ rsvg_return_if_fail! {
+ rsvg_handle_get_dimensions;
+ !dimension_data.is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
*dimension_data = rhandle
.get_dimensions()
@@ -1126,6 +1159,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_get_dimensions_sub(
dimension_data: *mut RsvgDimensionData,
id: *const libc::c_char,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_get_dimensions_sub => false.to_glib();
+
+ !dimension_data.is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let id: Option<String> = from_glib_none(id);
@@ -1150,6 +1189,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_get_position_sub(
position_data: *mut RsvgPositionData,
id: *const libc::c_char,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_get_position_sub => false.to_glib();
+
+ !position_data.is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let id: Option<String> = from_glib_none(id);
@@ -1187,6 +1232,13 @@ pub unsafe extern "C" fn rsvg_rust_handle_new_from_file(
filename: *const libc::c_char,
error: *mut *mut glib_sys::GError,
) -> *const RsvgHandle {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_new_from_file => ptr::null();
+
+ !filename.is_null(),
+ error.is_null() || (*error).is_null(),
+ }
+
let file = match PathOrUrl::new(filename) {
Ok(PathOrUrl::Path(path)) => gio::File::new_for_path(path),
@@ -1208,6 +1260,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_new_from_gfile_sync(
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
) -> *const RsvgHandle {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_new_from_gfile_sync => ptr::null();
+
+ error.is_null() || (*error).is_null(),
+ }
+
let raw_handle = rsvg_rust_handle_new_with_flags(flags);
let rhandle = get_rust_handle(raw_handle);
@@ -1241,6 +1299,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_new_from_stream_sync(
cancellable: *mut gio_sys::GCancellable,
error: *mut *mut glib_sys::GError,
) -> *const RsvgHandle {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_new_from_stream_sync => ptr::null();
+
+ error.is_null() || (*error).is_null(),
+ }
+
let raw_handle = rsvg_rust_handle_new_with_flags(flags);
let rhandle = get_rust_handle(raw_handle);
@@ -1267,9 +1331,17 @@ pub unsafe extern "C" fn rsvg_rust_handle_new_from_stream_sync(
#[no_mangle]
pub unsafe extern "C" fn rsvg_rust_handle_new_from_data(
data: *mut u8,
- len: usize,
+ data_len: usize,
error: *mut *mut glib_sys::GError,
) -> *const RsvgHandle {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_new_from_data => ptr::null();
+
+ (!data.is_null() && data_len != 0) || (data_len == 0),
+ data_len <= std::isize::MAX as usize,
+ error.is_null() || (*error).is_null(),
+ }
+
// We create the MemoryInputStream without the gtk-rs binding because of this:
//
// - The binding doesn't provide _new_from_data(). All of the binding's ways to
@@ -1280,10 +1352,10 @@ pub unsafe extern "C" fn rsvg_rust_handle_new_from_data(
// - For now, we are using the other C-visible constructor, so we need a raw pointer to the
// stream, anyway.
- assert!(len <= std::isize::MAX as usize);
- let len = len as isize;
+ assert!(data_len <= std::isize::MAX as usize);
+ let data_len = data_len as isize;
- let raw_stream = gio_sys::g_memory_input_stream_new_from_data(data, len, None);
+ let raw_stream = gio_sys::g_memory_input_stream_new_from_data(data, data_len, None);
let ret = rsvg_rust_handle_new_from_stream_sync(
raw_stream as *mut _,
@@ -1324,6 +1396,13 @@ pub unsafe extern "C" fn rsvg_rust_handle_set_stylesheet(
css_len: usize,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_set_stylesheet => false.to_glib();
+
+ !css.is_null() || (css.is_null() && css_len == 0),
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let css = match (css, css_len) {
@@ -1381,6 +1460,14 @@ pub unsafe extern "C" fn rsvg_rust_handle_render_document(
viewport: *const RsvgRectangle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_render_document => false.to_glib();
+
+ !cr.is_null(),
+ !viewport.is_null(),
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let cr = from_glib_none(cr);
@@ -1403,6 +1490,13 @@ pub unsafe extern "C" fn rsvg_rust_handle_get_geometry_for_layer(
out_logical_rect: *mut RsvgRectangle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_get_geometry_for_layer => false.to_glib();
+
+ !viewport.is_null(),
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let id: Option<String> = from_glib_none(id);
@@ -1435,6 +1529,14 @@ pub unsafe extern "C" fn rsvg_rust_handle_render_layer(
viewport: *const RsvgRectangle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_render_layer => false.to_glib();
+
+ !cr.is_null(),
+ !viewport.is_null(),
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let cr = from_glib_none(cr);
let id: Option<String> = from_glib_none(id);
@@ -1457,6 +1559,12 @@ pub unsafe extern "C" fn rsvg_rust_handle_get_geometry_for_element(
out_logical_rect: *mut RsvgRectangle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_get_geometry_for_element => false.to_glib();
+
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let id: Option<String> = from_glib_none(id);
@@ -1489,6 +1597,14 @@ pub unsafe extern "C" fn rsvg_rust_handle_render_element(
element_viewport: *const RsvgRectangle,
error: *mut *mut glib_sys::GError,
) -> glib_sys::gboolean {
+ rsvg_return_val_if_fail! {
+ rsvg_handle_render_element => false.to_glib();
+
+ !cr.is_null(),
+ !element_viewport.is_null(),
+ error.is_null() || (*error).is_null(),
+ }
+
let rhandle = get_rust_handle(handle);
let cr = from_glib_none(cr);
let id: Option<String> = from_glib_none(id);
diff --git a/librsvg/pixbuf_utils.rs b/librsvg/pixbuf_utils.rs
index 921ec365..477a76c8 100644
--- a/librsvg/pixbuf_utils.rs
+++ b/librsvg/pixbuf_utils.rs
@@ -249,6 +249,14 @@ pub unsafe extern "C" fn rsvg_rust_pixbuf_from_file_at_size(
height: i32,
error: *mut *mut glib_sys::GError,
) -> *mut gdk_pixbuf_sys::GdkPixbuf {
+ rsvg_return_val_if_fail! {
+ rsvg_pixbuf_from_file_at_size => ptr::null_mut();
+
+ !filename.is_null(),
+ (width >= 1 && height >= 1) || (width == -1 && height == -1),
+ error.is_null() || (*error).is_null(),
+ }
+
pixbuf_from_file_with_size_mode(
filename,
&SizeMode {
@@ -269,6 +277,14 @@ pub unsafe extern "C" fn rsvg_rust_pixbuf_from_file_at_zoom(
y_zoom: f64,
error: *mut *mut glib_sys::GError,
) -> *mut gdk_pixbuf_sys::GdkPixbuf {
+ rsvg_return_val_if_fail! {
+ rsvg_pixbuf_from_file_at_zoom => ptr::null_mut();
+
+ !filename.is_null(),
+ x_zoom > 0.0 && y_zoom > 0.0,
+ error.is_null() || (*error).is_null(),
+ }
+
pixbuf_from_file_with_size_mode(
filename,
&SizeMode {
@@ -287,18 +303,27 @@ pub unsafe extern "C" fn rsvg_rust_pixbuf_from_file_at_zoom_with_max(
filename: *const libc::c_char,
x_zoom: f64,
y_zoom: f64,
- width: i32,
- height: i32,
+ max_width: i32,
+ max_height: i32,
error: *mut *mut glib_sys::GError,
) -> *mut gdk_pixbuf_sys::GdkPixbuf {
+ rsvg_return_val_if_fail! {
+ rsvg_pixbuf_from_file_at_zoom_with_max => ptr::null_mut();
+
+ !filename.is_null(),
+ x_zoom > 0.0 && y_zoom > 0.0,
+ max_width >= 1 && max_height >= 1,
+ error.is_null() || (*error).is_null(),
+ }
+
pixbuf_from_file_with_size_mode(
filename,
&SizeMode {
kind: SizeKind::ZoomMax,
x_zoom,
y_zoom,
- width,
- height,
+ width: max_width,
+ height: max_height,
},
error,
)
@@ -307,18 +332,26 @@ pub unsafe extern "C" fn rsvg_rust_pixbuf_from_file_at_zoom_with_max(
#[no_mangle]
pub unsafe extern "C" fn rsvg_rust_pixbuf_from_file_at_max_size(
filename: *const libc::c_char,
- width: i32,
- height: i32,
+ max_width: i32,
+ max_height: i32,
error: *mut *mut glib_sys::GError,
) -> *mut gdk_pixbuf_sys::GdkPixbuf {
+ rsvg_return_val_if_fail! {
+ rsvg_pixbuf_from_file_at_max_size => ptr::null_mut();
+
+ !filename.is_null(),
+ max_width >= 1 && max_height >= 1,
+ error.is_null() || (*error).is_null(),
+ }
+
pixbuf_from_file_with_size_mode(
filename,
&SizeMode {
kind: SizeKind::WidthHeightMax,
x_zoom: 0.0,
y_zoom: 0.0,
- width,
- height,
+ width: max_width,
+ height: max_height,
},
error,
)
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 987e3bbe..f0fe345a 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -335,7 +335,7 @@ extern gboolean rsvg_rust_handle_read_stream_sync (RsvgHandle *handle,
GInputStream *stream,
GCancellable *cancellable,
GError **error);
-extern void rsvg_rust_handle_write (RsvgHandle *handle, const guchar *buf, gsize count);
+extern gboolean rsvg_rust_handle_write (RsvgHandle *handle, const guchar *buf, gsize count, GError **error);
extern gboolean rsvg_rust_handle_close (RsvgHandle *handle, GError **error);
extern gboolean rsvg_rust_handle_has_sub (RsvgHandle *handle, const char *id);
extern gboolean rsvg_rust_handle_render_cairo_sub (RsvgHandle *handle,
@@ -484,10 +484,6 @@ rsvg_handle_new (void)
RsvgHandle *
rsvg_handle_new_from_data (const guint8 *data, gsize data_len, GError **error)
{
- g_return_val_if_fail ((data != NULL && data_len != 0) || (data_len == 0), NULL);
- g_return_val_if_fail (data_len <= G_MAXSSIZE, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_handle_new_from_data (data, data_len, error);
}
@@ -507,9 +503,6 @@ rsvg_handle_new_from_data (const guint8 *data, gsize data_len, GError **error)
RsvgHandle *
rsvg_handle_new_from_file (const gchar *filename, GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_handle_new_from_file (filename, error);
}
@@ -561,7 +554,6 @@ rsvg_handle_new_from_gfile_sync (GFile *file,
{
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return rsvg_rust_handle_new_from_gfile_sync (file, flags, cancellable, error);
}
@@ -599,7 +591,6 @@ rsvg_handle_new_from_stream_sync (GInputStream *input_stream,
g_return_val_if_fail (G_IS_INPUT_STREAM (input_stream), NULL);
g_return_val_if_fail (base_file == NULL || G_IS_FILE (base_file), NULL);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return rsvg_rust_handle_new_from_stream_sync (input_stream,
base_file,
@@ -636,11 +627,8 @@ gboolean
rsvg_handle_write (RsvgHandle *handle, const guchar *buf, gsize count, GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- g_return_val_if_fail ((buf != NULL && count != 0) || (count == 0), FALSE);
- rsvg_rust_handle_write (handle, buf, count);
- return TRUE;
+ return rsvg_rust_handle_write (handle, buf, count, error);
}
/**
@@ -663,7 +651,6 @@ gboolean
rsvg_handle_close (RsvgHandle *handle, GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_close(handle, error);
}
@@ -702,7 +689,6 @@ rsvg_handle_read_stream_sync (RsvgHandle *handle,
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
g_return_val_if_fail (G_IS_INPUT_STREAM (stream), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_read_stream_sync (handle,
stream,
@@ -797,8 +783,6 @@ rsvg_handle_set_stylesheet (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail ((css != NULL && css_len >= 0) || (css == NULL && css_len == 0), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_set_stylesheet (handle, css, css_len, error);
}
@@ -892,7 +876,6 @@ gboolean
rsvg_handle_render_cairo_sub (RsvgHandle *handle, cairo_t *cr, const char *id)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (cr != NULL, FALSE);
return rsvg_rust_handle_render_cairo_sub (handle, cr, id);
}
@@ -941,7 +924,6 @@ void
rsvg_handle_get_dimensions (RsvgHandle *handle, RsvgDimensionData *dimension_data)
{
g_return_if_fail (RSVG_IS_HANDLE (handle));
- g_return_if_fail (dimension_data != NULL);
rsvg_rust_handle_get_dimensions (handle, dimension_data);
}
@@ -974,7 +956,6 @@ rsvg_handle_get_dimensions_sub (RsvgHandle *handle,
const char *id)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (dimension_data, FALSE);
return rsvg_rust_handle_get_dimensions_sub (handle, dimension_data, id);
}
@@ -1007,7 +988,6 @@ rsvg_handle_get_position_sub (RsvgHandle *handle,
const char *id)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (position_data != NULL, FALSE);
return rsvg_rust_handle_get_position_sub (handle, position_data, id);
}
@@ -1304,9 +1284,6 @@ rsvg_handle_render_document (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (cr != NULL, FALSE);
- g_return_val_if_fail (viewport != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_render_document (handle, cr, viewport, error);
}
@@ -1362,8 +1339,6 @@ rsvg_handle_get_geometry_for_layer (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (viewport != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_get_geometry_for_layer (handle,
id,
@@ -1415,9 +1390,6 @@ rsvg_handle_render_layer (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (cr != NULL, FALSE);
- g_return_val_if_fail (viewport != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_render_layer (handle, cr, id, viewport, error);
}
@@ -1477,7 +1449,6 @@ rsvg_handle_get_geometry_for_element (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_get_geometry_for_element (handle,
id,
@@ -1529,9 +1500,6 @@ rsvg_handle_render_element (RsvgHandle *handle,
GError **error)
{
g_return_val_if_fail (RSVG_IS_HANDLE (handle), FALSE);
- g_return_val_if_fail (cr != NULL, FALSE);
- g_return_val_if_fail (element_viewport != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return rsvg_rust_handle_render_element (handle, cr, id, element_viewport, error);
}
diff --git a/librsvg/rsvg-pixbuf.c b/librsvg/rsvg-pixbuf.c
index 5637a6df..6299e759 100644
--- a/librsvg/rsvg-pixbuf.c
+++ b/librsvg/rsvg-pixbuf.c
@@ -52,12 +52,12 @@ extern GdkPixbuf *rsvg_rust_pixbuf_from_file_at_zoom (const char *filename,
extern GdkPixbuf *rsvg_rust_pixbuf_from_file_at_zoom_with_max (const char *filename,
double x_zoom,
double y_zoom,
- int width,
- int height,
+ int max_width,
+ int max_height,
GError **error);
extern GdkPixbuf *rsvg_rust_pixbuf_from_file_at_max_size (const char *filename,
- int width,
- int height,
+ int max_width,
+ int max_height,
GError **error);
/**
@@ -75,9 +75,6 @@ extern GdkPixbuf *rsvg_rust_pixbuf_from_file_at_max_size (const char *filename,
GdkPixbuf *
rsvg_pixbuf_from_file (const gchar *filename, GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_pixbuf_from_file_at_size (filename, -1, -1, error);
}
@@ -102,10 +99,6 @@ rsvg_pixbuf_from_file_at_zoom (const gchar *filename,
double y_zoom,
GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (x_zoom > 0.0 && y_zoom > 0.0, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_pixbuf_from_file_at_zoom (filename, x_zoom, y_zoom, error);
}
@@ -135,11 +128,6 @@ rsvg_pixbuf_from_file_at_zoom_with_max (const gchar *filename,
gint max_height,
GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (x_zoom > 0.0 && y_zoom > 0.0, NULL);
- g_return_val_if_fail (max_width >= 1 && max_height >= 1, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_pixbuf_from_file_at_zoom_with_max (filename, x_zoom, y_zoom, max_width, max_height,
error);
}
@@ -165,10 +153,6 @@ rsvg_pixbuf_from_file_at_size (const gchar *filename,
gint height,
GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail ((width >= 1 && height >= 1) || (width == -1 && height == -1), NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_pixbuf_from_file_at_size (filename, width, height, error);
}
@@ -193,9 +177,5 @@ rsvg_pixbuf_from_file_at_max_size (const gchar *filename,
gint max_height,
GError **error)
{
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (max_width >= 1 && max_height >= 1, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
return rsvg_rust_pixbuf_from_file_at_max_size(filename, max_width, max_height, error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]