[gxml/gsoc2013: 66/69] CharacterData.vala, Element.vala, Document.vala, DomNode.vala, NodeList.vala: use new GXml.warning f
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/gsoc2013: 66/69] CharacterData.vala, Element.vala, Document.vala, DomNode.vala, NodeList.vala: use new GXml.warning f
- Date: Sat, 27 Jul 2013 04:11:45 +0000 (UTC)
commit 454507ecbebc2d9194c127cc5a31aa93d79e3cca
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:55 2013 -0400
CharacterData.vala, Element.vala, Document.vala, DomNode.vala, NodeList.vala: use new GXml.warning
facility, so we can preserve the last error code
gxml/CharacterData.vala | 8 ++++----
gxml/Document.vala | 14 +++++++-------
gxml/DomNode.vala | 2 +-
gxml/Element.vala | 2 +-
gxml/NodeList.vala | 4 ++--
5 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gxml/CharacterData.vala b/gxml/CharacterData.vala
index 1bca77d..bc71242 100644
--- a/gxml/CharacterData.vala
+++ b/gxml/CharacterData.vala
@@ -72,21 +72,21 @@ namespace GXml {
protected bool check_index_size (string method, int length, ulong offset, ulong? count) {
if (offset < 0) {
- GLib.warning ("INDEX_SIZE_ERR: %s called with offset '%lu' for data of length
'%lu'", method, offset, length);
+ GXml.warning (DomException.INDEX_SIZE, "%s called with offset '%lu' for data
of length '%lu'".printf (method, offset, length));
return false;
}
if (count < 0) {
- GLib.warning ("INDEX_SIZE_ERR: %s called with count '%lu'", method, count);
+ GXml.warning (DomException.INDEX_SIZE, "%s called with count '%lu'".printf
(method, count));
return false;
}
if (count != null) {
if (length < offset + count) { // < or <= ?
- GLib.warning ("INDEX_SIZE_ERR: %s called with offset '%lu' and count
'%lu' for data of length '%lu'", method, offset, count, length);
+ GXml.warning (DomException.INDEX_SIZE, "%s called with offset '%lu'
and count '%lu' for data of length '%lu'".printf (method, offset, count, length));
return false;
}
} else {
if (length <= offset) { // <= or < ?
- GLib.warning ("INDEX_SIZE_ERR: %s called with offset '%lu' for data
of length '%lu'", method, offset, length);
+ GXml.warning (DomException.INDEX_SIZE, "%s called with offset '%lu'
for data of length '%lu'".printf (method, offset, length));
return false;
}
}
diff --git a/gxml/Document.vala b/gxml/Document.vala
index bbe3c08..8049ee2 100644
--- a/gxml/Document.vala
+++ b/gxml/Document.vala
@@ -281,12 +281,12 @@ namespace GXml {
Xml.Node *root;
if (doc == null) // should be impossible
- GLib.warning ("INVALID_DOC_ERR: Failed to parse document, xmlDoc* was NULL");
+ GXml.warning (DomException.INVALID_DOC, "Failed to parse document, xmlDoc*
was NULL");
if (require_root) {
root = doc->get_root_element ();
if (root == null) {
- GLib.warning ("INVALID_ROOT_ERR: Could not obtain a valid root for
the document; xmlDoc*'s root was NULL");
+ GXml.warning (DomException.INVALID_ROOT, "Could not obtain a valid
root for the document; xmlDoc*'s root was NULL");
}
}
@@ -397,7 +397,7 @@ namespace GXml {
this.from_stream (instream, can);
instream.close ();
} catch (GLib.Error e) {
- GLib.warning ("INVALID_DOC_ERR: Could not load document from GFile: %s",
e.message);
+ GXml.warning (DomException.INVALID_DOC, "Could not load document from GFile:
%s".printf (e.message));
}
}
/**
@@ -645,7 +645,7 @@ namespace GXml {
*/
private void check_not_supported_html (string feature) {
if (this.doctype != null && (this.doctype.name.casefold () == "html".casefold ())) {
- GLib.warning ("NOT_SUPPORTED_ERR: HTML documents do not support '%s'",
feature); // TODO: i18n
+ GXml.warning (DomException.NOT_SUPPORTED, "HTML documents do not support
'%s'".printf (feature)); // TODO: i18n
}
}
@@ -655,7 +655,7 @@ namespace GXml {
internal static bool check_invalid_characters (string name, string subject) {
/* TODO: use Xml.validate_name instead */
if (Xml.validate_name (name, 0) != 0) { // TODO: define validity
- GLib.warning ("INVALID_CHARACTER_ERR: Provided name '%s' for '%s' is not a
valid XML name", name, subject);
+ GXml.warning (DomException.INVALID_CHARACTER, "Provided name '%s' for '%s' is
not a valid XML name".printf (name, subject));
return false;
}
@@ -695,13 +695,13 @@ namespace GXml {
if (xmldoc->get_root_element () == null) {
xmldoc->set_root_element (((Element)new_child).node);
} else {
- GLib.warning ("HIERARCHY_REQUEST_ERR: Document already has a root
element. Could not add child element with name '%s'", new_child.node_name);
+ GXml.warning (DomException.HIERARCHY_REQUEST, "Document already has a
root element. Could not add child element with name '%s'".printf (new_child.node_name));
}
} else if (new_child.node_type == NodeType.DOCUMENT_TYPE) {
if (this.doctype == null) {
this.doctype = (DocumentType)new_child;
} else {
- GLib.warning ("HIERARCHY_REQUEST_ERR: Document already has a doctype.
Could not add new doctype with name '%s'.", ((DocumentType)new_child).name);
+ GXml.warning (DomException.HIERARCHY_REQUEST, "Document already has a
doctype. Could not add new doctype with name '%s'.".printf (((DocumentType)new_child).name));
}
GLib.warning ("Appending document_types not yet supported");
} else {
diff --git a/gxml/DomNode.vala b/gxml/DomNode.vala
index 3371fbc..d1301ed 100644
--- a/gxml/DomNode.vala
+++ b/gxml/DomNode.vala
@@ -50,7 +50,7 @@ namespace GXml {
protected void check_wrong_document (DomNode node) {
if (this.owner_document != node.owner_document) {
- GLib.warning ("WRONG_DOCUMENT_ERR: Node tried to interact with this document
'%p' but belonged to document '%p'", this.owner_document, node.owner_document);
+ GXml.warning (DomException.WRONG_DOCUMENT, "Node tried to interact with this
document '%p' but belonged to document '%p'".printf (this.owner_document, node.owner_document));
}
}
diff --git a/gxml/Element.vala b/gxml/Element.vala
index b301927..f71a872 100644
--- a/gxml/Element.vala
+++ b/gxml/Element.vala
@@ -331,7 +331,7 @@ namespace GXml {
this.check_read_only ();
if (this.attributes.remove (old_attr.name) == false) {
- GLib.warning ("NOT_FOUND_ERR: No child with name '%s' exists in node '%s'",
old_attr.name, this.node_name);
+ GXml.warning (DomException.NOT_FOUND, "No child with name '%s' exists in node
'%s'".printf (old_attr.name, this.node_name));
}
return old_attr;
diff --git a/gxml/NodeList.vala b/gxml/NodeList.vala
index ab5c2c0..75cd969 100644
--- a/gxml/NodeList.vala
+++ b/gxml/NodeList.vala
@@ -555,7 +555,7 @@ namespace GXml {
child = child->next;
}
if (child == null) {
- GLib.warning ("NOT_FOUND_ERR: ref_child '%s' not found, was supposed to have
'%s' inserted before it.", ref_child.node_name, new_child.node_name);
+ GXml.warning (DomException.NOT_FOUND, "ref_child '%s' not found, was supposed
to have '%s' inserted before it.".printf (ref_child.node_name, new_child.node_name));
return null;
} else {
if (new_child.node_type == NodeType.DOCUMENT_FRAGMENT) {
@@ -593,7 +593,7 @@ namespace GXml {
// it is a valid child
child->replace (((BackedNode)new_child).node);
} else {
- GLib.warning ("NOT_FOUND_ERR: old_child '%s' not found, tried to
replace with '%s'", old_child.node_name, new_child.node_name);
+ GXml.warning (DomException.NOT_FOUND, "old_child '%s' not found,
tried to replace with '%s'".printf (old_child.node_name, new_child.node_name));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]