[gnome-keyring] egg-hex: Bring over hex changes from gcr and libsecret



commit 6beae07105e368a529db85b227f60fa4b60bb397
Author: Stef Walter <stefw gnome org>
Date:   Wed Nov 7 22:54:22 2012 +0100

    egg-hex: Bring over hex changes from gcr and libsecret

 egg/egg-hex.c        |   28 +++++++++++++++-------------
 egg/egg-hex.h        |   22 ++++++++++++----------
 egg/tests/test-hex.c |    8 +++++++-
 3 files changed, 34 insertions(+), 24 deletions(-)
---
diff --git a/egg/egg-hex.c b/egg/egg-hex.c
index 5f94aee..2e857ca 100644
--- a/egg/egg-hex.c
+++ b/egg/egg-hex.c
@@ -1,22 +1,24 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2008 Stefan Walter
- * 
- * This program is free software; you can redistribute it and/or modify 
+ *
+ * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
- *  
+ *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.  
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Author: Stef Walter <stefw thewalter net>
  */
 
 #include "config.h"
@@ -128,18 +130,18 @@ egg_hex_encode_full (gconstpointer data, gsize n_data,
 
 	result = g_string_sized_new (n_data * 2 + 1);
 	bytes = 0;
-	
+
 	while (n_data > 0) {
-		
+
 		if (group && bytes && (bytes % group) == 0)
 			g_string_append_c (result, delim);
 
 		j = *(input) >> 4 & 0xf;
 		g_string_append_c (result, hexc[j]);
-		
+
 		j = *(input++) & 0xf;
 		g_string_append_c (result, hexc[j]);
-    
+
 		++bytes;
 		--n_data;
 	}
diff --git a/egg/egg-hex.h b/egg/egg-hex.h
index e751b14..d87594f 100644
--- a/egg/egg-hex.h
+++ b/egg/egg-hex.h
@@ -1,22 +1,24 @@
-/* 
+/*
  * gnome-keyring
- * 
+ *
  * Copyright (C) 2008 Stefan Walter
- * 
- * This program is free software; you can redistribute it and/or modify 
+ *
+ * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
- *  
+ *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
- *  
- * You should have received a copy of the GNU Lesser General 
+ *
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.  
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Author: Stef Walter <stefw thewalter net>
  */
 
 #ifndef EGG_HEX_H_
@@ -25,7 +27,7 @@
 #include <glib.h>
 
 gpointer              egg_hex_decode                         (const gchar *data,
-                                                              gssize n_data, 
+                                                              gssize n_data,
                                                               gsize *n_decoded);
 
 gpointer              egg_hex_decode_full                    (const gchar *data,
diff --git a/egg/tests/test-hex.c b/egg/tests/test-hex.c
index 97d2517..93ad4bf 100644
--- a/egg/tests/test-hex.c
+++ b/egg/tests/test-hex.c
@@ -1,5 +1,5 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* unit-test-util.c: Test hex routines
+/* unit-test-util.c: Test gck-util.c
 
    Copyright (C) 2007 Stefan Walter
 
@@ -41,6 +41,8 @@ test_encode (void)
 	hex = egg_hex_encode (TEST_DATA, sizeof (TEST_DATA));
 	g_assert (hex);
 	g_assert_cmpstr (hex, ==, TEST_HEX);
+
+	g_free (hex);
 }
 
 static void
@@ -53,10 +55,14 @@ test_encode_spaces (void)
 	g_assert (hex);
 	g_assert_cmpstr (hex, ==, TEST_HEX);
 
+	g_free (hex);
+
 	/* Encode with spaces */
 	hex = egg_hex_encode_full (TEST_DATA, sizeof (TEST_DATA), TRUE, ' ', 1);
 	g_assert (hex);
 	g_assert_cmpstr (hex, ==, TEST_HEX_DELIM);
+
+	g_free (hex);
 }
 
 static void



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