aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-dbhash.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-01-23 07:10:22 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-01-23 07:10:22 +0800
commitfa5982c96a3d17d6c61027e2ab4e7456d11348ef (patch)
tree906ca87c1ada387914724019160f34405ee76301 /e-util/e-dbhash.c
parent38ae9b4005a01b869947dc075b6300dabd8769f7 (diff)
downloadgsoc2013-evolution-fa5982c96a3d17d6c61027e2ab4e7456d11348ef.tar.gz
gsoc2013-evolution-fa5982c96a3d17d6c61027e2ab4e7456d11348ef.tar.zst
gsoc2013-evolution-fa5982c96a3d17d6c61027e2ab4e7456d11348ef.zip
New function, can't use strlen on the md5 hash because it might have null
2001-01-22 JP Rosevear <jpr@ximian.com> * e-dbhash.c (md5_to_dbt): New function, can't use strlen on the md5 hash because it might have null chars in it. (e_dbhash_add): use md5_to_dbt svn path=/trunk/; revision=7726
Diffstat (limited to 'e-util/e-dbhash.c')
-rw-r--r--e-util/e-dbhash.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/e-util/e-dbhash.c b/e-util/e-dbhash.c
index 2bcedb8676..e286500066 100644
--- a/e-util/e-dbhash.c
+++ b/e-util/e-dbhash.c
@@ -55,6 +55,13 @@ string_to_dbt(const char *str, DBT *dbt)
dbt->size = strlen (str) + 1;
}
+static void
+md5_to_dbt(const char str[16], DBT *dbt)
+{
+ dbt->data = (void*)str;
+ dbt->size = 16;
+}
+
void
e_dbhash_add (EDbHash *edbh, const gchar *key, const gchar *data)
{
@@ -76,7 +83,7 @@ e_dbhash_add (EDbHash *edbh, const gchar *key, const gchar *data)
/* Data dbt */
md5_get_digest (data, strlen (data), local_hash);
- string_to_dbt (local_hash, &ddata);
+ md5_to_dbt (local_hash, &ddata);
/* Add to database */
db->put (db, &dkey, &ddata, 0);