summaryrefslogtreecommitdiff
path: root/ace/ACE.cpp
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-18 21:54:25 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-18 21:54:25 +0000
commit5598223d9cd3f14c00aa82bd14e424147449f796 (patch)
tree5490ae8b79b7a44077e026502b0efc39a999bcca /ace/ACE.cpp
parent2636a9c1bd3ebda5faabe46a40a046cde0c0b3e4 (diff)
downloadATCD-5598223d9cd3f14c00aa82bd14e424147449f796.tar.gz
*** empty log message ***
Diffstat (limited to 'ace/ACE.cpp')
-rw-r--r--ace/ACE.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index f3310f4e1ab..9849395f268 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -314,13 +314,14 @@ ACE::execname (const wchar_t *old_name)
#endif /* ACE_HAS_UNICODE */
u_long
-ACE::hash_pjw (const char *str)
+ACE::hash_pjw (const char *str, size_t len)
{
u_long hash = 0;
- for (const char *temp = str; *temp != 0; temp++)
+ for (size_t i = 0; i < len; i++)
{
- hash = (hash << 4) + (*temp * 13);
+ const char temp = str[i];
+ hash = (hash << 4) + (temp * 13);
u_long g = hash & 0xf0000000;
@@ -335,13 +336,20 @@ ACE::hash_pjw (const char *str)
}
u_long
-ACE::hash_pjw (const ACE_USHORT16 *str)
+ACE::hash_pjw (const char *str)
+{
+ return ACE::hash_pjw (str, ACE_OS::strlen (str));
+}
+
+u_long
+ACE::hash_pjw (const ACE_USHORT16 *str, size_t len)
{
u_long hash = 0;
- for (const ACE_USHORT16 *temp = str; *temp != 0; temp++)
+ for (size_t i = 0; i < len; i++)
{
- hash = (hash << 4) + (*temp * 13);
+ const ACE_USHORT16 temp = str[i];
+ hash = (hash << 4) + (temp * 13);
u_long g = hash & 0xf0000000;
@@ -355,6 +363,12 @@ ACE::hash_pjw (const ACE_USHORT16 *str)
return hash;
}
+u_long
+ACE::hash_pjw (const ACE_USHORT16 *str)
+{
+ return ACE::hash_pjw (str, ACE_OS::strlen (str));
+}
+
// The CRC routine was taken from the FreeBSD implementation of cksum,
// that falls under the following license:
/*-