[librsvg: 11/32] Remove LoadingError::CouldNotCreateXmlParser
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 11/32] Remove LoadingError::CouldNotCreateXmlParser
- Date: Fri, 4 Dec 2020 21:11:31 +0000 (UTC)
commit ba01c691ec4da9673e7720420a497cd4b1c3fb01
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 25 13:02:00 2020 -0600
Remove LoadingError::CouldNotCreateXmlParser
This is out-of-memory in libxml2; use LoadingError::OutOfMemory instead.
src/error.rs | 4 ----
src/xml/mod.rs | 3 ---
src/xml/xml2_load.rs | 4 +++-
3 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/error.rs b/src/error.rs
index 4a2915a0..0b6d899c 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -318,9 +318,6 @@ pub enum LoadingError {
/// Not enough memory to load the document.
OutOfMemory(String),
- // FIXME: this is OOM in libxml2; we shouldn't expose it.
- CouldNotCreateXmlParser,
-
/// A malformed or disallowed URL was used.
BadUrl,
@@ -359,7 +356,6 @@ impl fmt::Display for LoadingError {
match *self {
LoadingError::XmlParseError(ref s) => write!(f, "XML parse error: {}", s),
LoadingError::OutOfMemory(ref s) => write!(f, "out of memory: {}", s),
- LoadingError::CouldNotCreateXmlParser => write!(f, "could not create XML parser"),
LoadingError::BadUrl => write!(f, "invalid URL"),
LoadingError::BadDataUrl => write!(f, "invalid data: URL"),
LoadingError::BadStylesheet => write!(f, "invalid stylesheet"),
diff --git a/src/xml/mod.rs b/src/xml/mod.rs
index ac581e23..23275b98 100644
--- a/src/xml/mod.rs
+++ b/src/xml/mod.rs
@@ -558,9 +558,6 @@ impl XmlState {
// FIXME: pass a cancellable
self.parse_from_stream(&stream, None).map_err(|e| match e {
- LoadingError::CouldNotCreateXmlParser => {
- AcquireError::FatalError(String::from("could not create XML parser"))
- }
LoadingError::Glib(_) => AcquireError::ResourceError,
LoadingError::XmlParseError(s) => AcquireError::FatalError(s),
_ => AcquireError::FatalError(String::from("unknown error")),
diff --git a/src/xml/xml2_load.rs b/src/xml/xml2_load.rs
index e5bdea1a..3954fcf9 100644
--- a/src/xml/xml2_load.rs
+++ b/src/xml/xml2_load.rs
@@ -433,7 +433,9 @@ impl Xml2Parser {
if parser.is_null() {
// on error, xmlCreateIOParserCtxt() frees our ctx via the
// stream_ctx_close function
- Err(LoadingError::CouldNotCreateXmlParser)
+ Err(LoadingError::OutOfMemory(String::from(
+ "could not create XML parser",
+ )))
} else {
xml2_parser.parser.set(parser);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]