diff options
author | Federico Mena Quintero <federico@gnome.org> | 2020-05-05 14:12:58 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2020-05-05 14:42:13 -0500 |
commit | 0fe4c9a767980a6baf0cf67c4478bbd0cd97a258 (patch) | |
tree | c94c450d5a0b8775d6067ba6857b0c10e3394c84 /librsvg | |
parent | e96e8a24a47f49c1ef7c53b037991676a0641ce1 (diff) | |
download | librsvg-0fe4c9a767980a6baf0cf67c4478bbd0cd97a258.tar.gz |
(#596): Fix introspection data for rsvg_handle_set_stylesheet()
Although the function's prototype changes:
gboolean
rsvg_handle_set_stylesheet (RsvgHandle *handle,
- const char *css,
+ const guint8 *css,
gsize css_len,
GError **error)
This is not an ABI break. It is just to make clear that this is not a
normal C string, but a buffer of bytes.
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/596
Diffstat (limited to 'librsvg')
-rw-r--r-- | librsvg/c_api.rs | 4 | ||||
-rw-r--r-- | librsvg/rsvg-handle.c | 10 | ||||
-rw-r--r-- | librsvg/rsvg.h | 8 |
3 files changed, 11 insertions, 11 deletions
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs index 6f1bdbb8..53654241 100644 --- a/librsvg/c_api.rs +++ b/librsvg/c_api.rs @@ -1538,7 +1538,7 @@ unsafe fn set_out_param<T: Copy>( #[no_mangle] pub unsafe extern "C" fn rsvg_rust_handle_set_stylesheet( handle: *const RsvgHandle, - css: *const libc::c_char, + css: *const u8, css_len: usize, error: *mut *mut glib_sys::GError, ) -> glib_sys::gboolean { @@ -1555,7 +1555,7 @@ pub unsafe extern "C" fn rsvg_rust_handle_set_stylesheet( let css = match (css, css_len) { (p, 0) if p.is_null() => "", (_, _) => { - let s = slice::from_raw_parts(css as *const u8, css_len); + let s = slice::from_raw_parts(css, css_len); match str::from_utf8(s) { Ok(s) => s, Err(e) => { diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c index 13787bd9..f3539f0a 100644 --- a/librsvg/rsvg-handle.c +++ b/librsvg/rsvg-handle.c @@ -734,7 +734,7 @@ rsvg_handle_get_base_uri (RsvgHandle *handle) * rsvg_handle_set_stylesheet: * @handle: A #RsvgHandle. * @css: (array length=css_len): String with CSS data; must be valid UTF-8. - * @css_len: Length of the @css string in bytes. + * @css_len: Length of the @css data in bytes. * @error: (optional): return location for errors. * * Sets a CSS stylesheet to use for an SVG document. @@ -752,10 +752,10 @@ rsvg_handle_get_base_uri (RsvgHandle *handle) * Since: 2.48 */ gboolean -rsvg_handle_set_stylesheet (RsvgHandle *handle, - const char *css, - gsize css_len, - GError **error) +rsvg_handle_set_stylesheet (RsvgHandle *handle, + const guint8 *css, + gsize css_len, + GError **error) { return rsvg_rust_handle_set_stylesheet (handle, css, css_len, error); } diff --git a/librsvg/rsvg.h b/librsvg/rsvg.h index 63b9354d..c8c7d916 100644 --- a/librsvg/rsvg.h +++ b/librsvg/rsvg.h @@ -344,10 +344,10 @@ RSVG_API RsvgHandle *rsvg_handle_new_from_file (const gchar *filename, GError **error); RSVG_API -gboolean rsvg_handle_set_stylesheet (RsvgHandle *handle, - const char *css, - gsize css_len, - GError **error); +gboolean rsvg_handle_set_stylesheet (RsvgHandle *handle, + const guint8 *css, + gsize css_len, + GError **error); #ifndef __GTK_DOC_IGNORE__ RSVG_API |