/* open a dbf-file, get it's field-info and store this information */
dbhead *
-dbf_open(u_char *file, int flags)
+dbf_open(char *file, int flags)
{
int file_no;
dbhead *dbh;
}
int
-dbf_add_field(dbhead * dbh, u_char *name, u_char type,
+dbf_add_field(dbhead * dbh, char *name, u_char type,
u_char length, u_char dec)
{
f_descr *ptr;
}
dbhead *
-dbf_open_new(u_char *name, int flags)
+dbf_open_new(char *name, int flags)
{
dbhead *dbh;
end--;
i--;
}
- strncpy(fields[t].db_contents, dbffield, i);
+ strncpy((char *) fields[t].db_contents, (char *) dbffield, i);
fields[t].db_contents[i] = '\0';
}
else
end++;
i--;
}
- strncpy(fields[t].db_contents, end, i);
+ strncpy((char *) fields[t].db_contents, (char *) end, i);
fields[t].db_contents[i] = '\0';
}
u_char *data,
end = 0x1a;
double fl;
- u_char foo[128],
+ char foo[128],
format[32];
/* offset: offset in file for this record
/* Handle text */
if (rec[t].db_type == 'C')
{
- if (strlen(rec[t].db_contents) > rec[t].db_flen)
+ if (strlen((char *) rec[t].db_contents) > rec[t].db_flen)
length = rec[t].db_flen;
else
- length = strlen(rec[t].db_contents);
- strncpy(data + idx, rec[t].db_contents, length);
+ length = strlen((char *) rec[t].db_contents);
+ strncpy((char *) data + idx, (char *) rec[t].db_contents,
+ length);
}
else
{
/* Numeric is special, because of real numbers */
if ((rec[t].db_type == 'N') && (rec[t].db_dec != 0))
{
- fl = atof(rec[t].db_contents);
+ fl = atof((char *) rec[t].db_contents);
snprintf(format, 32, "%%.%df", rec[t].db_dec);
snprintf(foo, 128, format, fl);
}
else
- strncpy(foo, rec[t].db_contents, 128);
+ strncpy(foo, (char *) rec[t].db_contents, 128);
if (strlen(foo) > rec[t].db_flen)
length = rec[t].db_flen;
else
length = strlen(foo);
h = rec[t].db_flen - length;
- strncpy(data + idx + h, foo, length);
+ strncpy((char *) (data + idx + h), foo, length);
}
}
idx += rec[t].db_flen;
typedef struct
{
- u_char dbf_name[DBF_NAMELEN]; /* field-name terminated with \0 */
+ char dbf_name[DBF_NAMELEN]; /* field-name terminated with \0 */
u_char dbf_type; /* field-type */
u_char dbf_reserved[4]; /* some reserved stuff */
u_char dbf_flen; /* field-length */
typedef struct
{
- u_char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
+ char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
u_char db_type; /* field-type */
u_char db_flen; /* field-length */
u_char db_dec; /* number of decimal positions */
typedef struct
{
- u_char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
+ char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
u_char db_type; /* field-type */
u_char db_flen; /* field-length */
u_char db_dec; /* number of decimal positions */
/* prototypes for functions */
-extern dbhead *dbf_open(u_char *file, int flags);
+extern dbhead *dbf_open(char *file, int flags);
extern int dbf_write_head(dbhead * dbh);
extern int dbf_put_fields(dbhead * dbh);
-extern int dbf_add_field(dbhead * dbh, u_char *name, u_char type,
+extern int dbf_add_field(dbhead * dbh, char *name, u_char type,
u_char length, u_char dec);
-extern dbhead *dbf_open_new(u_char *name, int flags);
+extern dbhead *dbf_open_new(char *name, int flags);
extern void dbf_close(dbhead * dbh);
extern int dbf_get_record(dbhead * dbh, field * fields, u_long rec);
extern field *dbf_build_record(dbhead * dbh);
* separator */
if (upper)
- strtoupper(fields[h].db_contents);
+ strtoupper((char *) fields[h].db_contents);
if (lower)
- strtolower(fields[h].db_contents);
+ strtolower((char *) fields[h].db_contents);
- foo = fields[h].db_contents;
+ foo = (char *) fields[h].db_contents;
#ifdef HAVE_ICONV_H
if (charset_from)
foo = convert_charset(foo);
cur->totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len);
lrptr->len = lptr->len;
lrptr->flag = lptr->flag;
- lrptr->val = ltree_crc32_sz((uint8 *) lptr->start, lptr->len);
+ lrptr->val = ltree_crc32_sz(lptr->start, lptr->len);
memcpy(lrptr->name, lptr->start, lptr->len);
lptr++;
lrptr = LVAR_NEXT(lrptr);
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("word is too long")));
- pushquery(state, type, ltree_crc32_sz((uint8 *) strval, lenval),
+ pushquery(state, type, ltree_crc32_sz(strval, lenval),
state->curop - state->op, lenval, flag);
while (state->curop - state->op + lenval + 1 >= state->lenop)
r0,
r1,
keybuf[2];
- uint8 *p,
- *q;
- static uint8 output[21];
+ char *p;
+ uint8 *q;
+ static char output[21];
if (!des_initialised)
des_init();
if ((*q++ = *key << 1))
key++;
}
- if (des_setkey((uint8 *) keybuf))
+ if (des_setkey((char *) keybuf))
return (NULL);
#ifndef DISABLE_XDES
/*
* Encrypt the key with itself.
*/
- if (des_cipher((uint8 *) keybuf, (uint8 *) keybuf, 0L, 1))
+ if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1))
return (NULL);
/*
while (q - (uint8 *) keybuf - 8 && *key)
*q++ ^= *key++ << 1;
- if (des_setkey((uint8 *) keybuf))
+ if (des_setkey((char *) keybuf))
return (NULL);
}
strncpy(output, setting, 9);
*
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.4 2005/07/11 15:07:59 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
err = px_find_digest("md5", &ctx1);
/* The password first, since that is what is most unknown */
- px_md_update(ctx, pw, strlen(pw));
+ px_md_update(ctx, (uint8 *) pw, strlen(pw));
/* Then our magic string */
- px_md_update(ctx, magic, strlen(magic));
+ px_md_update(ctx, (uint8 *) magic, strlen(magic));
/* Then the raw salt */
- px_md_update(ctx, sp, sl);
+ px_md_update(ctx, (uint8 *) sp, sl);
/* Then just as many characters of the MD5(pw,salt,pw) */
- px_md_update(ctx1, pw, strlen(pw));
- px_md_update(ctx1, sp, sl);
- px_md_update(ctx1, pw, strlen(pw));
+ px_md_update(ctx1, (uint8 *) pw, strlen(pw));
+ px_md_update(ctx1, (uint8 *) sp, sl);
+ px_md_update(ctx1, (uint8 *) pw, strlen(pw));
px_md_finish(ctx1, final);
for (pl = strlen(pw); pl > 0; pl -= MD5_SIZE)
px_md_update(ctx, final, pl > MD5_SIZE ? MD5_SIZE : pl);
if (i & 1)
px_md_update(ctx, final, 1);
else
- px_md_update(ctx, pw, 1);
+ px_md_update(ctx, (uint8 *) pw, 1);
/* Now make the output string */
strcpy(passwd, magic);
{
px_md_reset(ctx1);
if (i & 1)
- px_md_update(ctx1, pw, strlen(pw));
+ px_md_update(ctx1, (uint8 *) pw, strlen(pw));
else
px_md_update(ctx1, final, MD5_SIZE);
if (i % 3)
- px_md_update(ctx1, sp, sl);
+ px_md_update(ctx1, (uint8 *) sp, sl);
if (i % 7)
- px_md_update(ctx1, pw, strlen(pw));
+ px_md_update(ctx1, (uint8 *) pw, strlen(pw));
if (i & 1)
px_md_update(ctx1, final, MD5_SIZE);
else
- px_md_update(ctx1, pw, strlen(pw));
+ px_md_update(ctx1, (uint8 *) pw, strlen(pw));
px_md_finish(ctx1, final);
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.18 2005/03/21 05:19:55 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.19 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
arg = PG_GETARG_BYTEA_P(0);
len = VARSIZE(arg) - VARHDRSZ;
- px_md_update(md, VARDATA(arg), len);
- px_md_finish(md, VARDATA(res));
+ px_md_update(md, (uint8 *) VARDATA(arg), len);
+ px_md_finish(md, (uint8 *) VARDATA(res));
px_md_free(md);
PG_FREE_IF_COPY(arg, 0);
len = VARSIZE(arg) - VARHDRSZ;
klen = VARSIZE(key) - VARHDRSZ;
- px_hmac_init(h, VARDATA(key), klen);
- px_hmac_update(h, VARDATA(arg), len);
- px_hmac_finish(h, VARDATA(res));
+ px_hmac_init(h, (uint8 *) VARDATA(key), klen);
+ px_hmac_update(h, (uint8 *) VARDATA(arg), len);
+ px_hmac_finish(h, (uint8 *) VARDATA(res));
px_hmac_free(h);
PG_FREE_IF_COPY(arg, 0);
rlen = px_combo_encrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
- err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
+ err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
if (!err)
- err = px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
+ err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
+ (uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
PG_FREE_IF_COPY(data, 0);
rlen = px_combo_decrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
- err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
+ err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
if (!err)
- err = px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
+ err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
+ (uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
rlen = px_combo_encrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
- err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
+ err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
+ (uint8 *) VARDATA(iv), ivlen);
if (!err)
- px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
+ px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
+ (uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
rlen = px_combo_decrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
- err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
+ err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
+ (uint8 *) VARDATA(iv), ivlen);
if (!err)
- px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
+ px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
+ (uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.4 2005/07/18 17:09:01 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
break;
}
if (res >= 0 && got_cr)
- res = mbuf_append(dst, "\r", 1);
+ res = mbuf_append(dst, (const uint8 *) "\r", 1);
return res;
}
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.4 2005/08/13 02:06:20 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
uint8 sha1[20];
px_md_reset(md);
- px_md_update(md, VARDATA(data), VARSIZE(data) - VARHDRSZ);
+ px_md_update(md, (uint8 *) VARDATA(data), VARSIZE(data) - VARHDRSZ);
px_md_finish(md, sha1);
px_add_entropy(sha1, 20);
int src_len = VARSIZE(src) - VARHDRSZ;
int dst_len;
unsigned char *dst;
- unsigned char *csrc = VARDATA(src);
+ unsigned char *csrc = (unsigned char *) VARDATA(src);
text *res;
dst = pg_do_encoding_conversion(csrc, src_len, cset_from, cset_to);
if (dst == csrc)
return src;
- dst_len = strlen(dst);
+ dst_len = strlen((char *) dst);
res = palloc(dst_len + VARHDRSZ);
memcpy(VARDATA(res), dst, dst_len);
VARATT_SIZEP(res) = VARHDRSZ + dst_len;
static MBuf *
create_mbuf_from_vardata(text *data)
{
- return mbuf_create_from_data(VARDATA(data), VARSIZE(data) - VARHDRSZ);
+ return mbuf_create_from_data((uint8 *) VARDATA(data),
+ VARSIZE(data) - VARHDRSZ);
}
static void
fill_expect(ex, is_text);
if (err == 0 && args != NULL)
- err = parse_args(*ctx_p, VARDATA(args), VARSIZE(args) - VARHDRSZ, ex);
+ err = parse_args(*ctx_p, (uint8 *) VARDATA(args),
+ VARSIZE(args) - VARHDRSZ, ex);
if (err)
{
mbuf_free(kbuf);
}
else
- err = pgp_set_symkey(ctx, VARDATA(key), VARSIZE(key) - VARHDRSZ);
+ err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
+ VARSIZE(key) - VARHDRSZ);
/*
* encrypt
init_work(&ctx, need_text, args, &ex);
- src = mbuf_create_from_data(VARDATA(data), VARSIZE(data) - VARHDRSZ);
+ src = mbuf_create_from_data((uint8 *) VARDATA(data),
+ VARSIZE(data) - VARHDRSZ);
dst = mbuf_create(VARSIZE(data) + 2048);
/*
MBuf *kbuf;
if (keypsw)
{
- psw = VARDATA(keypsw);
+ psw = (uint8 *) VARDATA(keypsw);
psw_len = VARSIZE(keypsw) - VARHDRSZ;
}
kbuf = create_mbuf_from_vardata(key);
mbuf_free(kbuf);
}
else
- err = pgp_set_symkey(ctx, VARDATA(key), VARSIZE(key) - VARHDRSZ);
+ err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
+ VARSIZE(key) - VARHDRSZ);
/*
* decrypt
guess_len = pgp_armor_enc_len(data_len);
res = palloc(VARHDRSZ + guess_len);
- res_len = pgp_armor_encode(VARDATA(data), data_len, VARDATA(res));
+ res_len = pgp_armor_encode((uint8 *) VARDATA(data), data_len,
+ (uint8 *) VARDATA(res));
if (res_len > guess_len)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
guess_len = pgp_armor_dec_len(data_len);
res = palloc(VARHDRSZ + guess_len);
- res_len = pgp_armor_decode(VARDATA(data), data_len, VARDATA(res));
+ res_len = pgp_armor_decode((uint8 *) VARDATA(data), data_len,
+ (uint8 *) VARDATA(res));
if (res_len < 0)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.13 2005/08/13 02:06:20 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.14 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
return PXE_BAD_SALT_ROUNDS;
}
- res = px_get_pseudo_random_bytes(rbuf, g->input_len);
+ res = px_get_pseudo_random_bytes((uint8 *) rbuf, g->input_len);
if (res < 0)
return res;
}
else
{
- SN_set_current(d->z, strlen(txt), txt);
+ SN_set_current(d->z, strlen(txt), (symbol *) txt);
(d->stem) (d->z);
if (d->z->p && d->z->l)
{
len = val->size;
while (len--)
{
- *arr = crc32_sz((uint8 *) &words[ptr->pos], ptr->len);
+ *arr = crc32_sz(&words[ptr->pos], ptr->len);
arr++;
ptr++;
}
return d;
}
-/* backward string compaire for suffix tree operations */
+/* backward string compare for suffix tree operations */
static int
strbcmp(const unsigned char *s1, const unsigned char *s2)
{
- int l1 = strlen(s1) - 1,
- l2 = strlen(s2) - 1;
+ int l1 = strlen((const char *) s1) - 1,
+ l2 = strlen((const char *) s2) - 1;
while (l1 >= 0 && l2 >= 0)
{
static int
strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count)
{
- int l1 = strlen(s1) - 1,
- l2 = strlen(s2) - 1,
+ int l1 = strlen((const char *) s1) - 1,
+ l2 = strlen((const char *) s2) - 1,
l = count;
while (l1 >= 0 && l2 >= 0 && l > 0)
static int
cmpaffix(const void *s1, const void *s2)
{
- if (((const AFFIX *) s1)->type < ((const AFFIX *) s2)->type)
+ const AFFIX *a1 = (const AFFIX *) s1;
+ const AFFIX *a2 = (const AFFIX *) s2;
+
+ if (a1->type < a2->type)
return -1;
- if (((const AFFIX *) s1)->type > ((const AFFIX *) s2)->type)
+ if (a1->type > a2->type)
return 1;
- if (((const AFFIX *) s1)->type == FF_PREFIX)
- return (strcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl));
+ if (a1->type == FF_PREFIX)
+ return strcmp(a1->repl, a2->repl);
else
- return (strbcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl));
+ return strbcmp((const unsigned char *) a1->repl,
+ (const unsigned char *) a2->repl);
}
int
int
NIImportDictionary(IspellDict * Conf, const char *filename)
{
- unsigned char str[BUFSIZ];
+ char str[BUFSIZ];
FILE *dict;
if (!(dict = fopen(filename, "r")))
return (1);
while (fgets(str, sizeof(str), dict))
{
- unsigned char *s;
- const unsigned char *flag;
+ char *s;
+ const char *flag;
flag = NULL;
if ((s = strchr(str, '/')))
{
- *s = 0;
- s++;
+ *s++ = '\0';
flag = s;
while (*s)
{
- if (isprint(*s) && !isspace(*s))
+ if (isprint((unsigned char) *s) &&
+ !isspace((unsigned char) *s))
s++;
else
{
- *s = 0;
+ *s = '\0';
break;
}
}
s = str;
while (*s)
{
- if (*s == '\r')
- *s = 0;
- if (*s == '\n')
- *s = 0;
+ if (*s == '\r' || *s == '\n')
+ *s = '\0';
s++;
}
NIAddSpell(Conf, str, flag);
int
NIImportAffixes(IspellDict * Conf, const char *filename)
{
- unsigned char str[BUFSIZ];
- unsigned char flag = 0;
- unsigned char mask[BUFSIZ] = "";
- unsigned char find[BUFSIZ] = "";
- unsigned char repl[BUFSIZ] = "";
- unsigned char *s;
+ char str[BUFSIZ];
+ char mask[BUFSIZ];
+ char find[BUFSIZ];
+ char repl[BUFSIZ];
+ char *s;
int i;
int suffixes = 0;
int prefixes = 0;
- unsigned char flagflags = 0;
+ int flag = 0;
+ char flagflags = 0;
FILE *affix;
if (!(affix = fopen(filename, "r")))
if (*s == '\\')
s++;
- flag = *s;
+ flag = (unsigned char) *s;
continue;
}
if ((!suffixes) && (!prefixes))
continue;
}
- NIAddAffix(Conf, (int) flag, (char) flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX);
+ NIAddAffix(Conf, flag, flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX);
}
fclose(affix);
firstsuffix = i;
if (Affix->flagflags & FF_COMPOUNDONLYAFX)
{
- if (!ptr->affix || strbncmp((ptr - 1)->affix, Affix->repl, (ptr - 1)->len))
+ if (!ptr->affix ||
+ strbncmp((const unsigned char *) (ptr - 1)->affix,
+ (const unsigned char *) Affix->repl,
+ (ptr - 1)->len))
{
/* leave only unique and minimals suffixes */
ptr->affix = Affix->repl;
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("word is too long")));
- pushquery(state, type, crc32_sz((uint8 *) strval, lenval),
+ pushquery(state, type, crc32_sz(strval, lenval),
state->curop - state->op, lenval, weight);
while (state->curop - state->op + lenval + 1 >= state->lenop)