From 8a5c51f2c968dee1283dce092e1ccc0d3df91f0e Mon Sep 17 00:00:00 2001 From: dimitri Date: Wed, 12 Nov 2003 21:12:36 +0000 Subject: Release-1.3.4-20031112 --- Doxyfile | 2 +- INSTALL | 4 +- Makefile.in | 21 +- README | 4 +- VERSION | 2 +- doc/config.doc | 16 +- libmd5/md5.c | 793 +++++++++++++++++----------------------------- libmd5/md5.h | 249 +++------------ libmd5/md5_loc.h | 119 +------ packages/rpm/doxygen.spec | 2 +- src/Makefile.in | 2 +- src/classdef.cpp | 2 +- src/code.l | 46 ++- src/config.l | 19 +- src/definition.cpp | 4 +- src/docparser.cpp | 9 +- src/dot.cpp | 102 ++++-- src/doxygen.cpp | 10 +- src/filedef.cpp | 2 +- src/groupdef.cpp | 2 +- src/memberdef.cpp | 2 +- src/namespacedef.cpp | 2 +- src/search.php | 4 +- src/search_php.h | 4 +- src/searchindex.cpp | 7 +- src/searchindex.h | 2 +- 26 files changed, 533 insertions(+), 898 deletions(-) diff --git a/Doxyfile b/Doxyfile index 987fc8f..7706aa5 100644 --- a/Doxyfile +++ b/Doxyfile @@ -187,4 +187,4 @@ DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- -SEARCHENGINE = NO +SEARCHENGINE = YES diff --git a/INSTALL b/INSTALL index 8313d23..ed197af 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ -DOXYGEN Version 1.3.4-20031103 +DOXYGEN Version 1.3.4-20031112 Please read the installation section of the manual (http://www.doxygen.org/install.html) for instructions. -------- -Dimitri van Heesch (03 November 2003) +Dimitri van Heesch (12 November 2003) diff --git a/Makefile.in b/Makefile.in index f668893..22a8cdf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -73,11 +73,24 @@ docs: FORCE pdf: docs cd latex ; $(MAKE) +DISTFILES = Doxyfile libpng libmd5 addon tmake doc wintools examples bin lib objects \ + qtools src configure configure.bin Makefile.in Makefile.win_nmake.in \ + Makefile.win_make.in INSTALL make.bat LANGUAGE.HOWTO LICENSE PLATFORMS \ + VERSION packages + archive: clean - tar zcvf dx`date +%y%m%d`.tgz Doxyfile libpng libmd5 addon tmake doc wintools examples bin lib objects \ - qtools src configure configure.bin Makefile.in Makefile.win_nmake.in \ - Makefile.win_make.in INSTALL make.bat LANGUAGE.HOWTO LICENSE PLATFORMS \ - VERSION packages + tar zcvf dx`date +%y%m%d`.tgz $(DISTFILES) + +DISTDIR = doxygen-`echo $(VERSION) | tr - _` + +dist: clean + rm -rf $(DISTDIR) + mkdir $(DISTDIR) + cp -a $(DISTFILES) README $(DISTDIR) + find $(DISTDIR) \( -name "CVS" -o -name ".cvsignore" \) \ + -print0 | xargs -0 rm -rf + tar zcvf $(DISTDIR).src.tar.gz $(DISTDIR) + rm -rf $(DISTDIR) src/version.cpp: Makefile echo "char versionString[]=\"$(VERSION)\";" > src/version.cpp diff --git a/README b/README index 6586b8a..1eb575a 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -DOXYGEN Version 1.3.4_20031103 +DOXYGEN Version 1.3.4_20031112 Please read INSTALL for compilation instructions. @@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives. Enjoy, -Dimitri van Heesch (dimitri@stack.nl) (03 November 2003) +Dimitri van Heesch (dimitri@stack.nl) (12 November 2003) diff --git a/VERSION b/VERSION index d070c72..8ec5a50 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.4-20031103 +1.3.4-20031112 diff --git a/doc/config.doc b/doc/config.doc index 60015d6..c1be0fb 100644 --- a/doc/config.doc +++ b/doc/config.doc @@ -356,7 +356,7 @@ followed by the descriptions of the tags grouped by category. The new default is to treat a multi-line C++ comment block as a detailed description. Set this tag to YES if you prefer the old behaviour instead. Note that setting this tag to YES also means that rational rose comments - are not recognised any more. + are not recognized any more. \anchor cfg_details_at_top
\c DETAILS_AT_TOP
@@ -371,7 +371,7 @@ followed by the descriptions of the tags grouped by category. \addindex INHERIT_DOCS If the \c INHERIT_DOCS tag is set to \c YES (the default) then an undocumented member inherits the documentation from any documented member that it - reimplements. + re-implements. \anchor cfg_distribute_group_doc
\c DISTRIBUTE_GROUP_DOC
@@ -940,7 +940,7 @@ function's detailed documentation block. If the \c GENERATE_HTMLHELP tag is set to \c YES, the \c CHM_FILE tag can be used to specify the file name of the resulting .chm file. You can add a path in front of the file if the result should not be - written to the html output dir. + written to the html output directory. \anchor cfg_hhc_location
\c HHC_LOCATION
@@ -989,7 +989,7 @@ function's detailed documentation block. \anchor cfg_generate_treeview
\c GENERATE_TREEVIEW
\addindex GENERATE_TREEVIEW - If the \c GENERATE_TREEVIEW tag is set to YES, a side pannel will be + If the \c GENERATE_TREEVIEW tag is set to YES, a side panel will be generated containing a tree-like index structure (just like the one that is generated for HTML Help). For this to work a browser that supports JavaScript and frames is required (for instance Mozilla 1.0+, Netscape 6.0+ @@ -1132,7 +1132,7 @@ EXTRA_PACKAGES = times
\c GENERATE_RTF
\addindex GENERATE_RTF If the \c GENERATE_RTF tag is set to \c YES doxygen will generate RTF output. - The RTF output is optimised for Word 97 and may not look too pretty with + The RTF output is optimized for Word 97 and may not look too pretty with other readers/editors. \anchor cfg_rtf_output @@ -1165,7 +1165,7 @@ EXTRA_PACKAGES = times
\c RTF_STYLESHEET_FILE
\addindex RTF_STYLESHEET_FILE Load stylesheet definitions from file. Syntax is similar to doxygen's - config file, i.e. a series of assigments. You only have to provide + config file, i.e. a series of assignments. You only have to provide replacements, missing definitions are set to their default value. See also section \ref doxygen_usage for information on how to generate @@ -1441,7 +1441,7 @@ TAGFILES = file1=loc1 "file2 = loc2" ... If the \c CLASS_DIAGRAMS tag is set to \c YES (the default) doxygen will generate a class diagram (in HTML and \f$\mbox{\LaTeX}\f$) for classes with base or super classes. Setting the tag to \c NO turns the diagrams off. - Note that this option is superceded by the HAVE_DOT option below. + Note that this option is superseded by the HAVE_DOT option below. This is only a fallback. It is recommended to install and use dot, since it yields more powerful graphs. @@ -1555,7 +1555,7 @@ note that a graph may be further truncated if the graph's image dimensions are not sufficient to fit the graph (see \ref cfg_max_dot_graph_width "MAX_DOT_GRAPH_WIDTH" and \ref cfg_max_dot_graph_height "MAX_DOT_GRAPH_HEIGHT"). -If 0 is used fot the depth value (the default), the graph is +If 0 is used for the depth value (the default), the graph is not depth-constraint. \anchor cfg_max_dot_graph_width diff --git a/libmd5/md5.c b/libmd5/md5.c index a667090..d75105c 100644 --- a/libmd5/md5.c +++ b/libmd5/md5.c @@ -1,517 +1,202 @@ -/* - * Functions to compute MD5 message digest of files or memory blocks - * according to the definition of MD5 in RFC 1321 from April 1992. - * Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The - * canonical source of this file is maintained with the GNU C Library. - * Bugs can be reported to bug-glibc@prep.ai.mit.edu. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Written by Ulrich Drepper , 1995. - * Modified by Gray Watson , 1997. - * - * $Id$ +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ -/* - * NOTE: during quick performance tests on a Sun Sparc Ultra 1 and an - * Alpha 255 300, these functions performed upwards of 3mb/sec - * including disk I/O time. +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. */ -/* - * MD5 Test Suite from RFC1321: http://ds.internic.net:/rfc/rfc1321.txt - * - * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e - * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 - * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 - * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 - * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b - * MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = - * d174ab98d277d9f5a5611c2c9f419d9f - * MD5 ("123456789012345678901234567890123456789012345678901234567890123456 - * 78901234567890") = 57edf4a22be3c955ac49da2e2107b67a - */ +#include "md5_loc.h" +#include "md5.h" -#include -#include -#include +/* Constants for MD5Transform routine. + */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform (UINT4 [4], const unsigned char [64]); +static void Encode(unsigned char *, UINT4 *, unsigned int); +static void Decode (UINT4 *, const unsigned char *, unsigned int); +static void MD5_memcpy (POINTER, POINTER, unsigned int); +static void MD5_memset (POINTER, int, unsigned int); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) -#include "md5.h" -#include "md5_loc.h" +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) -#if LIB_VERSION_REQUIRED -static char *rcs_id = - "$Id$"; - -/* version id for the library */ -static char *version_id = "$MD5Version: 1.0.0 November-19-1997 $"; -#endif - -/****************************** local routines *******************************/ - -/* - * process_block - * - * DESCRIPTION: - * - * Process a block of bytes into a MD5 state structure. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure from which we are getting the result. - * - * buffer - A buffer of bytes whose MD5 signature we are calculating. - * - * buf_len - The length of the buffer. +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + Rotation is separate from addition to prevent recomputation. */ -static void process_block(md5_t *md5_p, const void *buffer, - const unsigned int buf_len) -{ - md5_uint32 correct[16]; - const void *buf_p = buffer, *end_p; - unsigned int words_n; - md5_uint32 A, B, C, D; - - words_n = buf_len / sizeof(md5_uint32); - end_p = (char *)buf_p + words_n * sizeof(md5_uint32); - - A = md5_p->md_A; - B = md5_p->md_B; - C = md5_p->md_C; - D = md5_p->md_D; - - /* - * First increment the byte count. RFC 1321 specifies the possible - * length of the file up to 2^64 bits. Here we only compute the - * number of bytes with a double word increment. Modified to do - * this to better avoid overflows in the lower word -- Gray 10/97. - */ - if (md5_p->md_total[0] > MAX_MD5_UINT32 - buf_len) { - md5_p->md_total[1]++; - md5_p->md_total[0] -= (MAX_MD5_UINT32 - buf_len); +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ } - else { - md5_p->md_total[0] += buf_len; +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ } - - /* - * Process all bytes in the buffer with MD5_BLOCK bytes in each - * round of the loop. - */ - while (buf_p < end_p) { - md5_uint32 A_save, B_save, C_save, D_save; - md5_uint32 *corr_p = correct; - - A_save = A; - B_save = B; - C_save = C; - D_save = D; - - /* - * Before we start, one word to the strange constants. They are - * defined in RFC 1321 as - * - * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..MD5_BLOCK - */ - - /* Round 1. */ - OP1 (A, B, C, D, buf_p, corr_p, 7, 0xd76aa478); - OP1 (D, A, B, C, buf_p, corr_p, 12, 0xe8c7b756); - OP1 (C, D, A, B, buf_p, corr_p, 17, 0x242070db); - OP1 (B, C, D, A, buf_p, corr_p, 22, 0xc1bdceee); - OP1 (A, B, C, D, buf_p, corr_p, 7, 0xf57c0faf); - OP1 (D, A, B, C, buf_p, corr_p, 12, 0x4787c62a); - OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa8304613); - OP1 (B, C, D, A, buf_p, corr_p, 22, 0xfd469501); - OP1 (A, B, C, D, buf_p, corr_p, 7, 0x698098d8); - OP1 (D, A, B, C, buf_p, corr_p, 12, 0x8b44f7af); - OP1 (C, D, A, B, buf_p, corr_p, 17, 0xffff5bb1); - OP1 (B, C, D, A, buf_p, corr_p, 22, 0x895cd7be); - OP1 (A, B, C, D, buf_p, corr_p, 7, 0x6b901122); - OP1 (D, A, B, C, buf_p, corr_p, 12, 0xfd987193); - OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa679438e); - OP1 (B, C, D, A, buf_p, corr_p, 22, 0x49b40821); - - /* Round 2. */ - OP234 (FG, A, B, C, D, correct[ 1], 5, 0xf61e2562); - OP234 (FG, D, A, B, C, correct[ 6], 9, 0xc040b340); - OP234 (FG, C, D, A, B, correct[ 11], 14, 0x265e5a51); - OP234 (FG, B, C, D, A, correct[ 0], 20, 0xe9b6c7aa); - OP234 (FG, A, B, C, D, correct[ 5], 5, 0xd62f105d); - OP234 (FG, D, A, B, C, correct[ 10], 9, 0x02441453); - OP234 (FG, C, D, A, B, correct[ 15], 14, 0xd8a1e681); - OP234 (FG, B, C, D, A, correct[ 4], 20, 0xe7d3fbc8); - OP234 (FG, A, B, C, D, correct[ 9], 5, 0x21e1cde6); - OP234 (FG, D, A, B, C, correct[ 14], 9, 0xc33707d6); - OP234 (FG, C, D, A, B, correct[ 3], 14, 0xf4d50d87); - OP234 (FG, B, C, D, A, correct[ 8], 20, 0x455a14ed); - OP234 (FG, A, B, C, D, correct[ 13], 5, 0xa9e3e905); - OP234 (FG, D, A, B, C, correct[ 2], 9, 0xfcefa3f8); - OP234 (FG, C, D, A, B, correct[ 7], 14, 0x676f02d9); - OP234 (FG, B, C, D, A, correct[ 12], 20, 0x8d2a4c8a); - - /* Round 3. */ - OP234 (FH, A, B, C, D, correct[ 5], 4, 0xfffa3942); - OP234 (FH, D, A, B, C, correct[ 8], 11, 0x8771f681); - OP234 (FH, C, D, A, B, correct[ 11], 16, 0x6d9d6122); - OP234 (FH, B, C, D, A, correct[ 14], 23, 0xfde5380c); - OP234 (FH, A, B, C, D, correct[ 1], 4, 0xa4beea44); - OP234 (FH, D, A, B, C, correct[ 4], 11, 0x4bdecfa9); - OP234 (FH, C, D, A, B, correct[ 7], 16, 0xf6bb4b60); - OP234 (FH, B, C, D, A, correct[ 10], 23, 0xbebfbc70); - OP234 (FH, A, B, C, D, correct[ 13], 4, 0x289b7ec6); - OP234 (FH, D, A, B, C, correct[ 0], 11, 0xeaa127fa); - OP234 (FH, C, D, A, B, correct[ 3], 16, 0xd4ef3085); - OP234 (FH, B, C, D, A, correct[ 6], 23, 0x04881d05); - OP234 (FH, A, B, C, D, correct[ 9], 4, 0xd9d4d039); - OP234 (FH, D, A, B, C, correct[ 12], 11, 0xe6db99e5); - OP234 (FH, C, D, A, B, correct[ 15], 16, 0x1fa27cf8); - OP234 (FH, B, C, D, A, correct[ 2], 23, 0xc4ac5665); - - /* Round 4. */ - OP234 (FI, A, B, C, D, correct[ 0], 6, 0xf4292244); - OP234 (FI, D, A, B, C, correct[ 7], 10, 0x432aff97); - OP234 (FI, C, D, A, B, correct[ 14], 15, 0xab9423a7); - OP234 (FI, B, C, D, A, correct[ 5], 21, 0xfc93a039); - OP234 (FI, A, B, C, D, correct[ 12], 6, 0x655b59c3); - OP234 (FI, D, A, B, C, correct[ 3], 10, 0x8f0ccc92); - OP234 (FI, C, D, A, B, correct[ 10], 15, 0xffeff47d); - OP234 (FI, B, C, D, A, correct[ 1], 21, 0x85845dd1); - OP234 (FI, A, B, C, D, correct[ 8], 6, 0x6fa87e4f); - OP234 (FI, D, A, B, C, correct[ 15], 10, 0xfe2ce6e0); - OP234 (FI, C, D, A, B, correct[ 6], 15, 0xa3014314); - OP234 (FI, B, C, D, A, correct[ 13], 21, 0x4e0811a1); - OP234 (FI, A, B, C, D, correct[ 4], 6, 0xf7537e82); - OP234 (FI, D, A, B, C, correct[ 11], 10, 0xbd3af235); - OP234 (FI, C, D, A, B, correct[ 2], 15, 0x2ad7d2bb); - OP234 (FI, B, C, D, A, correct[ 9], 21, 0xeb86d391); - - /* Add the starting values of the context. */ - A += A_save; - B += B_save; - C += C_save; - D += D_save; +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ } - /* Put checksum in context given as argument. */ - md5_p->md_A = A; - md5_p->md_B = B; - md5_p->md_C = C; - md5_p->md_D = D; -} - -/* - * md5_get_result - * - * DESCRIPTION: - * - * Copy the resulting MD5 signature from MD5_P into the first 16 bytes - * (MD5_SIZE) of the result buffer. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure from which we are getting the result. - * - * result - A 16 byte buffer that will contain the MD5 signature. +/* MD5 initialization. Begins an MD5 operation, writing a new context. */ -static void md5_get_result(const md5_t *md5_p, void *result) +void MD5Init (MD5_CTX *context) { - md5_uint32 hold; - void *res_p = result; + context->count[0] = context->count[1] = 0; - hold = SWAP(md5_p->md_A); - memcpy(res_p, &hold, sizeof(md5_uint32)); - res_p = (char *)res_p + sizeof(md5_uint32); - - hold = SWAP(md5_p->md_B); - memcpy(res_p, &hold, sizeof(md5_uint32)); - res_p = (char *)res_p + sizeof(md5_uint32); - - hold = SWAP(md5_p->md_C); - memcpy(res_p, &hold, sizeof(md5_uint32)); - res_p = (char *)res_p + sizeof(md5_uint32); - - hold = SWAP(md5_p->md_D); - memcpy(res_p, &hold, sizeof(md5_uint32)); + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; } -/***************************** exported routines *****************************/ - -/* - * md5_init - * - * DESCRIPTION: - * - * Initialize structure containing state of MD5 computation. (RFC 1321, - * 3.3: Step 3). This is for progressive MD5 calculations only. If - * you have the complete string available, md5_buffer should be used. - * md5_process should be called for each bunch of bytes and after the - * last process call, md5_finish should be called to get the - * signature. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to md5 structure that we are initializing. +/* MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. */ -void md5_init(md5_t *md5_p) +void MD5Update (MD5_CTX *context, const unsigned char *input, unsigned int inputLen) { - md5_p->md_A = 0x67452301; - md5_p->md_B = 0xefcdab89; - md5_p->md_C = 0x98badcfe; - md5_p->md_D = 0x10325476; - - md5_p->md_total[0] = 0; - md5_p->md_total[1] = 0; - md5_p->md_buf_len = 0; -} + unsigned int i, index, partLen; -/* - * md5_process - * - * DESCRIPTION: - * - * This function is used to progressively calculate a MD5 signature some - * number of bytes at a time. If you have the complete string - * available, md5_buffer should be used. The MD5 structure should - * have been initialized with md5_init and after the last process - * call, md5_finish should be called to get the results. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure which we are progressively updating. - * - * buffer - A buffer of bytes whose MD5 signature we are calculating. - * - * buf_len - The length of the buffer. - */ -void md5_process(md5_t *md5_p, const void *buffer, - const unsigned int buf_len) -{ - unsigned int len = buf_len; - unsigned int in_block, add; + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); - /* - * When we already have some bytes in our internal buffer, copy some - * from the user to fill the block. + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. */ - if (md5_p->md_buf_len > 0) { + if (inputLen >= partLen) { + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); - in_block = md5_p->md_buf_len; - if (in_block + len > sizeof(md5_p->md_buffer)) { - add = sizeof(md5_p->md_buffer) - in_block; - } - else { - add = len; - } - - memcpy (md5_p->md_buffer + in_block, buffer, add); - md5_p->md_buf_len += add; - in_block += add; - - if (in_block > MD5_BLOCK_SIZE) { - process_block (md5_p, md5_p->md_buffer, in_block & ~BLOCK_SIZE_MASK); - /* the regions in the following copy operation will not overlap. */ - memcpy (md5_p->md_buffer, - md5_p->md_buffer + (in_block & ~BLOCK_SIZE_MASK), - in_block & BLOCK_SIZE_MASK); - md5_p->md_buf_len = in_block & BLOCK_SIZE_MASK; - } - - buffer = (const char *)buffer + add; - len -= add; - } - - /* process available complete blocks right from the user buffer */ - if (len > MD5_BLOCK_SIZE) { - process_block (md5_p, buffer, len & ~BLOCK_SIZE_MASK); - buffer = (const char *) buffer + (len & ~BLOCK_SIZE_MASK); - len &= BLOCK_SIZE_MASK; - } - - /* copy remaining bytes into the internal buffer */ - if (len > 0) { - memcpy (md5_p->md_buffer, buffer, len); - md5_p->md_buf_len = len; + index = 0; } + else + i = 0; + + /* Buffer remaining input */ + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)&input[i], + inputLen-i); } -/* - * md5_finish - * - * DESCRIPTION: - * - * Finish a progressing MD5 calculation and copy the resulting MD5 - * signature into the result buffer which should be 16 bytes - * (MD5_SIZE). After this call, the MD5 structure is invalid. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure which we are finishing. - * - * signature - A 16 byte buffer that will contain the MD5 signature. +/* MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. */ -void md5_finish(md5_t *md5_p, void *signature) +void MD5Final (MD5_CTX *context, unsigned char digest[16]) { - md5_uint32 bytes, hold; - int pad; + unsigned char bits[8]; + unsigned int index, padLen; - /* take yet unprocessed bytes into account */ - bytes = md5_p->md_buf_len; + /* Save number of bits */ + Encode (bits, context->count, 8); - /* - * Count remaining bytes. Modified to do this to better avoid - * overflows in the lower word -- Gray 10/97. + /* Pad out to 56 mod 64. */ - if (md5_p->md_total[0] > MAX_MD5_UINT32 - bytes) { - md5_p->md_total[1]++; - md5_p->md_total[0] -= (MAX_MD5_UINT32 - bytes); - } - else { - md5_p->md_total[0] += bytes; - } - - /* - * Pad the buffer to the next MD5_BLOCK-byte boundary. (RFC 1321, - * 3.1: Step 1). We need enough room for two size words and the - * bytes left in the buffer. For some reason even if we are equal - * to the block-size, we add an addition block of pad bytes. - */ - pad = MD5_BLOCK_SIZE - (sizeof(md5_uint32) * 2) - bytes; - if (pad <= 0) { - pad += MD5_BLOCK_SIZE; - } + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); - /* - * Modified from a fixed array to this assignment and memset to be - * more flexible with block-sizes -- Gray 10/97. + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. */ - if (pad > 0) { - /* some sort of padding start byte */ - md5_p->md_buffer[bytes] = (unsigned char)0x80; - if (pad > 1) { - memset (md5_p->md_buffer + bytes + 1, 0, pad - 1); - } - bytes += pad; - } - - /* put the 64-bit file length in _bits_ (i.e. *8) at the end of the buffer */ - hold = SWAP(md5_p->md_total[0] << 3); - memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32)); - bytes += sizeof(md5_uint32); - - /* shift the high word over by 3 and add in the top 3 bits from the low */ - hold = SWAP((md5_p->md_total[1] << 3) | (md5_p->md_total[0] >> 29)); - memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32)); - bytes += sizeof(md5_uint32); - - /* process last bytes, the padding chars, and size words */ - process_block(md5_p, md5_p->md_buffer, bytes); - md5_get_result(md5_p, signature); + MD5_memset ((POINTER)context, 0, sizeof (*context)); } -/* - * md5_buffer - * - * DESCRIPTION: - * - * This function is used to calculate a MD5 signature for a buffer of - * bytes. If you only have part of a buffer that you want to process - * then md5_init, md5_process, and md5_finish should be used. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * buffer - A buffer of bytes whose MD5 signature we are calculating. - * - * buf_len - The length of the buffer. - * - * signature - A 16 byte buffer that will contain the MD5 signature. - */ -void md5_buffer(const char *buffer, const unsigned int buf_len, - void *signature) +void MD5Buffer (const char *buf,unsigned int len,unsigned char sig[16]) { - md5_t md5; - - /* initialize the computation context */ - md5_init(&md5); - - /* process whole buffer but last buf_len % MD5_BLOCK bytes */ - md5_process(&md5, buffer, buf_len); - - /* put result in desired memory area */ - md5_finish(&md5, signature); + MD5_CTX md5; + MD5Init(&md5); + MD5Update(&md5,buf,len); + MD5Final(&md5,sig); } -/* - * md5_sig_to_string - * - * DESCRIPTION: - * - * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string - * representation. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * signature - a 16 byte buffer that contains the MD5 signature. - * - * str - a string of charactes which should be at least 33 bytes long (2 - * characters per MD5 byte and 1 for the \0). - * - * str_len - the length of the string. - */ -void md5_sig_to_string(void *signature, char *str, const int str_len) +#define HEX_STRING "0123456789abcdef" /* to convert to hex */ + +void MD5SigToString(unsigned char signature[16],char *str,int len) { - unsigned char *sig_p; - char *str_p, *max_p; - unsigned int high, low; - + unsigned char *sig_p; + char *str_p, *max_p; + unsigned int high, low; + str_p = str; - max_p = str + str_len; - + max_p = str + len; + for (sig_p = (unsigned char *)signature; - sig_p < (unsigned char *)signature + MD5_SIZE; - sig_p++) { + sig_p < (unsigned char *)signature + 16; + sig_p++) + { high = *sig_p / 16; low = *sig_p % 16; /* account for 2 chars */ @@ -527,39 +212,141 @@ void md5_sig_to_string(void *signature, char *str, const int str_len) } } -/* - * md5_sig_from_string - * - * DESCRIPTION: - * - * Convert a MD5 signature from a hexadecimal string representation into - * a 16 byte buffer. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * signature - A 16 byte buffer that will contain the MD5 signature. - * - * str - A string of charactes which _must_ be at least 32 bytes long (2 - * characters per MD5 byte). +/* MD5 basic transformation. Transforms state based on block. */ -void md5_sig_from_string(void *signature, const char *str) +static void MD5Transform (UINT4 state[4], const unsigned char block[64]) { - unsigned char *sig_p; - const char *str_p; - char *hex; - unsigned int high, low, val; + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - hex = HEX_STRING; - sig_p = signature; + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; - for (str_p = str; str_p < str + MD5_SIZE * 2; str_p += 2) { - high = strchr(hex, *str_p) - hex; - low = strchr(hex, *(str_p + 1)) - hex; - val = high * 16 + low; - *sig_p++ = val; + /* Zeroize sensitive information. + */ + MD5_memset ((POINTER)x, 0, sizeof (x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode (unsigned char *output, UINT4 *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. + */ +static void Decode (UINT4 *output, const unsigned char *input, unsigned int len) +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +/* Note: Replace "for loop" with standard memcpy if possible. + */ +static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) +{ + unsigned int i; + + for (i = 0; i < len; i++) + output[i] = input[i]; +} + +/* Note: Replace "for loop" with standard memset if possible. + */ +static void MD5_memset (POINTER output, int value, unsigned int len) +{ + unsigned int i; + + for (i = 0; i < len; i++) + ((char *)output)[i] = (char)value; +} + + diff --git a/libmd5/md5.h b/libmd5/md5.h index 6b35fc6..e62aa07 100644 --- a/libmd5/md5.h +++ b/libmd5/md5.h @@ -1,225 +1,52 @@ -/* - * Declaration of functions and data types used for MD5 sum computing - * library functions. Copyright (C) 1995, 1996 Free Software - * Foundation, Inc. NOTE: The canonical source of this file is - * maintained with the GNU C Library. Bugs can be reported to - * bug-glibc@prep.ai.mit.edu. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * $Id$ +/* MD5.H - header file for MD5C.C */ -/* - * NOTE: during quick performance tests on a sun ultra and an alpha - * 255 300, the md5 libraries performed upwards of 3mb/sec. That - * included disk i/o on bobcat and panther. +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. */ -#ifndef __MD5_H__ -#define __MD5_H__ +#ifndef _MD5_H_ +#define _MD5_H_ #ifdef __cplusplus extern "C" { #endif -/* - * Size of a standard MD5 signature in bytes. This definition is for - * external programs only. The MD5 routines themselves reference the - * signature as 4 unsigned 32-bit integers. - */ -#define MD5_SIZE 16 - -/* - * NOTE: the following is assumed to generate a 32-bit unsigned data - * type. - */ -typedef unsigned int md5_uint32; -#define MAX_MD5_UINT32 ((md5_uint32)4294967295U) - -/* - * The MD5 algorithm works on blocks of characters of 64 bytes. This - * is an internal value only and is not necessary for external use. - */ -#define MD5_BLOCK_SIZE 64 - -/* - * Structure to save state of computation between the single steps. - */ -typedef struct -{ - md5_uint32 md_A; /* accumulater 1 */ - md5_uint32 md_B; /* accumulater 2 */ - md5_uint32 md_C; /* accumulater 3 */ - md5_uint32 md_D; /* accumulater 4 */ - - md5_uint32 md_total[2]; /* totaling storage */ - md5_uint32 md_buf_len; /* length of the storage buffer */ - char md_buffer[MD5_BLOCK_SIZE * 2]; /* character storage buffer */ -} md5_t; - -/*<<<<<<<<<< The below prototypes are auto-generated by fillproto */ - -/* - * md5_init - * - * DESCRIPTION: - * - * Initialize structure containing state of MD5 computation. (RFC 1321, - * 3.3: Step 3). This is for progressive MD5 calculations only. If - * you have the complete string available, md5_buffer should be used. - * md5_process should be called for each bunch of bytes and after the - * last process call, md5_finish should be called to get the - * signature. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to md5 structure that we are initializing. - */ -extern -void md5_init(md5_t *md5_p); - -/* - * md5_process - * - * DESCRIPTION: - * - * This function is used to progressively calculate a MD5 signature some - * number of bytes at a time. If you have the complete string - * available, md5_buffer should be used. The MD5 structure should - * have been initialized with md5_init and after the last process - * call, md5_finish should be called to get the results. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure which we are progressively updating. - * - * buffer - A buffer of bytes whose MD5 signature we are calculating. - * - * buf_len - The length of the buffer. - */ -extern -void md5_process(md5_t *md5_p, const void *buffer, - const unsigned int buf_len); - -/* - * md5_finish - * - * DESCRIPTION: - * - * Finish a progressing MD5 calculation and copy the resulting MD5 - * signature into the result buffer which should be 16 bytes - * (MD5_SIZE). After this call, the MD5 structure is invalid. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * md5_p - Pointer to MD5 structure which we are finishing. - * - * signature - A 16 byte buffer that will contain the MD5 signature. - */ -extern -void md5_finish(md5_t *md5_p, void *signature); - -/* - * md5_buffer - * - * DESCRIPTION: - * - * This function is used to calculate a MD5 signature for a buffer of - * bytes. If you only have part of a buffer that you want to process - * then md5_init, md5_process, and md5_finish should be used. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * buffer - A buffer of bytes whose MD5 signature we are calculating. - * - * buf_len - The length of the buffer. - * - * signature - A 16 byte buffer that will contain the MD5 signature. - */ -extern -void md5_buffer(const char *buffer, const unsigned int buf_len, - void *signature); - -/* - * md5_sig_to_string - * - * DESCRIPTION: - * - * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string - * representation. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * signature - a 16 byte buffer that contains the MD5 signature. - * - * str - a string of charactes which should be at least 33 bytes long (2 - * characters per MD5 byte and 1 for the \0). - * - * str_len - the length of the string. - */ -extern -void md5_sig_to_string(void *signature, char *str, const int str_len); - -/* - * md5_sig_from_string - * - * DESCRIPTION: - * - * Convert a MD5 signature from a hexadecimal string representation into - * a 16 byte buffer. - * - * RETURNS: - * - * None. - * - * ARGUMENTS: - * - * signature - A 16 byte buffer that will contain the MD5 signature. - * - * str - A string of charactes which _must_ be at least 32 bytes long (2 - * characters per MD5 byte). - */ -extern -void md5_sig_from_string(void *signature, const char *str); - -/*<<<<<<<<<< This is end of the auto-generated output from fillproto. */ +#include "md5_loc.h" + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +void MD5Init(MD5_CTX *ctx); +void MD5Update (MD5_CTX *ctx, const unsigned char *buf, unsigned int len); +void MD5Final (MD5_CTX *ctx, unsigned char sig[16]); +void MD5Buffer (const char *buf,unsigned int len,unsigned char sig[16]); +void MD5SigToString(unsigned char sig[16],char *str,int len); #ifdef __cplusplus } #endif -#endif /* ! __MD5_H__ */ +#endif diff --git a/libmd5/md5_loc.h b/libmd5/md5_loc.h index 3d6e2b6..464e3d1 100644 --- a/libmd5/md5_loc.h +++ b/libmd5/md5_loc.h @@ -1,114 +1,27 @@ -/* - * Local defines for the md5 functions. - * - * $Id$ - */ +/* GLOBAL.H - RSAREF types and constants */ -/* - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it is - * identified as the "RSA Data Security, Inc. MD5 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided that - * such works are identified as "derived from the RSA Data Security, - * Inc. MD5 Message-Digest Algorithm" in all material mentioning or - * referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either the - * merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" without - * express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. +/* Copyright (C) RSA Laboratories, a division of RSA Data Security, + Inc., created 1991. All rights reserved. */ -#ifndef __MD5_LOC_H__ -#define __MD5_LOC_H__ +#ifndef _MD5LOC_H +#define _MD5LOC_H -#ifdef __cplusplus -extern "C" { -#endif +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; -#define HEX_STRING "0123456789abcdef" /* to convert to hex */ -#define BLOCK_SIZE_MASK (MD5_BLOCK_SIZE - 1) +/* UINT2 defines a two byte word */ +typedef unsigned short int UINT2; -/* - * Define my endian-ness. Could not do in a portable manner using the - * include files -- grumble. - */ -#if defined(__alpha) || defined(WIN32) || defined(__i386__) -/* - * little endian - */ -#define SWAP(n) (n) -#endif +/* UINT4 defines a four byte word */ +typedef unsigned long int UINT4; -#ifdef __sparc -/* - * big endian - big is better - */ -#define SWAP(n) \ - (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#ifndef NULL_PTR +#define NULL_PTR ((POINTER)0) #endif -/* - * These are the four functions used in the four steps of the MD5 - * algorithm and defined in the RFC 1321. The first function is a - * little bit optimized (as found in Colin Plumbs public domain - * implementation). - */ -/* #define FF(b, c, d) ((b & c) | (~b & d)) */ -#define FF(b, c, d) (d ^ (b & (c ^ d))) -#define FG(b, c, d) FF(d, b, c) -#define FH(b, c, d) (b ^ c ^ d) -#define FI(b, c, d) (c ^ (b | ~d)) - -/* - * It is unfortunate that C does not provide an operator for cyclic - * rotation. Hope the C compiler is smart enough. -- Modified to - * remove the w = at the front - Gray 2/97 - */ -#define CYCLIC(w, s) ((w << s) | (w >> (32 - s))) - -/* - * First Round: using the given function, the context and a constant - * the next context is computed. Because the algorithms processing - * unit is a 32-bit word and it is determined to work on words in - * little endian byte order we perhaps have to change the byte order - * before the computation. To reduce the work for the next steps we - * store the swapped words in the array CORRECT_WORDS. -- Modified to - * fix the handling of unaligned buffer spaces - Gray 7/97 - */ -#define OP1(a, b, c, d, b_p, c_p, s, T) \ - do { \ - memcpy(c_p, b_p, sizeof(md5_uint32)); \ - *c_p = SWAP(*c_p); \ - a += FF (b, c, d) + *c_p + T; \ - a = CYCLIC (a, s); \ - a += b; \ - b_p = (char *)b_p + sizeof(md5_uint32); \ - c_p++; \ - } while (0) - -/* - * Second to Fourth Round: we have the possibly swapped words in - * CORRECT_WORDS. Redefine the macro to take an additional first - * argument specifying the function to use. - */ -#define OP234(FUNC, a, b, c, d, k, s, T) \ - do { \ - a += FUNC (b, c, d) + k + T; \ - a = CYCLIC (a, s); \ - a += b; \ - } while (0) - -#ifdef __cplusplus -} +#ifndef UNUSED_ARG +#define UNUSED_ARG(x) x = *(&x); #endif -#endif /* ! __MD5_LOC_H__ */ +#endif /* end _GLOBAL_H_ */ diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec index 0e37b03..4b5c4b1 100644 --- a/packages/rpm/doxygen.spec +++ b/packages/rpm/doxygen.spec @@ -1,6 +1,6 @@ Summary: A documentation system for C/C++. Name: doxygen -Version: 1.3.4_20031103 +Version: 1.3.4_20031112 Release: 1 Epoch: 1 Source0: ftp://ftp.stack.nl/pub/users/dimitri/%{name}-%{version}.src.tar.gz diff --git a/src/Makefile.in b/src/Makefile.in index 1d57871..ccb63ca 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -38,7 +38,7 @@ tmake: $(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen $(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag -clean: Makefile.libdoxygen Makefile.doxygen Makefile.doxytag +clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag $(MAKE) -f Makefile.libdoxygen clean $(MAKE) -f Makefile.libdoxycfg clean $(MAKE) -f Makefile.doxygen clean diff --git a/src/classdef.cpp b/src/classdef.cpp index 150ad3f..c061257 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -853,7 +853,7 @@ void ClassDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { - Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")); + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); Doxygen::searchIndex->addWord(localName().lower()); } diff --git a/src/code.l b/src/code.l index 3cda27b..7de86ae 100644 --- a/src/code.l +++ b/src/code.l @@ -34,6 +34,7 @@ #include "outputlist.h" #include "util.h" #include "membername.h" +#include "searchindex.h" #define YY_NEVER_INTERACTIVE 1 @@ -78,7 +79,8 @@ static QCString g_name; static QCString g_args; static QCString g_classScope; static QCString g_realScope; -static QStack g_scopeStack; //!< 1 if bracket starts a scope, 2 for internal blocks +static QStack g_scopeStack; //!< 1 if bracket starts a scope, + // 2 for internal blocks static int g_anchorCount; static FileDef * g_sourceFileDef; static Definition * g_currentDefinition; @@ -318,6 +320,24 @@ static void popScope() //printf("popScope() result: `%s'\n",g_classScope.data()); } +static void setCurrentDoc(const QCString &name,const QCString &base,const QCString &anchor="") +{ + static bool searchEngineEnabled=Config_getBool("SEARCHENGINE"); + if (searchEngineEnabled) + { + Doxygen::searchIndex->setCurrentDoc(name,base,anchor); + } +} + +static void addToSearchIndex(const char *text) +{ + static bool searchEngineEnabled=Config_getBool("SEARCHENGINE"); + if (searchEngineEnabled) + { + Doxygen::searchIndex->addWord(text); + } +} + static void setClassScope(const QCString &name) { //printf("setClassScope(%s)\n",name.data()); @@ -360,17 +380,27 @@ static void startCodeLine() g_realScope = d->name().copy(); //printf("Real scope: `%s'\n",g_realScope.data()); g_bodyCurlyCount = 0; + QCString lineAnchor; + lineAnchor.sprintf("l%05d",g_yyLineNr); if (g_currentMemberDef) { g_code->writeLineNumber(g_currentMemberDef->getReference(), g_currentMemberDef->getOutputFileBase(), g_currentMemberDef->anchor(),g_yyLineNr); + setCurrentDoc( + g_currentMemberDef->qualifiedName(), + g_sourceFileDef->getSourceFileBase(), + lineAnchor); } else { g_code->writeLineNumber(d->getReference(), d->getOutputFileBase(), 0,g_yyLineNr); + setCurrentDoc( + d->qualifiedName(), + g_sourceFileDef->getSourceFileBase(), + lineAnchor); } } else @@ -683,6 +713,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, } } writeMultiLineCodeLink(ol,cd->getReference(),cd->getOutputFileBase(),0,className); + addToSearchIndex(className); if (md) { Definition *d = md->getOuterScope()==Doxygen::globalScope ? @@ -717,6 +748,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, if (md->isLinkable()) { writeMultiLineCodeLink(ol,md->getReference(),md->getOutputFileBase(),md->anchor(),clName); + addToSearchIndex(clName); if (g_currentMemberDef) { addDocCrossReference(g_currentMemberDef,md); @@ -727,6 +759,7 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName, } codifyLines(clName); + addToSearchIndex(clName); } } @@ -782,6 +815,7 @@ static bool getLink(const char *className, md->getOutputFileBase(), md->anchor(), text ? text : memberName); + addToSearchIndex(text ? text : memberName); return TRUE; } } @@ -834,6 +868,7 @@ static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const // write the actual link writeMultiLineCodeLink(ol,xmd->getReference(), xmd->getOutputFileBase(),xmd->anchor(),memName); + addToSearchIndex(memName); return TRUE; } @@ -934,6 +969,7 @@ static void generateMemberLink(BaseCodeDocInterface &ol,const QCString &varName, } } codifyLines(memName); + addToSearchIndex(memName); return; } @@ -1499,12 +1535,14 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),yytext)) { g_code->codify(yytext); + addToSearchIndex(yytext); } g_name.resize(0); } else { g_code->codify(yytext); + addToSearchIndex(yytext); g_name.resize(0); } g_type.resize(0); @@ -1524,12 +1562,14 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),yytext)) { g_code->codify(yytext); + addToSearchIndex(yytext); } g_name.resize(0); } else { g_code->codify(yytext); + addToSearchIndex(yytext); g_name.resize(0); } g_type.resize(0); @@ -2104,6 +2144,10 @@ void parseCode(BaseCodeDocInterface &od,const char *className,const QCString &s, g_exampleBlock = exBlock; g_exampleName = exName; g_sourceFileDef = fd; + if (fd) + { + setCurrentDoc(fd->name(),fd->getSourceFileBase()); + } g_currentDefinition = 0; g_currentMemberDef = 0; g_searchingForBody = FALSE; diff --git a/src/config.l b/src/config.l index 594cbc2..cd88d3e 100644 --- a/src/config.l +++ b/src/config.l @@ -19,7 +19,6 @@ */ #include #include -//#include #include #include #include @@ -1489,7 +1488,7 @@ void Config::create() "will interpret the first line (until the first dot) of a JavaDoc-style \n" "comment as the brief description. If set to NO, the JavaDoc \n" "comments will behave just like the Qt-style comments (thus requiring an \n" - "explict @brief command for a brief description. \n", + "explicit @brief command for a brief description. \n", FALSE ); cb = addBool( @@ -1513,7 +1512,7 @@ void Config::create() "INHERIT_DOCS", "If the INHERIT_DOCS tag is set to YES (the default) then an undocumented \n" "member inherits the documentation from any documented member that it \n" - "reimplements. \n", + "re-implements. \n", TRUE ); cb = addBool( @@ -2007,7 +2006,7 @@ void Config::create() "If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can \n" "be used to specify the file name of the resulting .chm file. You \n" "can add a path in front of the file if the result should not be \n" - "written to the html output dir. \n" + "written to the html output directory. \n" ); cs->addDependency("GENERATE_HTML"); cs = addString( @@ -2187,7 +2186,7 @@ void Config::create() cb = addBool( "GENERATE_RTF", "If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output \n" - "The RTF output is optimised for Word 97 and may not look very pretty with \n" + "The RTF output is optimized for Word 97 and may not look very pretty with \n" "other RTF readers or editors.\n", FALSE ); @@ -2222,7 +2221,7 @@ void Config::create() cs = addString( "RTF_STYLESHEET_FILE", "Load stylesheet definitions from file. Syntax is similar to doxygen's \n" - "config file, i.e. a series of assigments. You only have to provide \n" + "config file, i.e. a series of assignments. You only have to provide \n" "replacements, missing definitions are set to their default value. \n" ); cs->setWidgetType(ConfigString::File); @@ -2277,9 +2276,7 @@ void Config::create() "GENERATE_XML", "If the GENERATE_XML tag is set to YES Doxygen will \n" "generate an XML file that captures the structure of \n" - "the code including all documentation. Note that this \n" - "feature is still experimental and incomplete at the \n" - "moment. \n", + "the code including all documentation. \n", FALSE ); cs = addString( @@ -2500,7 +2497,7 @@ void Config::create() "If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will \n" "generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or \n" "super classes. Setting the tag to NO turns the diagrams off. Note that this \n" - "option is superceded by the HAVE_DOT option below. This is only a fallback. It is \n" + "option is superseded by the HAVE_DOT option below. This is only a fallback. It is \n" "recommended to install and use dot, since it yields more powerful graphs. \n", TRUE ); @@ -2540,7 +2537,7 @@ void Config::create() cb = addBool( "UML_LOOK", "If the UML_LOOK tag is set to YES doxygen will generate inheritance and \n" - "collaboration diagrams in a style similiar to the OMG's Unified Modeling \n" + "collaboration diagrams in a style similar to the OMG's Unified Modeling \n" "Language. \n", FALSE ); diff --git a/src/definition.cpp b/src/definition.cpp index 1e4f287..687ef77 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -207,6 +207,8 @@ void Definition::setDocumentation(const char *d,const char *docFile,int docLine, m_docLine = docLine; } +#define uni_isupper(c) (QChar(c).category()==QChar::Letter_Uppercase) + void Definition::setBriefDescription(const char *b,const char *briefFile,int briefLine) { if (b==0) return; @@ -219,7 +221,7 @@ void Definition::setBriefDescription(const char *b,const char *briefFile,int bri { case '.': case '!': case '?': break; default: - if (isupper(m_brief.at(0))) m_brief+='.'; + if (uni_isupper(m_brief.at(0))) m_brief+='.'; break; } } diff --git a/src/docparser.cpp b/src/docparser.cpp index 1ee90f5..3774a08 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -4782,16 +4782,15 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, if (indexWords && md && Config_getBool("SEARCHENGINE")) { - g_searchUrl=md->getOutputFileBase()+ - Config_getString("HTML_FILE_EXTENSION")+"#"+md->anchor(); + g_searchUrl=md->getOutputFileBase(); Doxygen::searchIndex->setCurrentDoc( theTranslator->trMember(TRUE,TRUE)+" "+md->qualifiedName(), - g_searchUrl); + g_searchUrl, + md->anchor()); } else if (indexWords && ctx && Config_getBool("SEARCHENGINE")) { - g_searchUrl=ctx->getOutputFileBase()+ - Config_getString("HTML_FILE_EXTENSION"); + g_searchUrl=ctx->getOutputFileBase(); QCString name = ctx->qualifiedName(); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { diff --git a/src/dot.cpp b/src/dot.cpp index efaf077..06fa924 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -938,11 +938,12 @@ void DotGfxHierarchyTable::writeGraph(QTextStream &out,const char *path) node->write(md5stream,DotNode::Hierarchy,BITMAP,FALSE,TRUE,1000,TRUE); } } - char md5_sig[16]; + uchar md5_sig[16]; QCString sigStr(33); - md5_buffer(buf.ascii(),buf.length(),md5_sig); - md5_sig_to_string(md5_sig,sigStr.data(),33); - if (checkAndUpdateMd5Signature(baseName,sigStr)) + MD5Buffer(buf.ascii(),buf.length(),md5_sig); + MD5SigToString(md5_sig,sigStr.data(),33); + if (checkAndUpdateMd5Signature(baseName,sigStr) || + !QFileInfo(mapName).exists()) { // image was new or has changed QCString dotName=baseName+".dot"; @@ -1478,10 +1479,10 @@ QCString computeMd5Signature(DotNode *root, pn->write(md5stream,gt,format,TRUE,FALSE,distance,backArrows); } } - char md5_sig[16]; + uchar md5_sig[16]; QCString sigStr(33); - md5_buffer(buf.ascii(),buf.length(),md5_sig); - md5_sig_to_string(md5_sig,sigStr.data(),33); + MD5Buffer(buf.ascii(),buf.length(),md5_sig); + MD5SigToString(md5_sig,sigStr.data(),33); //printf("md5: %s | file: %s\n",sigStr,baseName.data()); return sigStr; } @@ -1492,9 +1493,9 @@ static bool findMaximalDotGraph(DotNode *root, QDir &thisDir, DotNode::GraphType gt, GraphOutputFormat format, - bool lrRank=FALSE, - bool renderParents=FALSE, - bool backArrows=TRUE + bool lrRank /*=FALSE*/, + bool renderParents /*=FALSE*/, + bool backArrows /*=TRUE*/ ) { int minDistance=1; // min distance that shows only direct children. @@ -1506,10 +1507,6 @@ static bool findMaximalDotGraph(DotNode *root, int maxDotGraphHeight = Config_getInt("MAX_DOT_GRAPH_HEIGHT"); int lastFit=minDistance; - QCString md5 = computeMd5Signature(root,gt,format,lrRank, - renderParents,maxDistance,backArrows); - if (!checkAndUpdateMd5Signature(baseName,md5)) return FALSE; - // binary search for the maximal inheritance depth that fits in a reasonable // sized image (dimensions: Config_getInt("MAX_DOT_GRAPH_WIDTH"), Config_getInt("MAX_DOT_GRAPH_HEIGHT")) while (minDistance<=maxDistance) @@ -1631,9 +1628,28 @@ QCString DotClassGraph::writeGraph(QTextStream &out, QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT"); - if (findMaximalDotGraph(m_startNode,QMIN(m_recDepth,m_maxDistance),baseName, - thisDir,m_graphType,format,!isTBRank,m_graphType==DotNode::Inheritance)) + QCString md5 = computeMd5Signature(m_startNode, // root + m_graphType, // gt + format, // format + !isTBRank, // lrRank + m_graphType==DotNode::Inheritance, // renderParent + QMIN(m_recDepth,m_maxDistance), // maxDist + TRUE // backArrows + ); + if (checkAndUpdateMd5Signature(baseName,md5) || + !QFileInfo(baseName+".map").exists() + ) { + findMaximalDotGraph(m_startNode, // root + QMIN(m_recDepth,m_maxDistance), // maxDist + baseName, // baseName + thisDir, // thisDir + m_graphType, // gt + format, // format + !isTBRank, // lrRank + m_graphType==DotNode::Inheritance, // renderParents + TRUE // backArrows + ); if (format==BITMAP) // run dot to create a bitmap image { QCString dotArgs(maxCmdLine); @@ -1686,7 +1702,7 @@ QCString DotClassGraph::writeGraph(QTextStream &out, if (Config_getBool("DOT_CLEANUP")) thisDir.remove(baseName+".dot"); } - if (format==BITMAP) // run dot to create a bitmap image + if (format==BITMAP && generateImageMap) // run dot to create a image map { QCString mapLabel = convertNameToFile(m_startNode->m_label+"_"+mapName); out << "

setCurrentDoc(pageTitle,getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")); + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); Doxygen::searchIndex->addWord(localName().lower()); } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index a1ee9a3..b170612 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -427,7 +427,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { - Doxygen::searchIndex->setCurrentDoc(title,getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")); + Doxygen::searchIndex->setCurrentDoc(title,getOutputFileBase()); Doxygen::searchIndex->addWord(localName().lower()); } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 3ce930d..a47e103 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -817,7 +817,7 @@ void MemberDef::writeDeclaration(OutputList &ol, // write search index info if (Config_getBool("SEARCHENGINE")) { - Doxygen::searchIndex->setCurrentDoc(qualifiedName(),getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")+"#"+anchor()); + Doxygen::searchIndex->setCurrentDoc(qualifiedName(),getOutputFileBase(),anchor()); Doxygen::searchIndex->addWord(localName().lower()); Doxygen::searchIndex->addWord(qualifiedName().lower()); } diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 9ca4e89..c2aa94a 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -263,7 +263,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) if (Config_getBool("SEARCHENGINE")) { - Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()+Config_getString("HTML_FILE_EXTENSION")); + Doxygen::searchIndex->setCurrentDoc(pageTitle,getOutputFileBase()); Doxygen::searchIndex->addWord(localName().lower()); } diff --git a/src/search.php b/src/search.php index 7075ea3..bc4330d 100644 --- a/src/search.php +++ b/src/search.php @@ -276,7 +276,7 @@ function main() $requiredWords = array(); $forbiddenWords = array(); $foundWords = array(); - $word=strtolower(strtok($query," ")); + $word=strtok($query," "); while ($word) // for each word in the search query { if (($word{0}=='+')) { $word=substr($word,1); $requiredWords[]=$word; } @@ -286,7 +286,7 @@ function main() $foundWords[]=$word; search($file,$word,$results); } - $word=strtolower(strtok(" ")); + $word=strtok(" "); } $docs = array(); combine_results($results,$docs); diff --git a/src/search_php.h b/src/search_php.h index 4213b19..2ffa41c 100644 --- a/src/search_php.h +++ b/src/search_php.h @@ -276,7 +276,7 @@ " $requiredWords = array();\n" " $forbiddenWords = array();\n" " $foundWords = array();\n" -" $word=strtolower(strtok($query,\" \"));\n" +" $word=strtok($query,\" \");\n" " while ($word) // for each word in the search query\n" " {\n" " if (($word{0}=='+')) { $word=substr($word,1); $requiredWords[]=$word; }\n" @@ -286,7 +286,7 @@ " $foundWords[]=$word;\n" " search($file,$word,$results);\n" " }\n" -" $word=strtolower(strtok(\" \"));\n" +" $word=strtok(\" \");\n" " }\n" " $docs = array();\n" " combine_results($results,$docs);\n" diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 74834b9..7427ac6 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -17,6 +17,7 @@ #include "qtbc.h" #include "searchindex.h" +#include "config.h" #include @@ -59,8 +60,10 @@ SearchIndex::SearchIndex() : m_words(328829), m_index(numIndexEntries), m_urlInd for (i=0;i); } -void SearchIndex::setCurrentDoc(const char *name,const char *url) +void SearchIndex::setCurrentDoc(const char *name,const char *baseName,const char *anchor) { + QCString url=baseName+Config_getString("HTML_FILE_EXTENSION"); + if (anchor) url+=(QCString)"#"+anchor; m_urlIndex++; m_urls.insert(m_urlIndex,new URL(name,url)); } @@ -84,7 +87,7 @@ void SearchIndex::addWord(const char *word) int idx=charsToIndex(word); if (idx<0) return; w = new IndexWord(word); - //printf("addWord(%s) at index %d\n",word,idx); + //fprintf(stderr,"addWord(%s) at index %d\n",word,idx); m_index[idx]->append(w); m_words.insert(word,w); } diff --git a/src/searchindex.h b/src/searchindex.h index 87fcd70..6f4494e 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -57,7 +57,7 @@ class SearchIndex { public: SearchIndex(); - void setCurrentDoc(const char *name,const char *url); + void setCurrentDoc(const char *name,const char *baseName,const char *anchor=0); void addWord(const char *word); void write(const char *file); private: -- cgit v0.12