chiark / gitweb /
svg size handling: SVG is case sensitive
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 2 May 2022 10:44:56 +0000 (11:44 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 2 May 2022 11:17:43 +0000 (12:17 +0100)
bundles.rs had this right.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/utils.rs

index f0770f585cdf35acd728611fbcdbae94ecb3fd9e..023d97641e931fbe649b83730a1f83c6817f49f3 100644 (file)
@@ -235,7 +235,7 @@ pub fn svg_parse_size(xml: &str) -> Option<PosC<f64>> {
   for token in &mut tokens {
     match token? {
       Tk::ElementStart{ local, .. } => {
-        if local.eq_ignore_ascii_case("svg") { break }
+        if local.as_str() == "svg" { break }
         else { throw!(SvSE::WrongFirstElement) }
       }
       _ => { },
@@ -249,9 +249,11 @@ pub fn svg_parse_size(xml: &str) -> Option<PosC<f64>> {
         break
       },
       Tk::Attribute { local, value, .. } => {
-        let i =
-          if local.eq_ignore_ascii_case("width" ) { 0 } else
-          if local.eq_ignore_ascii_case("height") { 1 } else { continue };
+        let i = match local.as_str() {
+          "width"  => 0,
+          "height" => 1,
+          _ => continue,
+        };
         if wh[i].is_some() {
           throw!(SvSE::AttributeRepeated(local.to_string()))
         }