[librsvg: 2/18] Change the error code for short files
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/18] Change the error code for short files
- Date: Sat, 7 Dec 2019 02:38:11 +0000 (UTC)
commit ed1f453f64228650dd11b15e2a71b5fbcf4baf62
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Dec 5 21:58:45 2019 -0600
Change the error code for short files
Instead of adding yet another variant to LoadingError, we'll just use
the XmlParseError variant. After all, the compressed stream ought to
yield XML, but it is too short.
This removes the last GError generated by rsvg_internals itself.
rsvg_internals/src/io.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/io.rs b/rsvg_internals/src/io.rs
index a146f0a2..ccd5214d 100644
--- a/rsvg_internals/src/io.rs
+++ b/rsvg_internals/src/io.rs
@@ -16,7 +16,7 @@ use gio::{
use glib::{self, Bytes as GBytes, Cast};
use crate::allowed_url::AllowedUrl;
-use crate::error::{LoadingError, RsvgError};
+use crate::error::LoadingError;
pub struct BinaryData {
pub data: Vec<u8>,
@@ -61,7 +61,7 @@ pub fn get_input_stream_for_loading(
let num_read = buffered.fill(2, cancellable)?;
if num_read < 2 {
// FIXME: this string was localized in the original; localize it
- return Err(glib::Error::new(RsvgError, "Input file is too short").into());
+ return Err(LoadingError::XmlParseError(String::from("Input file is too short")));
}
let buf = buffered.peek_buffer();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]