File 0004-Small-fixes.patch of Package libght

From b843d19dbb9c480eb95d9732936847fb743f7466 Mon Sep 17 00:00:00 2001
From: Paul Ramsey <pramsey@cleverelephant.ca>
Date: Mon, 21 Oct 2013 16:05:13 -0700
Subject: [PATCH 4/7] Small fixes

---
 src/ght_schema.c   |  5 ++---
 test/cu_ght_core.c |  4 ++--
 test/cu_tester.c   | 39 ++++++++++++++++++++-------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/ght_schema.c b/src/ght_schema.c
index 093af0d..275d4b2 100644
--- a/src/ght_schema.c
+++ b/src/ght_schema.c
@@ -315,7 +315,7 @@ static GhtErr ght_dimension_from_xml(xmlNodePtr node, GhtDimension **dimension)
 
 static GhtErr ght_schema_from_xml(xmlDocPtr xml_doc, GhtSchema **schema)
 {
-    static xmlChar *xpath_str = (unsigned char*)("/pc:PointCloudSchema/pc:dimension");
+    static xmlChar *xpath_str = (xmlChar*)("/pc:PointCloudSchema/pc:dimension");
     xmlNsPtr xml_ns = NULL;
     xmlXPathContextPtr xpath_ctx;
     xmlXPathObjectPtr xpath_obj;
@@ -349,8 +349,7 @@ static GhtErr ght_schema_from_xml(xmlDocPtr xml_doc, GhtSchema **schema)
     }
 
     /* Iterate on the dimensions we found */
-    nodes = xpath_obj->nodesetval;
-    if ( nodes )
+    if ( (nodes = xpath_obj->nodesetval) )
     {
         int i;
         int ndims = nodes->nodeNr;
diff --git a/test/cu_ght_core.c b/test/cu_ght_core.c
index 136ab7a..61aa647 100644
--- a/test/cu_ght_core.c
+++ b/test/cu_ght_core.c
@@ -325,8 +325,8 @@ test_ght_node_unbuild_tree(void)
     CU_ASSERT_STRING_EQUAL("c0v2hdm1gcuekpf9y1", nodelist->nodes[5]->hash);
     CU_ASSERT_EQUAL(6, nodelist->num_nodes);
     
-    // for ( i = 0 ; i < nodelist->num_nodes; i++ )
-    //     printf("%s\n", nodelist->nodes[i]->hash);
+    for ( i = 0 ; i < nodelist->num_nodes; i++ )
+        printf("%s\n", nodelist->nodes[i]->hash);
     
     ght_nodelist_free_deep(nodelist);
     ght_node_free(root);
diff --git a/test/cu_tester.c b/test/cu_tester.c
index 6a062f6..380b5af 100644
--- a/test/cu_tester.c
+++ b/test/cu_tester.c
@@ -169,30 +169,31 @@ file_to_str(const char *fname)
     char *str = ght_malloc(sz);
     char *ptr = str;
     char *ln;
-	size_t MAXLINELEN = 8192;
-	char buf[MAXLINELEN];
+    size_t MAXLINELEN = 8192;
+    char buf[MAXLINELEN];
 
     snprintf(fullpath, 512, "%s/%s", PROJECT_SOURCE_DIR, fname);
 
-	fr = fopen (fullpath, "rt");
-
-	while (fgets(buf, MAXLINELEN, fr) != NULL) {
-		if (buf[0] == '\0')
-			continue;
-		lnsz = strlen(buf);
-		if ( ptr - str + lnsz > sz )
-		{
-			size_t bsz = ptr - str;
-			sz *= 2;
-			str = ght_realloc(str, sz);
-			ptr = str + bsz;
-		}
-		memcpy(ptr, buf, lnsz);
-		ptr += lnsz;
-	}
+    fr = fopen (fullpath, "rt");
+
+    while (fgets(buf, MAXLINELEN, fr) != NULL) {
+        if (buf[0] == '\0')
+            continue;
+        lnsz = strlen(buf);
+        if ( ptr - str + lnsz > sz )
+        {
+            size_t bsz = ptr - str;
+            sz *= 2;
+            str = ght_realloc(str, sz);
+            ptr = str + bsz;
+        }
+        memcpy(ptr, buf, lnsz);
+        ptr += lnsz;
+    }
 	
     *ptr = '\0';
+    fclose(fr);
 
-	return str;
+    return str;
 }
 
-- 
1.8.4.5
openSUSE Build Service is sponsored by