[gxml/gsoc2013: 118/150] Text.vala: address some compile time warnings; fail split more gracefully



commit 6021b70a790797aa39202e08f0f9844d20939d48
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sun Jul 28 01:30:11 2013 -0400

    Text.vala: address some compile time warnings; fail split more gracefully

 gxml/Text.vala |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gxml/Text.vala b/gxml/Text.vala
index a56698f..edc885e 100644
--- a/gxml/Text.vala
+++ b/gxml/Text.vala
@@ -81,13 +81,13 @@ namespace GXml {
 
                        /* libxml2 doesn't handle this directly, in part because it doesn't
                           allow Text siblings.  Boo! */
-                       if (! this.check_index_size ("split_text", this.data.length, offset, null)) {
-                               return null; // perhaps return "" Text
+                       if (this.check_index_size ("split_text", this.data.length, offset, null)) {
+                               other = this.owner_document.create_text_node (this.data.substring 
((long)offset));
+                               this.data = this.data.substring (0, (long)offset);
+                       } else {
+                               other = this.owner_document.create_text_node ("");
                        }
 
-                       other = this.owner_document.create_text_node (this.data.substring ((long)offset));
-                       this.data = this.data.substring (0, (long)offset);
-
                        /* TODO: Ugh, can't actually let them be siblings in the tree, as
                                 the spec requests, because libxml2 automatically merges Text
                                 siblings. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]