summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2007-12-19 18:53:27 +0000
committerChristian Persch <chpe@src.gnome.org>2007-12-19 18:53:27 +0000
commit1ea515d01951ffbee711ac3a3917b96ce7389076 (patch)
treec2b8e4501472ffc31181ab0701de68fdc42fb7cf /tests
parenta979c0d5a2124cbfe5114c5e3f1e7eefc0e230fd (diff)
Add g_checksum_type_get_length, and change g_checksum_get_digest to use a
2007-12-19 Christian Persch <chpe@gnome.org> * glib/gchecksum.c: (g_checksum_type_get_length), (g_checksum_get_digest): * glib/gchecksum.h: * glib/glib.symbols: * tests/checksum-test.c: (test_checksum): Add g_checksum_type_get_length, and change g_checksum_get_digest to use a provided buffer instead of returning allocated memory. Bug #501853. svn path=/trunk/; revision=6162
Diffstat (limited to 'tests')
-rw-r--r--tests/checksum-test.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/checksum-test.c b/tests/checksum-test.c
index 044830226..b44be762a 100644
--- a/tests/checksum-test.c
+++ b/tests/checksum-test.c
@@ -48,8 +48,8 @@ test_checksum (GChecksumType checksum_type,
gchar *data;
guchar *p;
gsize data_len;
- guint8 *digest1, *digest2;
- gsize len1, len2;
+ guint8 digest1[64], digest2[64];
+ gsize len1 = sizeof (digest1), len2 = sizeof (digest2);
gchar *digest_str1, *digest_str2;
checksum0 = g_checksum_new (checksum_type);
@@ -96,21 +96,8 @@ test_checksum (GChecksumType checksum_type,
g_free (data);
- digest1 = NULL;
- g_checksum_get_digest (checksum1, &digest1, &len1);
- if (!digest1)
- {
- g_print ("No %s digest found for checksum1\n", type);
- exit (1);
- }
-
- digest2 = NULL;
- g_checksum_get_digest (checksum2, &digest2, &len2);
- if (!digest2)
- {
- g_print ("No %s digest found for checksum2\n", type);
- exit (1);
- }
+ g_checksum_get_digest (checksum1, digest1, &len1);
+ g_checksum_get_digest (checksum2, digest2, &len2);
digest_str1 = digest_to_string (digest1, len1);
digest_str2 = digest_to_string (digest2, len2);
@@ -126,8 +113,6 @@ test_checksum (GChecksumType checksum_type,
g_free (digest_str1);
g_free (digest_str2);
- g_free (digest1);
- g_free (digest2);
digest_str1 = g_strdup (g_checksum_get_string (checksum1));
digest_str2 = g_strdup (g_checksum_get_string (checksum2));