+2006-01-17 Vincent Jardin <vincent.jardin@6wind.com>
+
+ * md5.c: Don't forget to keep const.
+ * regex.c: Cleanup code and remove warnings.
+
2006-01-17 Paul Jakma <paul.jakma@sun.com>
* md5.{c,h}: (md5_loop) Is better off taking a void * and doing
/* $USAGI: md5.c,v 1.2 2000/11/02 11:59:24 yoshfuji Exp $ */
/* $KAME: md5.c,v 1.2 2000/05/27 07:07:48 jinmei Exp $ */
-/* $Id: md5.c,v 1.5 2006/01/17 17:40:45 paul Exp $ */
+/* $Id: md5.c,v 1.6 2006/01/17 23:39:04 vincent Exp $ */
/*
* Copyright (C) 2004 6WIND
void md5_loop(md5_ctxt *ctxt, const void *vinput, uint len)
{
uint gap, i;
- uint8_t *input = vinput;
+ const uint8_t *input = vinput;
ctxt->md5_n += len * 8; /* byte to bit */
gap = MD5_BUFLEN - ctxt->md5_i;
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#ifdef _WIN32
+/* Windows does not provide unistd.h, which is required for abort() */
+#include <process.h>
+#endif /* _WIN32 */
#ifndef PARAMS
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
gettext_noop ("Invalid regular expression") /* REG_BADPAT */
"\0"
#define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression")
- gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
+ gettext_noop ("Invalid collation character") /* REG_ECOLLATE */
"\0"
#define REG_ECTYPE_IDX (REG_ECOLLATE_IDX + sizeof "Invalid collation character")
gettext_noop ("Invalid character class name") /* REG_ECTYPE */
MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
reallocating to 0 bytes. Such thing is not going to work too well.
You have been warned!! */
-#if defined _MSC_VER && !defined WIN32
+#if defined _MSC_VER && !defined _WIN32
/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
The REALLOC define eliminates a flurry of conversion warnings,
but is not required. */
from either regcomp or regexec. We don't use PREG here. */
size_t
-regerror (errcode, preg, errbuf, errbuf_size)
- int errcode;
+regerror (err, preg, errbuf, errbuf_size)
+ int err;
const regex_t *preg;
char *errbuf;
size_t errbuf_size;
const char *msg;
size_t msg_size;
- if (errcode < 0
- || errcode >= (int) (sizeof (re_error_msgid_idx)
+ if (err < 0
+ || err >= (int) (sizeof (re_error_msgid_idx)
/ sizeof (re_error_msgid_idx[0])))
/* Only error codes returned by the rest of the code should be passed
to this routine. If we are given anything else, or if other regex
Dump core so we can fix it. */
abort ();
- msg = gettext (re_error_msgid + re_error_msgid_idx[errcode]);
+ msg = gettext (re_error_msgid + re_error_msgid_idx[err]);
msg_size = strlen (msg) + 1; /* Includes the null. */