[librsvg/librsvg-2.48] (#596): Fix introspection data for rsvg_handle_set_stylesheet()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.48] (#596): Fix introspection data for rsvg_handle_set_stylesheet()
- Date: Tue, 5 May 2020 19:47:27 +0000 (UTC)
commit 0fe4c9a767980a6baf0cf67c4478bbd0cd97a258
Author: Federico Mena Quintero <federico gnome org>
Date: Tue May 5 14:12:58 2020 -0500
(#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
librsvg/c_api.rs | 4 ++--
librsvg/rsvg-handle.c | 10 +++++-----
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]