Commit b76cc7a2 authored by RazrFalcon's avatar RazrFalcon

Warnings refactoring.

parent 1dd8efcb
......@@ -354,7 +354,7 @@ pub extern fn resvg_qt_render_to_canvas_by_id(
};
if id.is_empty() {
warn!("Node with an empty ID can not be painted.");
warn!("Node with an empty ID cannot be painted.");
return;
}
......@@ -394,7 +394,7 @@ pub extern fn resvg_cairo_render_to_canvas_by_id(
};
if id.is_empty() {
warn!("Node with an empty ID can not be painted.");
warn!("Node with an empty ID cannot be painted.");
return;
}
......@@ -543,7 +543,7 @@ fn get_node_bbox(
}
}
None => {
warn!("No node with '{}' ID in the tree.", id);
warn!("No node with '{}' ID is in the tree.", id);
false
}
}
......
......@@ -43,11 +43,11 @@ pub fn draw_raster(
usvg::ImageData::Path(ref path) => {
let path = image::get_abs_path(path, opt);
try_opt_warn!(gdk_pixbuf::Pixbuf::new_from_file(path.clone()).ok(), (),
"Failed to load an external image: {:?}.", path)
"Failed to load an external image: {:?}.", path)
}
usvg::ImageData::Raw(ref data) => {
try_opt_warn!(load_raster_data(data), (),
"Failed to load an embedded image.")
"Failed to load an embedded image.")
}
};
......
......@@ -176,7 +176,7 @@ pub fn render_node_to_image(
let node_bbox = if let Some(bbox) = calc_node_bbox(node, opt) {
bbox
} else {
warn!("Node {:?} has zero size.", node.id());
warn!("Node '{}' has a zero size.", node.id());
return None;
};
......
......@@ -31,7 +31,7 @@ pub fn apply(
if cp.units == usvg::Units::ObjectBoundingBox {
let ts = try_opt_warn!(qt::Transform::from_bbox(bbox), (),
"ClipPath '{}' cannot be used on a zero-sized object.", cp.id);
"ClipPath '{}' cannot be used on a zero-sized object.", cp.id);
clip_p.apply_transform(&ts);
}
......
......@@ -38,11 +38,11 @@ pub fn draw_raster(
usvg::ImageData::Path(ref path) => {
let path = image::get_abs_path(path, opt);
try_opt_warn!(qt::Image::from_file(&path), (),
"Failed to load an external image: {:?}.", path)
"Failed to load an external image: {:?}.", path)
}
usvg::ImageData::Raw(ref data) => {
try_opt_warn!(qt::Image::from_data(data), (),
"Failed to load an embedded image.")
"Failed to load an embedded image.")
}
};
......
......@@ -140,9 +140,8 @@ pub trait Filter<T: ImageExt> {
Ok(_) => {}
Err(Error::AllocFailed) =>
warn!("Memory allocation failed while processing the '{}' filter. Skipped.", filter.id),
Err(Error::InvalidRegion) => {
warn!("Filter '{}' has an invalid region.", filter.id);
}
Err(Error::InvalidRegion) =>
warn!("Filter '{}' has an invalid region.", filter.id),
Err(Error::ZeroSizedObject) =>
warn!("Filter '{}' cannot be used on a zero-sized object.", filter.id),
}
......
......@@ -12,6 +12,9 @@ documentation = "https://docs.rs/usvg/"
readme = "README.md"
workspace = ".."
[badges]
travis-ci = { repository = "RazrFalcon/resvg" }
[dependencies]
base64 = "0.10"
libflate = "0.1"
......
......@@ -101,7 +101,7 @@ fn prepare_text_elem(doc: &mut Document, elem: &Node, new_elem: &mut Node) {
if let Some(id) = text_parent.tag_id() {
if id != EId::Text && id != EId::Tspan {
warn!("Unsupported text child: {:?}.", id);
warn!("Unsupported text child: {}.", id);
continue;
}
} else {
......
......@@ -52,7 +52,7 @@ fn resolve_impl(node: &mut Node, attr: AId) {
Some(a) => node.set_attribute((attr, a.value)),
None => {
warn!("Failed to resolve attribute: {}. Removing it.",
node.attributes().get(attr).unwrap());
node.attributes().get(attr).unwrap());
node.remove_attribute(attr);
}
}
......
......@@ -108,7 +108,7 @@ fn resolve_default(node: &mut Node, aid: AId) {
Some(v) => v,
None => {
// Technically unreachable.
warn!("'{:?}' doesn't have a default value.", aid);
warn!("'{}' doesn't have a default value.", aid);
return;
}
};
......
......@@ -81,7 +81,7 @@ fn process_negative_r(
ids: &mut Vec<AId>,
) -> bool {
let r = try_opt_warn!(gradient.attributes().get_number(AId::R), false,
"'r' attribute in 'radialGradient' should be already resolved.");
"'r' attribute in 'radialGradient' should be already resolved.");
if !r.is_fuzzy_zero() {
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment