dgaudet 97/09/15 17:41:35
Modified: src INDENT
src/main explain.c explain.h http_bprintf.c md5.h md5c.c
multithread.h
Log:
indent
Revision Changes Path
1.21 +13 -13 apachen/src/INDENT
Index: INDENT
===================================================================
RCS file: /export/home/cvs/apachen/src/INDENT,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- INDENT 1997/09/16 00:35:39 1.20
+++ INDENT 1997/09/16 00:41:29 1.21
@@ -10,11 +10,11 @@
buff.h DONE by Dean
conf.h DONE by Dean
dummy.c DONE by Dean
- explain.c RESERVED by Dean
- explain.h RESERVED by Dean
+ explain.c DONE by Dean
+ explain.h DONE by Dean
fnmatch.c DONE by Dean
fnmatch.h DONE by Dean
- http_bprintf.c RESERVED by Dean
+ http_bprintf.c DONE by Dean
http_conf_globals.h DONE by Dean
http_config.c DONE by Dean
http_config.h DONE by Dean
@@ -29,9 +29,9 @@
http_request.c DONE by Roy
http_request.h DONE by Roy
httpd.h DONE by Dean
- md5.h RESERVED by Dean
- md5c.c RESERVED by Dean
- multithread.h RESERVED by Dean
+ md5.h DONE by Dean
+ md5c.c DONE by Dean
+ multithread.h DONE by Dean
rfc1413.c DONE by Dean
rfc1413.h DONE by Dean
scoreboard.h DONE by Dean
@@ -48,13 +48,13 @@
mod_example.c DONE by Ken
./modules/proxy:
- mod_proxy.c
- mod_proxy.h
- proxy_cache.c
- proxy_connect.c
- proxy_ftp.c
- proxy_http.c
- proxy_util.c
+ mod_proxy.c RESERVED by Dean
+ mod_proxy.h RESERVED by Dean
+ proxy_cache.c RESERVED by Dean
+ proxy_connect.c RESERVED by Dean
+ proxy_ftp.c RESERVED by Dean
+ proxy_http.c RESERVED by Dean
+ proxy_util.c RESERVED by Dean
./modules/standard:
mod_access.c
1.4 +7 -7 apachen/src/main/explain.c
Index: explain.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/explain.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- explain.c 1996/11/03 21:28:59 1.3
+++ explain.c 1997/09/16 00:41:31 1.4
@@ -2,13 +2,13 @@
#include <stdarg.h>
#include "explain.h"
-void _Explain(const char *szFile,int nLine,const char *szFmt,...)
- {
+void _Explain(const char *szFile, int nLine, const char *szFmt,...)
+{
va_list vlist;
- fprintf(stderr,"%s(%d): ",szFile,nLine);
- va_start(vlist,szFmt);
- vfprintf(stderr,szFmt,vlist);
+ fprintf(stderr, "%s(%d): ", szFile, nLine);
+ va_start(vlist, szFmt);
+ vfprintf(stderr, szFmt, vlist);
va_end(vlist);
- fputc('\n',stderr);
- }
+ fputc('\n', stderr);
+}
1.4 +1 -1 apachen/src/main/explain.h
Index: explain.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/explain.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- explain.h 1996/11/03 21:25:05 1.3
+++ explain.h 1997/09/16 00:41:31 1.4
@@ -9,7 +9,7 @@
#define Explain6(f,a1,a2,a3,a4,a5,a6)
#else
#define DEF_Explain static const char *__ExplainFile=__FILE__;
-void _Explain(const char *szFile,int nLine,const char *szFmt,...);
+void _Explain(const char *szFile, int nLine, const char *szFmt,...);
#define Explain0(f) _Explain(__ExplainFile,__LINE__,f)
#define Explain1(f,a1) _Explain(__ExplainFile,__LINE__,f,a1)
#define Explain2(f,a1,a2) _Explain(__ExplainFile,__LINE__,f,a1,a2)
1.13 +257 -284 apachen/src/main/http_bprintf.c
Index: http_bprintf.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_bprintf.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- http_bprintf.c 1997/07/21 05:53:41 1.12
+++ http_bprintf.c 1997/09/16 00:41:32 1.13
@@ -49,20 +49,20 @@
* both *srcPtr and *destPtr by n.
*/
static void CopyAndAdvance(char **destPtr, const char **srcPtr, int n)
- {
+{
char *dest = *destPtr;
const char *src = *srcPtr;
int i;
-
+
for (i = 0; i < n; i++)
- *dest++ = *src++;
+ *dest++ = *src++;
*destPtr = dest;
*srcPtr = src;
- }
+}
API_EXPORT_NONSTD(int) vbprintf(BUFF *bp, const char *format, va_list arg)
- {
- const char *f,*fStop,*percentPtr,*p;
+{
+ const char *f, *fStop, *percentPtr, *p;
char *fmtBuffPtr, *buffPtr;
int op, performedOp, sizeModifier, buffLen, specifierLength;
int fastPath, n, buffReqd, minWidth, precision, expon;
@@ -88,46 +88,42 @@
LONG_DOUBLE lDoubleArg = 0.0;
fmtBuff[0] = '%';
- f=format;
+ f = format;
fStop = f + strlen(f);
- while (f != fStop)
- {
- percentPtr = memchr(f, '%', fStop - f);
- if(percentPtr == NULL) percentPtr = fStop;
- if(percentPtr != f)
- {
- if(bwrite(bp,f,percentPtr - f) < 0)
+ while (f != fStop) {
+ percentPtr = memchr(f, '%', fStop - f);
+ if (percentPtr == NULL)
+ percentPtr = fStop;
+ if (percentPtr != f) {
+ if (bwrite(bp, f, percentPtr - f) < 0)
goto ErrorReturn;
- streamCount += percentPtr - f;
- f = percentPtr;
- if(f == fStop)
- break;
- }
- fastPath = TRUE;
- /*
- * The following loop always executes either once or twice.
- */
- for (;;)
- {
- if(fastPath)
- {
- /*
- * Fast path: Scan optimistically, hoping that no flags,
- * minimum field width, or precision are specified.
- * Use the preallocated buffer, which is large enough
- * for all fast path cases. If the conversion specifier
- * is really more complex, run the loop a second time
- * using the slow path.
- * Note that fast path execution of %s bypasses the buffer
- * and %f is not attempted on the fast path due to
- * its large buffering requirements.
- */
- op = percentPtr[1];
- switch(op)
- {
- case 'l':
- case 'L':
- case 'h':
+ streamCount += percentPtr - f;
+ f = percentPtr;
+ if (f == fStop)
+ break;
+ }
+ fastPath = TRUE;
+ /*
+ * The following loop always executes either once or twice.
+ */
+ for (;;) {
+ if (fastPath) {
+ /*
+ * Fast path: Scan optimistically, hoping that no flags,
+ * minimum field width, or precision are specified.
+ * Use the preallocated buffer, which is large enough
+ * for all fast path cases. If the conversion specifier
+ * is really more complex, run the loop a second time
+ * using the slow path.
+ * Note that fast path execution of %s bypasses the buffer
+ * and %f is not attempted on the fast path due to
+ * its large buffering requirements.
+ */
+ op = percentPtr[1];
+ switch (op) {
+ case 'l':
+ case 'L':
+ case 'h':
sizeModifier = op;
op = percentPtr[2];
fmtBuff[1] = sizeModifier;
@@ -135,81 +131,77 @@
fmtBuff[3] = '\0';
specifierLength = 3;
break;
- default:
- sizeModifier = ' ';
+ default:
+ sizeModifier = ' ';
fmtBuff[1] = op;
fmtBuff[2] = '\0';
specifierLength = 2;
break;
- }
- buffPtr = buff;
- buffLen = PRINTF_BUFFLEN;
}
- else
- {
- /*
- * Slow path: Scan the conversion specifier and construct
- * a new format string, compute an upper bound on the
- * amount of buffering that sprintf will require,
- * and allocate a larger buffer if necessary.
- */
- p = percentPtr + 1;
- fmtBuffPtr = &fmtBuff[1];
- /*
- * Scan flags
- */
- n = strspn(p, "-0+ #");
- if(n > 5)
+ buffPtr = buff;
+ buffLen = PRINTF_BUFFLEN;
+ }
+ else {
+ /*
+ * Slow path: Scan the conversion specifier and construct
+ * a new format string, compute an upper bound on the
+ * amount of buffering that sprintf will require,
+ * and allocate a larger buffer if necessary.
+ */
+ p = percentPtr + 1;
+ fmtBuffPtr = &fmtBuff[1];
+ /*
+ * Scan flags
+ */
+ n = strspn(p, "-0+ #");
+ if (n > 5)
goto ErrorReturn;
- CopyAndAdvance(&fmtBuffPtr, &p, n);
+ CopyAndAdvance(&fmtBuffPtr, &p, n);
/* Optimiser bug in SCO 5 - p is not advanced here under -O2.
* -K noinline fixes it. Ben.
*/
- /*
- * Scan minimum field width
- */
- n = strspn(p, "0123456789");
- if(n == 0)
- {
- if(*p == '*')
- {
- minWidth = va_arg(arg, int);
- if(abs(minWidth) > 999999) goto ErrorReturn;
+ /*
+ * Scan minimum field width
+ */
+ n = strspn(p, "0123456789");
+ if (n == 0) {
+ if (*p == '*') {
+ minWidth = va_arg(arg, int);
+ if (abs(minWidth) > 999999)
+ goto ErrorReturn;
/*
* The following use of strlen rather than the
* value returned from sprintf is because SUNOS4
* returns a char * instead of an int count.
*/
sprintf(fmtBuffPtr, "%d", minWidth);
- fmtBuffPtr += strlen(fmtBuffPtr);
- p++;
- }
- else
- minWidth = 0;
- }
- else if(n <= 6)
- {
- minWidth = strtol(p, NULL, 10);
- CopyAndAdvance(&fmtBuffPtr, &p, n);
+ fmtBuffPtr += strlen(fmtBuffPtr);
+ p++;
}
+ else
+ minWidth = 0;
+ }
+ else if (n <= 6) {
+ minWidth = strtol(p, NULL, 10);
+ CopyAndAdvance(&fmtBuffPtr, &p, n);
+ }
else
- goto ErrorReturn;
- /*
- * Scan precision
- */
- if(*p == '.')
- {
- p++;
- n = strspn(p, "0123456789");
- if(n == 0)
- {
- if(*p == '*')
- {
- precision = va_arg(arg, int);
- if(precision < 0) precision = 0;
- if(precision > 999999) goto ErrorReturn;
+ goto ErrorReturn;
+ /*
+ * Scan precision
+ */
+ if (*p == '.') {
+ p++;
+ n = strspn(p, "0123456789");
+ if (n == 0) {
+ if (*p == '*') {
+ precision = va_arg(arg, int);
+ if (precision < 0)
+ precision = 0;
+ if (precision > 999999)
+ goto ErrorReturn;
/*
* The following use of strlen rather than the
* value returned from sprintf is because SUNOS4
@@ -217,62 +209,59 @@
*/
sprintf(fmtBuffPtr, ".%d", precision);
fmtBuffPtr += strlen(fmtBuffPtr);
- p++;
- }
- else
- precision = 0;
+ p++;
}
- else if(n <= 6)
- {
- precision = strtol(p, NULL, 10);
- *fmtBuffPtr++='.';
- CopyAndAdvance(&fmtBuffPtr, &p, n);
- }
- else
- goto ErrorReturn;
+ else
+ precision = 0;
+ }
+ else if (n <= 6) {
+ precision = strtol(p, NULL, 10);
+ *fmtBuffPtr++ = '.';
+ CopyAndAdvance(&fmtBuffPtr, &p, n);
}
+ else
+ goto ErrorReturn;
+ }
else
- precision = -1;
- /*
- * Scan size modifier and conversion operation
- */
- switch(*p)
- {
- case 'l':
- case 'L':
- case 'h':
+ precision = -1;
+ /*
+ * Scan size modifier and conversion operation
+ */
+ switch (*p) {
+ case 'l':
+ case 'L':
+ case 'h':
sizeModifier = *p;
CopyAndAdvance(&fmtBuffPtr, &p, 1);
break;
-
- default:
- sizeModifier = ' ';
+
+ default:
+ sizeModifier = ' ';
break;
- }
- op = *p;
- CopyAndAdvance(&fmtBuffPtr, &p, 1);
- ap_assert(fmtBuffPtr - fmtBuff < FMT_BUFFLEN);
- *fmtBuffPtr = '\0';
+ }
+ op = *p;
+ CopyAndAdvance(&fmtBuffPtr, &p, 1);
+ ap_assert(fmtBuffPtr - fmtBuff < FMT_BUFFLEN);
+ *fmtBuffPtr = '\0';
+ /*
+ bwrite(bp,"[",1);
+ bwrite(bp,fmtBuff,strlen(fmtBuff));
+ bwrite(bp,"]",1);
+ */
+ specifierLength = p - percentPtr;
/*
- bwrite(bp,"[",1);
- bwrite(bp,fmtBuff,strlen(fmtBuff));
- bwrite(bp,"]",1);
- */
- specifierLength = p - percentPtr;
- /*
- * Bound the required buffer size. For s and f
- * conversions this requires examining the argument.
- */
- switch(op)
- {
- case 'd':
- case 'i':
- case 'u':
- case 'o':
- case 'x':
- case 'X':
- case 'c':
- case 'p':
+ * Bound the required buffer size. For s and f
+ * conversions this requires examining the argument.
+ */
+ switch (op) {
+ case 'd':
+ case 'i':
+ case 'u':
+ case 'o':
+ case 'x':
+ case 'X':
+ case 'c':
+ case 'p':
buffReqd = max(precision, 46);
break;
@@ -281,151 +270,143 @@
if (charPtrArg == NULL) {
charPtrArg = NULL_STRING;
};
- if(precision == -1)
+ if (precision == -1)
buffReqd = strlen(charPtrArg);
- else
- {
+ else {
p = memchr(charPtrArg, '\0', precision);
if (p == NULL)
- buffReqd = precision;
+ buffReqd = precision;
else
- buffReqd = p - charPtrArg;
- }
+ buffReqd = p - charPtrArg;
+ }
break;
- case 'f':
- switch(sizeModifier)
- {
+ case 'f':
+ switch (sizeModifier) {
case ' ':
- doubleArg = va_arg(arg, double);
+ doubleArg = va_arg(arg, double);
frexp(doubleArg, &expon);
break;
case 'L':
- lDoubleArg = va_arg(arg, LONG_DOUBLE);
+ lDoubleArg = va_arg(arg, LONG_DOUBLE);
frexp(lDoubleArg, &expon);
break;
- default:
- goto ErrorReturn;
- }
- if(precision == -1)
+ default:
+ goto ErrorReturn;
+ }
+ if (precision == -1)
precision = 6;
- buffReqd = precision + 3 + ((expon > 0) ? expon/3 : 0);
+ buffReqd = precision + 3 + ((expon > 0) ? expon / 3 : 0);
break;
-
+
case 'e':
- case 'E':
- case 'g':
- case 'G':
- if(precision == -1)
+ case 'E':
+ case 'g':
+ case 'G':
+ if (precision == -1)
precision = 6;
buffReqd = precision + 8;
break;
- case 'n':
- case '%':
- default:
- goto ErrorReturn;
- }
- buffReqd = max(buffReqd + 10, minWidth);
- /*
- * Allocate the buffer
- */
- if(buffReqd <= PRINTF_BUFFLEN)
- {
- buffPtr = buff;
+ case 'n':
+ case '%':
+ default:
+ goto ErrorReturn;
+ }
+ buffReqd = max(buffReqd + 10, minWidth);
+ /*
+ * Allocate the buffer
+ */
+ if (buffReqd <= PRINTF_BUFFLEN) {
+ buffPtr = buff;
buffLen = PRINTF_BUFFLEN;
- }
- else
- {
- if(auxBuffPtr == NULL || buffReqd > auxBuffLen)
- {
- if(auxBuffPtr != NULL) free(auxBuffPtr);
- auxBuffPtr = malloc(buffReqd);
- auxBuffLen = buffReqd;
- if(auxBuffPtr == NULL)
+ }
+ else {
+ if (auxBuffPtr == NULL || buffReqd > auxBuffLen) {
+ if (auxBuffPtr != NULL)
+ free(auxBuffPtr);
+ auxBuffPtr = malloc(buffReqd);
+ auxBuffLen = buffReqd;
+ if (auxBuffPtr == NULL)
goto ErrorReturn;
- }
- buffPtr = auxBuffPtr;
- buffLen = auxBuffLen;
}
+ buffPtr = auxBuffPtr;
+ buffLen = auxBuffLen;
}
- /*
- * This giant switch statement requires the following variables
- * to be set up: op, sizeModifier, arg, buffPtr, fmtBuff.
- * When fastPath == FALSE and op == 's' or 'f', the argument
- * has been read into charPtrArg, doubleArg, or lDoubleArg.
- * The statement produces the boolean performedOp, TRUE iff
- * the op/sizeModifier were executed and argument consumed;
- * if performedOp, the characters written into buffPtr[]
- * and the character count buffCount (== EOF meaning error).
- *
- * The switch cases are arranged in the same order as in the
- * description of fprintf in section 15.11 of Harbison and
Steele.
- */
- performedOp = TRUE;
- switch(op)
- {
+ }
+ /*
+ * This giant switch statement requires the following variables
+ * to be set up: op, sizeModifier, arg, buffPtr, fmtBuff.
+ * When fastPath == FALSE and op == 's' or 'f', the argument
+ * has been read into charPtrArg, doubleArg, or lDoubleArg.
+ * The statement produces the boolean performedOp, TRUE iff
+ * the op/sizeModifier were executed and argument consumed;
+ * if performedOp, the characters written into buffPtr[]
+ * and the character count buffCount (== EOF meaning error).
+ *
+ * The switch cases are arranged in the same order as in the
+ * description of fprintf in section 15.11 of Harbison and Steele.
+ */
+ performedOp = TRUE;
+ switch (op) {
case 'd':
case 'i':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
intArg = va_arg(arg, int);
sprintf(buffPtr, fmtBuff, intArg);
buffCount = strlen(buffPtr);
break;
-
+
case 'l':
longArg = va_arg(arg, long);
sprintf(buffPtr, fmtBuff, longArg);
buffCount = strlen(buffPtr);
break;
-
+
case 'h':
shortArg = va_arg(arg, short);
sprintf(buffPtr, fmtBuff, shortArg);
buffCount = strlen(buffPtr);
break;
-
- default:
- goto ErrorReturn;
- }
+
+ default:
+ goto ErrorReturn;
+ }
break;
case 'u':
case 'o':
case 'x':
case 'X':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
unsignedArg = va_arg(arg, unsigned);
sprintf(buffPtr, fmtBuff, unsignedArg);
buffCount = strlen(buffPtr);
break;
-
+
case 'l':
uLongArg = va_arg(arg, unsigned long);
sprintf(buffPtr, fmtBuff, uLongArg);
buffCount = strlen(buffPtr);
break;
-
+
case 'h':
uShortArg = va_arg(arg, unsigned short);
sprintf(buffPtr, fmtBuff, uShortArg);
buffCount = strlen(buffPtr);
break;
-
- default:
- goto ErrorReturn;
- }
+
+ default:
+ goto ErrorReturn;
+ }
break;
case 'c':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
intArg = va_arg(arg, int);
sprintf(buffPtr, fmtBuff, intArg);
@@ -439,29 +420,26 @@
*/
goto ErrorReturn;
- default:
- goto ErrorReturn;
- }
+ default:
+ goto ErrorReturn;
+ }
break;
case 's':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
- if(fastPath)
- {
+ if (fastPath) {
buffPtr = va_arg(arg, char *);
if (buffPtr == NULL) {
buffPtr = NULL_STRING;
};
buffCount = strlen(buffPtr);
buffLen = buffCount + 1;
- }
- else
- {
+ }
+ else {
sprintf(buffPtr, fmtBuff, charPtrArg);
buffCount = strlen(buffPtr);
- }
+ }
break;
case 'l':
@@ -472,13 +450,13 @@
*/
goto ErrorReturn;
- default:
- goto ErrorReturn;
- }
+ default:
+ goto ErrorReturn;
+ }
break;
case 'p':
- if(sizeModifier != ' ')
+ if (sizeModifier != ' ')
goto ErrorReturn;
voidPtrArg = va_arg(arg, void *);
sprintf(buffPtr, fmtBuff, voidPtrArg);
@@ -486,8 +464,7 @@
break;
case 'n':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
intPtrArg = va_arg(arg, int *);
*intPtrArg = streamCount;
@@ -503,21 +480,19 @@
*shortPtrArg = streamCount;
break;
- default:
- goto ErrorReturn;
- }
+ default:
+ goto ErrorReturn;
+ }
buffCount = 0;
break;
case 'f':
- if(fastPath)
- {
+ if (fastPath) {
performedOp = FALSE;
break;
- }
+ }
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
sprintf(buffPtr, fmtBuff, doubleArg);
buffCount = strlen(buffPtr);
@@ -528,9 +503,9 @@
buffCount = strlen(buffPtr);
break;
- default:
- goto ErrorReturn;
- }
+ default:
+ goto ErrorReturn;
+ }
break;
/* FIXME: Used to flow through here? Should it? Ben */
@@ -538,8 +513,7 @@
case 'E':
case 'g':
case 'G':
- switch(sizeModifier)
- {
+ switch (sizeModifier) {
case ' ':
doubleArg = va_arg(arg, double);
sprintf(buffPtr, fmtBuff, doubleArg);
@@ -552,13 +526,13 @@
buffCount = strlen(buffPtr);
break;
- default:
- goto ErrorReturn;
- }
+ default:
+ goto ErrorReturn;
+ }
break;
case '%':
- if(sizeModifier != ' ')
+ if (sizeModifier != ' ')
goto ErrorReturn;
buff[0] = '%';
buffCount = 1;
@@ -567,33 +541,32 @@
case '\0':
goto ErrorReturn;
- default:
- performedOp = FALSE;
+ default:
+ performedOp = FALSE;
break;
- } /* switch(op) */
+ } /* switch(op) */
- if(performedOp)
+ if (performedOp)
break;
- if(!fastPath)
+ if (!fastPath)
goto ErrorReturn;
- fastPath = FALSE;
- } /* for (;;) */
- ap_assert(buffCount < buffLen);
- if(buffCount > 0)
- {
- if(bwrite(bp,buffPtr,buffCount) < 0)
- goto ErrorReturn;
- streamCount += buffCount;
- }
- else if(buffCount < 0)
- goto ErrorReturn;
- f += specifierLength;
- } /* while(f != fStop) */
+ fastPath = FALSE;
+ } /* for (;;) */
+ ap_assert(buffCount < buffLen);
+ if (buffCount > 0) {
+ if (bwrite(bp, buffPtr, buffCount) < 0)
+ goto ErrorReturn;
+ streamCount += buffCount;
+ }
+ else if (buffCount < 0)
+ goto ErrorReturn;
+ f += specifierLength;
+ } /* while(f != fStop) */
goto NormalReturn;
-ErrorReturn:
- streamCount = -1;
-NormalReturn:
- if(auxBuffPtr != NULL)
+ ErrorReturn:
+ streamCount = -1;
+ NormalReturn:
+ if (auxBuffPtr != NULL)
free(auxBuffPtr);
return streamCount;
- }
+}
1.7 +24 -24 apachen/src/main/md5.h
Index: md5.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/md5.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- md5.h 1997/09/02 16:12:09 1.6
+++ md5.h 1997/09/16 00:41:32 1.7
@@ -7,25 +7,25 @@
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
+ 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.
+ 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.
+ These notices must be retained in any copies of any part of this
+ documentation and/or software.
*/
/* ====================================================================
@@ -88,12 +88,12 @@
/* 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 */
+ UINT4 state[4]; /* state (ABCD) */
+ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
+ unsigned char buffer[64]; /* input buffer */
} AP_MD5_CTX;
-API_EXPORT(void) MD5Init(AP_MD5_CTX *context);
-API_EXPORT(void) MD5Update(AP_MD5_CTX *context, const unsigned char *input,
- unsigned int inputLen);
-API_EXPORT(void) MD5Final(unsigned char digest[16], AP_MD5_CTX *context);
+API_EXPORT(void) MD5Init(AP_MD5_CTX * context);
+API_EXPORT(void) MD5Update(AP_MD5_CTX * context, const unsigned char *input,
+ unsigned int inputLen);
+API_EXPORT(void) MD5Final(unsigned char digest[16], AP_MD5_CTX * context);
1.8 +129 -134 apachen/src/main/md5c.c
Index: md5c.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/md5c.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- md5c.c 1997/09/02 16:12:09 1.7
+++ md5c.c 1997/09/16 00:41:33 1.8
@@ -10,25 +10,25 @@
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
+ 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.
+ 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.
+ These notices must be retained in any copies of any part of this
+ documentation and/or software.
*/
/* ====================================================================
@@ -133,7 +133,7 @@
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
+ Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
@@ -158,10 +158,10 @@
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
-API_EXPORT(void) MD5Init(AP_MD5_CTX *context)
+API_EXPORT(void) MD5Init(AP_MD5_CTX * context)
{
context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants. */
+ /* Load magic initialization constants. */
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
@@ -169,27 +169,26 @@
}
/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
+ operation, processing another message block, and updating the
+ context.
*/
-API_EXPORT(void) MD5Update(AP_MD5_CTX *context, const unsigned char *input,
- unsigned int inputLen)
+API_EXPORT(void) MD5Update(AP_MD5_CTX * context, const unsigned char *input,
+ unsigned int inputLen)
{
unsigned int i, idx, partLen;
- /* Compute number of bytes mod 64 */
- idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
+ /* Compute number of bytes mod 64 */
+ idx = (unsigned int) ((context->count[0] >> 3) & 0x3F);
- /* Update number of bits */
- if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen <<
3))
+ /* Update number of bits */
+ if ((context->count[0] += ((UINT4) inputLen << 3)) < ((UINT4) inputLen
<< 3))
context->count[1]++;
- context->count[1] += (UINT4)inputLen >> 29;
+ context->count[1] += (UINT4) inputLen >> 29;
partLen = 64 - idx;
- /* Transform as many times as possible. */
- if (inputLen >= partLen)
- {
+ /* Transform as many times as possible. */
+ if (inputLen >= partLen) {
memcpy(&context->buffer[idx], input, partLen);
MD5Transform(context->state, context->buffer);
@@ -201,153 +200,149 @@
else
i = 0;
- /* Buffer remaining input */
- memcpy(&context->buffer[idx], &input[i], inputLen-i);
+ /* Buffer remaining input */
+ memcpy(&context->buffer[idx], &input[i], inputLen - i);
}
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
+ the message digest and zeroizing the context.
*/
-API_EXPORT(void) MD5Final(unsigned char digest[16], AP_MD5_CTX *context)
+API_EXPORT(void) MD5Final(unsigned char digest[16], AP_MD5_CTX * context)
{
unsigned char bits[8];
unsigned int idx, padLen;
- /* Save number of bits */
- Encode (bits, context->count, 8);
+ /* Save number of bits */
+ Encode(bits, context->count, 8);
- /* Pad out to 56 mod 64. */
- idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
+ /* Pad out to 56 mod 64. */
+ idx = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (idx < 56) ? (56 - idx) : (120 - idx);
MD5Update(context, PADDING, padLen);
- /* Append length (before padding) */
+ /* Append length (before padding) */
MD5Update(context, bits, 8);
- /* Store state in digest */
+ /* Store state in digest */
Encode(digest, context->state, 16);
- /* Zeroize sensitive information. */
- memset(context, 0, sizeof (*context));
+ /* Zeroize sensitive information. */
+ memset(context, 0, sizeof(*context));
}
/* MD5 basic transformation. Transforms state based on block. */
-static void
-MD5Transform(UINT4 state[4], const unsigned char block[64])
+static void MD5Transform(UINT4 state[4], const unsigned char block[64])
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
- Decode (x, block, 64);
+ 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 */
+ /* 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;
- /* Zeroize sensitive information. */
- memset(x, 0, sizeof (x));
+ /* Zeroize sensitive information. */
+ memset(x, 0, sizeof(x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
+ a multiple of 4.
*/
-static void
-Encode(unsigned char *output, const UINT4 *input, unsigned int len)
+static void Encode(unsigned char *output, const UINT4 *input, unsigned int
len)
{
unsigned int i, j;
UINT4 k;
- for (i = 0, j = 0; j < len; i++, j += 4)
- {
+ for (i = 0, j = 0; j < len; i++, j += 4) {
k = input[i];
- output[j] = (unsigned char)(k & 0xff);
- output[j+1] = (unsigned char)((k >> 8) & 0xff);
- output[j+2] = (unsigned char)((k >> 16) & 0xff);
- output[j+3] = (unsigned char)((k >> 24) & 0xff);
+ output[j] = (unsigned char) (k & 0xff);
+ output[j + 1] = (unsigned char) ((k >> 8) & 0xff);
+ output[j + 2] = (unsigned char) ((k >> 16) & 0xff);
+ output[j + 3] = (unsigned char) ((k >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
+ a multiple of 4.
*/
-static void
-Decode(UINT4 *output, const unsigned char *input, unsigned int len)
+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);
+ output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) |
+ (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24);
}
1.6 +1 -4 apachen/src/main/multithread.h
Index: multithread.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/multithread.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- multithread.h 1997/07/19 20:16:15 1.5
+++ multithread.h 1997/09/16 00:41:33 1.6
@@ -17,20 +17,18 @@
#ifdef MULTITHREAD
#define APACHE_TLS __declspec( thread )
-thread *create_thread(void (thread_fn)(void *thread_arg), void *thread_arg);
+thread *create_thread(void (thread_fn) (void *thread_arg), void *thread_arg);
int kill_thread(thread *thread_id);
int await_thread(thread *thread_id, int sec_to_wait);
void exit_thread(int status);
void free_thread(thread *thread_id);
-
API_EXPORT(mutex *) create_mutex(char *name);
API_EXPORT(mutex *) open_mutex(char *name);
API_EXPORT(int) acquire_mutex(mutex *mutex_id);
API_EXPORT(int) release_mutex(mutex *mutex_id);
API_EXPORT(void) destroy_mutex(mutex *mutex_id);
-
semaphore *create_semaphore(int initial);
int acquire_semaphore(semaphore *semaphore_id);
int release_semaphore(semaphore *semaphore_id);
@@ -56,4 +54,3 @@
#endif /* ndef MULTITHREAD */
#endif /* ndef MULTITHREAD_H */
-