[gxml] More fixes for Bug 760568. Make sure compiles against Vala 0.26



commit 6598a9b2a5d82634d6a2ecdacba4480ee9d6025c
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon May 2 10:42:16 2016 -0500

    More fixes for Bug 760568. Make sure compiles against Vala 0.26
    
    * For now on, we will be sure this package compiles against latest
      stable or LTS version distribution Debian/Ubuntu.
    
      This commit fixes make check under Debian 8.
    
    * For OSX this should fix remained errors for bug 760568

 NEWS                    |    1 +
 gxml/xlibxml.c          |    4 +++-
 test/DocumentTest.vala  |    2 +-
 test/GDocumentTest.vala |    2 +-
 test/GXmlTest.vala      |    2 +-
 test/TDocumentTest.vala |    6 ++----
 test/test.xml           |   15 +++++++++++++++
 7 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/NEWS b/NEWS
index 24e4d29..043d475 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Version 0.11.0
 ===============
 
 * Fixed vapi installation, honoring vala pc file
+* Fixed Bug #760568
 
 ===============
 Version 0.10.0
diff --git a/gxml/xlibxml.c b/gxml/xlibxml.c
index c9c52ba..cd2416d 100644
--- a/gxml/xlibxml.c
+++ b/gxml/xlibxml.c
@@ -23,7 +23,7 @@
 
 void* gxml_doc_get_intsubset_entities (xmlDoc *doc)
 {
-  g_return_if_fail (doc != NULL);
+  g_return_val_if_fail (doc != NULL, NULL);
   return doc->intSubset->entities;
 }
 
@@ -40,11 +40,13 @@ gint gxml_validate_name (xmlChar* name, int space)
  */
 xmlErrorPtr gxml_parser_context_get_last_error (void* ctx)
 {
+  g_return_val_if_fail (ctx != NULL, NULL);
   return gxml_context_get_last_error (ctx);
 }
 
 xmlErrorPtr gxml_context_get_last_error (void* ctx)
 {
+  g_return_val_if_fail (ctx != NULL, NULL);
   return xmlCtxtGetLastError (ctx);
 }
 
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index e98dc12..4c638eb 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -128,7 +128,7 @@ class DocumentTest : GXmlTest {
                Test.add_func ("/gxml/document/gfile/remote", () => {
                        try {
                                var net = GLib.NetworkMonitor.get_default ();
-                               if (net.connectivity != GLib.NetworkConnectivity.FULL) return;
+                               if (!net.network_available) return;
                                var rf = GLib.File.new_for_uri 
("https://git.gnome.org/browse/gxml/plain/gxml.doap";);
                                assert (rf.query_exists ());
                                var d = new xDocument.from_gfile (rf);
diff --git a/test/GDocumentTest.vala b/test/GDocumentTest.vala
index 8bb8826..669f640 100644
--- a/test/GDocumentTest.vala
+++ b/test/GDocumentTest.vala
@@ -93,7 +93,7 @@ class GDocumentTest : GXmlTest {
                Test.add_func ("/gxml/gdocument/gfile/remote", () => {
                        try {
                                var net = GLib.NetworkMonitor.get_default ();
-                               if (net.connectivity != GLib.NetworkConnectivity.FULL) return;
+                               if (!net.network_available) return;
                                var rf = GLib.File.new_for_uri 
("https://git.gnome.org/browse/gxml/plain/gxml.doap";);
                                assert (rf.query_exists ());
                                var d = new GDocument.from_file (rf);
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index b2a7646..998ed0c 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -95,7 +95,7 @@ class GXmlTest {
                xDocument doc = null;
                try {
                        doc = new xDocument.from_path (path != null ? path :
-                                                     get_test_dir () + "/test.xml");
+                                                     GXmlTest.get_test_dir () + "/test.xml");
                } catch (GXml.Error e) {
                        GLib.warning (e.message);
                        assert_not_reached ();
diff --git a/test/TDocumentTest.vala b/test/TDocumentTest.vala
index 4a789d8..aeea0ac 100644
--- a/test/TDocumentTest.vala
+++ b/test/TDocumentTest.vala
@@ -49,9 +49,7 @@ class TDocumentTest : GXmlTest {
                });
                Test.add_func ("/gxml/t-document/root", () => {
                        try {
-                               var f = GLib.File.new_for_path (GXmlTestConfig.TEST_SAVE_DIR+"/t-test.xml");
-                               if (f.query_exists ()) f.delete ();
-                               var d = new TDocument.from_path (GXmlTestConfig.TEST_SAVE_DIR+"/t-test.xml");
+                               var d = new TDocument ();
                                var e = d.create_element ("root");
                                d.children.add (e);
                                assert (d.children.size == 1);
@@ -595,7 +593,7 @@ class TDocumentTest : GXmlTest {
                Test.add_func ("/gxml/t-document/read/uri", () => {
                        try {
                                var net = GLib.NetworkMonitor.get_default ();
-                               if (net.connectivity != GLib.NetworkConnectivity.FULL) return;
+                               if (!net.network_available) return;
                                var rf = GLib.File.new_for_uri 
("https://git.gnome.org/browse/gxml/plain/gxml.doap";);
                                assert (rf.query_exists ());
                                var d = new TDocument.from_uri (rf.get_uri ());
diff --git a/test/test.xml b/test/test.xml
new file mode 100644
index 0000000..9a0fa1b
--- /dev/null
+++ b/test/test.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<Sentences>
+  <Sentence lang="en">I like the colour blue.</Sentence>
+  <Sentence lang="de">Ich liebe die T&#xFC;r.</Sentence>
+  <Authors>
+    <Author>
+      <Name>Fred</Name>
+      <Email>fweasley hogwarts co uk</Email>
+    </Author>
+    <Author>
+      <Name>George</Name>
+      <Email>gweasley hogwarts co uk</Email>
+    </Author>
+  </Authors>
+</Sentences>


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