aboutsummaryrefslogtreecommitdiff
path: root/textproc/clucene
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2013-03-28 02:12:49 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2013-03-28 02:12:49 +0000
commite63f07fc4f2eb026f081a228d14e51378a5f38de (patch)
tree5807d3b5c18577f4f4b734077f1743c1e349293d /textproc/clucene
parent946358e2fa88e308d84acdbf1ffecaa579390782 (diff)
downloadports-e63f07fc4f2eb026f081a228d14e51378a5f38de.tar.gz
ports-e63f07fc4f2eb026f081a228d14e51378a5f38de.zip
Optimize the previous patch. No functional change.
Notes
Notes: svn path=/head/; revision=315429
Diffstat (limited to 'textproc/clucene')
-rw-r--r--textproc/clucene/files/patch-src__core__CLucene__util__MD5Digester.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/textproc/clucene/files/patch-src__core__CLucene__util__MD5Digester.cpp b/textproc/clucene/files/patch-src__core__CLucene__util__MD5Digester.cpp
index aeba9690f115..c354078b37ed 100644
--- a/textproc/clucene/files/patch-src__core__CLucene__util__MD5Digester.cpp
+++ b/textproc/clucene/files/patch-src__core__CLucene__util__MD5Digester.cpp
@@ -1,11 +1,26 @@
--- src/core/CLucene/util/MD5Digester.cpp.orig 2011-03-16 20:21:07.000000000 -0400
-+++ src/core/CLucene/util/MD5Digester.cpp 2013-03-27 17:16:18.000000000 -0400
-@@ -82,7 +82,7 @@
++++ src/core/CLucene/util/MD5Digester.cpp 2013-03-27 21:18:10.000000000 -0400
+@@ -72,18 +72,16 @@
+ // PrintMD5: Converts a completed md5 digest into a char* string.
+ char* PrintMD5(uint8_t md5Digest[16])
+ {
+- char chBuffer[256];
+- char chEach[10];
++ const char toHex[] = "0123456789abcdef";
++ char chBuffer[16 * 2 + 1];
+ int nCount;
+
+- memset(chBuffer,0,256);
+- memset(chEach, 0, 10);
+-
for (nCount = 0; nCount < 16; nCount++)
{
- cl_sprintf(chEach, 10, "%02x", md5Digest[nCount]);
+- cl_sprintf(chEach, 10, "%02x", md5Digest[nCount]);
- strncat(chBuffer, chEach, sizeof(chEach));
-+ strncat(chBuffer, chEach, 2);
++ chBuffer[nCount * 2] = toHex[(md5Digest[nCount] & 0xf0) >> 4];
++ chBuffer[nCount * 2 + 1] = toHex[md5Digest[nCount] & 0x0f];
}
++ chBuffer[nCount * 2] = '\0';
return STRDUP_AtoA(chBuffer);
+ }