[librsvg] XmlState::load_from_possibly_compressed_stream(): turn into a method
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] XmlState::load_from_possibly_compressed_stream(): turn into a method
- Date: Tue, 9 Apr 2019 16:45:20 +0000 (UTC)
commit a9fd9a4f9f770e26067f7b83ab469dd416925453
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Apr 5 17:10:46 2019 -0600
XmlState::load_from_possibly_compressed_stream(): turn into a method
rsvg_internals/src/svg.rs | 3 +--
rsvg_internals/src/xml.rs | 15 +++++++++++++--
rsvg_internals/src/xml2_load.rs | 12 ------------
3 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/rsvg_internals/src/svg.rs b/rsvg_internals/src/svg.rs
index 79e2840c..38141f52 100644
--- a/rsvg_internals/src/svg.rs
+++ b/rsvg_internals/src/svg.rs
@@ -14,7 +14,6 @@ use crate::properties::ComputedValues;
use crate::structure::{IntrinsicDimensions, NodeSvg};
use crate::surface_utils::shared_surface::SharedImageSurface;
use crate::xml::XmlState;
-use crate::xml2_load::xml_state_load_from_possibly_compressed_stream;
/// A loaded SVG file and its derived data
///
@@ -56,7 +55,7 @@ impl Svg {
) -> Result<Svg, LoadingError> {
let mut xml = XmlState::new(load_options);
- xml_state_load_from_possibly_compressed_stream(&mut xml, stream, cancellable)?;
+ xml.load_from_possibly_compressed_stream(stream, cancellable)?;
xml.steal_result()
}
diff --git a/rsvg_internals/src/xml.rs b/rsvg_internals/src/xml.rs
index 62a1fc73..69249133 100644
--- a/rsvg_internals/src/xml.rs
+++ b/rsvg_internals/src/xml.rs
@@ -12,7 +12,7 @@ use crate::create_node::create_node_and_register_id;
use crate::css::CssStyles;
use crate::error::LoadingError;
use crate::handle::LoadOptions;
-use crate::io;
+use crate::io::{self, get_input_stream_for_loading};
use crate::node::{node_new, Node, NodeType, RsvgNode};
use crate::property_bag::PropertyBag;
use crate::structure::NodeSvg;
@@ -487,7 +487,7 @@ impl XmlState {
//
// This can be called "in the middle" of an XmlState's processing status,
// for example, when including another XML file via xi:include.
- pub fn parse_from_stream(
+ fn parse_from_stream(
&mut self,
stream: gio::InputStream,
cancellable: Option<&gio::Cancellable>,
@@ -496,6 +496,17 @@ impl XmlState {
.and_then(|parser| parser.parse())
}
+ pub fn load_from_possibly_compressed_stream(
+ &mut self,
+ stream: &gio::InputStream,
+ cancellable: Option<&gio::Cancellable>,
+ ) -> Result<(), ParseFromStreamError> {
+ let stream = get_input_stream_for_loading(stream, cancellable)
+ .map_err(|e| ParseFromStreamError::IoError(e))?;
+
+ self.parse_from_stream(stream, cancellable)
+ }
+
fn unsupported_xinclude_start_element(&self, _name: &str) -> Context {
Context::UnsupportedXIncludeChild
}
diff --git a/rsvg_internals/src/xml2_load.rs b/rsvg_internals/src/xml2_load.rs
index 309929a5..eb6eb079 100644
--- a/rsvg_internals/src/xml2_load.rs
+++ b/rsvg_internals/src/xml2_load.rs
@@ -16,7 +16,6 @@ use glib::translate::*;
use crate::error::LoadingError;
use crate::handle::LoadFlags;
-use crate::io::get_input_stream_for_loading;
use crate::property_bag::PropertyBag;
use crate::util::cstr;
use crate::util::utf8_cstr;
@@ -441,14 +440,3 @@ impl From<ParseFromStreamError> for LoadingError {
}
}
}
-
-pub fn xml_state_load_from_possibly_compressed_stream(
- xml: &mut XmlState,
- stream: &gio::InputStream,
- cancellable: Option<&gio::Cancellable>,
-) -> Result<(), ParseFromStreamError> {
- let stream = get_input_stream_for_loading(stream, cancellable)
- .map_err(|e| ParseFromStreamError::IoError(e))?;
-
- xml.parse_from_stream(stream, cancellable)
-}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]