[librsvg: 6/20] PropertyBag: handle empty attribute values
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 6/20] PropertyBag: handle empty attribute values
- Date: Sat, 26 Oct 2019 23:35:24 +0000 (UTC)
commit eacaad87adfa81f8bfd9a27b9059cc2dfa2f74b0
Author: Federico Mena Quintero <federico gnome org>
Date: Tue May 28 18:57:52 2019 -0500
PropertyBag: handle empty attribute values
rsvg_internals/src/property_bag.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/property_bag.rs b/rsvg_internals/src/property_bag.rs
index 0260b1da..4cb979dc 100644
--- a/rsvg_internals/src/property_bag.rs
+++ b/rsvg_internals/src/property_bag.rs
@@ -114,7 +114,7 @@ impl<'a> PropertyBag<'a> {
assert!(!localname.is_null());
if !value_start.is_null() && !value_end.is_null() {
- assert!(value_end > value_start);
+ assert!(value_end >= value_start);
// FIXME: ptr::offset_from() is nightly-only.
// We'll do the computation of the length by hand.
@@ -215,6 +215,7 @@ mod tests {
let attrs = [
(CString::new("rx").unwrap(), CString::new("1").unwrap()),
(CString::new("ry").unwrap(), CString::new("2").unwrap()),
+ (CString::new("empty").unwrap(), CString::new("").unwrap()),
];
let mut v: Vec<*const libc::c_char> = Vec::new();
@@ -234,6 +235,7 @@ mod tests {
let mut had_rx: bool = false;
let mut had_ry: bool = false;
+ let mut had_empty: bool = false;
for (a, v) in pbag.iter() {
match a {
@@ -245,6 +247,10 @@ mod tests {
assert!(v == "2");
had_ry = true;
}
+ ref n if *n == LocalName::from("empty") => {
+ assert!(v == "");
+ had_empty = true;
+ }
_ => unreachable!(),
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]