[librsvg: 7/14] rsvg_text_create_layout(): Don't copy the incoming string
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 7/14] rsvg_text_create_layout(): Don't copy the incoming string
- Date: Wed, 24 Jan 2018 19:07:46 +0000 (UTC)
commit a8872d438840308b89d777f4efbc16e00a9de863
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jan 24 11:32:16 2018 -0600
rsvg_text_create_layout(): Don't copy the incoming string
rust/src/text.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/text.rs b/rust/src/text.rs
index 04ee437..eadcc4c 100644
--- a/rust/src/text.rs
+++ b/rust/src/text.rs
@@ -5,6 +5,7 @@ use pango_sys;
use drawing_ctx::{self, RsvgDrawingCtx};
use state::{self, UnicodeBidi};
+use util::utf8_cstr;
// FIXME: should the pango crate provide this like PANGO_GRAVITY_IS_VERTICAL() / PANGO_GRAVITY_IS_IMPROPER()?
fn gravity_is_vertical(gravity: pango::Gravity) -> bool {
@@ -95,8 +96,8 @@ fn create_pango_layout(draw_ctx: *const RsvgDrawingCtx, text: &str) -> pango::La
pub extern fn rsvg_text_create_layout(draw_ctx: *const RsvgDrawingCtx,
text: *const libc::c_char) -> *const pango_sys::PangoLayout {
assert!(!text.is_null());
- let s = unsafe { String::from_glib_none(text) };
- let layout = create_pango_layout(draw_ctx, &s);
+ let s = unsafe { utf8_cstr(text) };
+ let layout = create_pango_layout(draw_ctx, s);
layout.to_glib_full()
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]