[librsvg: 20/32] Remove LoadingError::BadStylesheet




commit 94944ca222bba32486c90b175a8203504e5fbbb0
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Nov 26 16:31:41 2020 -0600

    Remove LoadingError::BadStylesheet
    
    This was used in a single place, where the code validates the XML
    processing instruction - not even for validating the CSS.

 src/document.rs | 4 +++-
 src/error.rs    | 4 ----
 2 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/document.rs b/src/document.rs
index f57dd6af..2abe1e5c 100644
--- a/src/document.rs
+++ b/src/document.rs
@@ -413,7 +413,9 @@ impl DocumentBuilder {
         if type_.as_deref() != Some("text/css")
             || (alternate.is_some() && alternate.as_deref() != Some("no"))
         {
-            return Err(LoadingError::BadStylesheet);
+            return Err(LoadingError::Other(String::from(
+                "invalid parameters in XML processing instruction for stylesheet",
+            )));
         }
 
         // FIXME: handle CSS errors
diff --git a/src/error.rs b/src/error.rs
index bd38955c..d541086b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -343,9 +343,6 @@ pub enum LoadingError {
     /// A `data:` URL could not be decoded.
     BadDataUrl,
 
-    // FIXME: used only if XML processing instruction cannot find the stylesheet.
-    BadStylesheet,
-
     /// An invalid stylesheet was used.
     BadCss,
 
@@ -371,7 +368,6 @@ impl fmt::Display for LoadingError {
             LoadingError::OutOfMemory(ref s) => write!(f, "out of memory: {}", s),
             LoadingError::BadUrl => write!(f, "invalid URL"),
             LoadingError::BadDataUrl => write!(f, "invalid data: URL"),
-            LoadingError::BadStylesheet => write!(f, "invalid stylesheet"),
             LoadingError::BadCss => write!(f, "invalid CSS"),
             LoadingError::NoSvgRoot => write!(f, "XML does not have <svg> root"),
             LoadingError::Glib(ref e) => e.fmt(f),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]