diff lib/misc.c @ 59:618423504fe0

2002-11-20 Brian Masney <masneyb@gftp.org> * lib/config_file.c - don't check buf[-1] for blank newlines in gftp_read_config_file() and gftp_read_bookmarks_file() * lib/misc.c (string_hash_function) - Fixes if the string was less than 2 characters * src/gtk/transfer.c - unlock mutex before we destroy (for POSIX compliance) All 3 of these fixes are from Peter Osterlund <petero2@telia.com>
author masneyb
date Thu, 21 Nov 2002 02:49:06 +0000
parents c01d91c10f6c
children 42df9e4be8e0
line wrap: on
line diff
--- a/lib/misc.c	Thu Nov 21 00:33:51 2002 +0000
+++ b/lib/misc.c	Thu Nov 21 02:49:06 2002 +0000
@@ -414,7 +414,14 @@
 guint
 string_hash_function (gconstpointer key)
 {
-  return (((char *) key)[0] + ((char *) key)[1] + ((char *) key)[2]);
+  guint ret;
+  int i;
+
+  ret = 0;
+  for (i=0; ((char *) key)[0] != '\0' && i < 3; i++)
+    ret += ((char *) key)[i];
+
+  return (ret);
 }