Suppress signed-vs-unsigned-char warnings in contrib.
authorTom Lane
Sat, 24 Sep 2005 19:14:05 +0000 (19:14 +0000)
committerTom Lane
Sat, 24 Sep 2005 19:14:05 +0000 (19:14 +0000)
15 files changed:
contrib/dbase/dbf.c
contrib/dbase/dbf.h
contrib/dbase/dbf2pg.c
contrib/ltree/ltree_io.c
contrib/ltree/ltxtquery_io.c
contrib/pgcrypto/crypt-des.c
contrib/pgcrypto/crypt-md5.c
contrib/pgcrypto/pgcrypto.c
contrib/pgcrypto/pgp-decrypt.c
contrib/pgcrypto/pgp-pgsql.c
contrib/pgcrypto/px-crypt.c
contrib/tsearch2/dict_snowball.c
contrib/tsearch2/gistidx.c
contrib/tsearch2/ispell/spell.c
contrib/tsearch2/query.c

index 4ecb2b0e5a2fa6c55cb6d32583cfe3d8ea45f7f0..6a13aac97254c1cecc085332c70c9de722cd0c0c 100644 (file)
@@ -20,7 +20,7 @@
 /* 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;
@@ -200,7 +200,7 @@ dbf_put_fields(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;
@@ -232,7 +232,7 @@ dbf_add_field(dbhead * dbh, u_char *name, u_char type,
 }
 
 dbhead *
-dbf_open_new(u_char *name, int flags)
+dbf_open_new(char *name, int flags)
 {
    dbhead     *dbh;
 
@@ -339,7 +339,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
                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
@@ -351,7 +351,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
                end++;
                i--;
            }
-           strncpy(fields[t].db_contents, end, i);
+           strncpy((char *) fields[t].db_contents, (char *) end, i);
            fields[t].db_contents[i] = '\0';
        }
 
@@ -419,7 +419,7 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
    u_char     *data,
                end = 0x1a;
    double      fl;
-   u_char      foo[128],
+   char        foo[128],
                format[32];
 
 /* offset: offset in file for this record
@@ -473,11 +473,12 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
 /* 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
            {
@@ -485,18 +486,18 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
 /* 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;
index 5c882fc7a87f0b8e230b8a08fc1fa00a609cf22e..9a5a2bee83a1c3bad5b5d25396ab87af59fc0d1b 100644 (file)
@@ -60,7 +60,7 @@ typedef struct
 
 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 */
@@ -73,7 +73,7 @@ typedef struct
 
 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 */
@@ -107,7 +107,7 @@ typedef struct
 
 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 */
@@ -116,12 +116,12 @@ typedef struct
 
 /* 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);
index ab0ae9a30ac2bcb9e6befae9e42237dcb346c188..8acb65c557a735897e3a53826167c5accb5e9724 100644 (file)
@@ -434,11 +434,11 @@ do_inserts(PGconn *conn, char *table, 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);
index 99803059f0fade9749dc652eb2d7ecacc0e450cf..d0a8c20903e8d939526985a3b9d82c66c63cc4ff 100644 (file)
@@ -469,7 +469,7 @@ lquery_in(PG_FUNCTION_ARGS)
                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);
index 0751a6b718ec7cd5af9eb73dc64a86065de9405a..ade0c4c03324c7b474479493ac5be961426be555 100644 (file)
@@ -171,7 +171,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
                (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)
index 0edff299a05d1002cc00e817662612227e3b7d65..74768e73a77179259aa8c63f225ab97bfb5c7e81 100644 (file)
@@ -651,9 +651,9 @@ px_crypt_des(const char *key, const char *setting)
                r0,
                r1,
                keybuf[2];
-   uint8      *p,
-              *q;
-   static uint8 output[21];
+   char       *p;
+   uint8      *q;
+   static char output[21];
 
    if (!des_initialised)
        des_init();
@@ -669,7 +669,7 @@ px_crypt_des(const char *key, const char *setting)
        if ((*q++ = *key << 1))
            key++;
    }
-   if (des_setkey((uint8 *) keybuf))
+   if (des_setkey((char *) keybuf))
        return (NULL);
 
 #ifndef DISABLE_XDES
@@ -690,7 +690,7 @@ px_crypt_des(const char *key, const char *setting)
            /*
             * 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);
 
            /*
@@ -700,7 +700,7 @@ px_crypt_des(const char *key, const char *setting)
            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);
index f2acae8c7263ca85a4c76ca26b83859499814abb..dceb599775e4334d3e6e0fa05ba00afe0ae91703 100644 (file)
@@ -8,7 +8,7 @@
  *
  * $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"
@@ -63,18 +63,18 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
    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);
@@ -87,7 +87,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
        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);
@@ -105,20 +105,20 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
    {
        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);
    }
 
index 3ae38588b2ec6b8c5c77a03fe5bc3dd9e9d7b438..4888fb87254ae2a92e47c2cc35f76d185d56b6c6 100644 (file)
@@ -26,7 +26,7 @@
  * 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"
@@ -75,8 +75,8 @@ pg_digest(PG_FUNCTION_ARGS)
    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);
@@ -144,9 +144,9 @@ pg_hmac(PG_FUNCTION_ARGS)
    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);
@@ -346,9 +346,10 @@ pg_encrypt(PG_FUNCTION_ARGS)
    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);
@@ -397,9 +398,10 @@ pg_decrypt(PG_FUNCTION_ARGS)
    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);
 
@@ -452,9 +454,11 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
    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);
 
@@ -508,9 +512,11 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
    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);
 
index 1fc4f4feb0ac8b47d908b375e367196ebb3eb543..16ae78200bc81289350cff64784ca82c89f6dc17 100644 (file)
@@ -26,7 +26,7 @@
  * 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"
@@ -792,7 +792,7 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt)
            break;
    }
    if (res >= 0 && got_cr)
-       res = mbuf_append(dst, "\r", 1);
+       res = mbuf_append(dst, (const uint8 *) "\r", 1);
    return res;
 }
 
index 9e8b30795fc9185fd0db337a420e7e213ed91083..e0172fde90ab4693b809097a6f61479e29f8926f 100644 (file)
@@ -26,7 +26,7 @@
  * 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"
@@ -94,7 +94,7 @@ static void add_block_entropy(PX_MD *md, text *data)
    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);
@@ -151,14 +151,14 @@ static text *convert_charset(text *src, int cset_from, int cset_to)
    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;
@@ -398,7 +398,8 @@ static int parse_args(PGP_Context *ctx, uint8 *args, int arg_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
@@ -410,7 +411,8 @@ init_work(PGP_Context **ctx_p, int is_text,
    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)
    {
@@ -474,7 +476,8 @@ encrypt_internal(int is_pubenc, int is_text,
        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
@@ -532,7 +535,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
 
    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);
 
    /*
@@ -550,7 +554,7 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
        MBuf *kbuf;
        if (keypsw)
        {
-           psw = VARDATA(keypsw);
+           psw = (uint8 *) VARDATA(keypsw);
            psw_len = VARSIZE(keypsw) - VARHDRSZ;
        }
        kbuf = create_mbuf_from_vardata(key);
@@ -558,7 +562,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
        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
@@ -846,7 +851,8 @@ pg_armor(PG_FUNCTION_ARGS)
    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),
@@ -875,7 +881,8 @@ pg_dearmor(PG_FUNCTION_ARGS)
    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),
index c934f306059a14c5f39fea514e6a5210830d9c49..0b818ffeeed8556fae34f9c54d214817c9d6089f 100644 (file)
@@ -26,7 +26,7 @@
  * 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"
@@ -152,7 +152,7 @@ px_gen_salt(const char *salt_type, char *buf, int rounds)
            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;
 
index 8bcd3385d8f844c3fc5607ff781d08fcd0420da2..5a83fb45d3ac36b11688cce8584de11a599ea514 100644 (file)
@@ -111,7 +111,7 @@ snb_lexize(PG_FUNCTION_ARGS)
    }
    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)
        {
index d8a7210591dd239cdf00098a67a5104e9e7d39ef..653a47653636b7fdcedf3711d72afddd983f1749 100644 (file)
@@ -156,7 +156,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
        len = val->size;
        while (len--)
        {
-           *arr = crc32_sz((uint8 *) &words[ptr->pos], ptr->len);
+           *arr = crc32_sz(&words[ptr->pos], ptr->len);
            arr++;
            ptr++;
        }
index 54d0410af33ecf27d91b683711fe4d2c4081119d..872e7f972b2c3ca68f5ad26925970fbf410693cd 100644 (file)
@@ -52,12 +52,12 @@ strnduplicate(char *s, int len)
    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)
    {
@@ -78,8 +78,8 @@ strbcmp(const unsigned char *s1, const unsigned char *s2)
 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)
@@ -104,14 +104,18 @@ strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count)
 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
@@ -142,29 +146,29 @@ NIAddSpell(IspellDict * Conf, const char *word, const char *flag)
 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;
                }
            }
@@ -177,10 +181,8 @@ NIImportDictionary(IspellDict * Conf, const char *filename)
        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);
@@ -311,16 +313,16 @@ remove_spaces(char *dist, char *src)
 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")))
@@ -374,7 +376,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
            if (*s == '\\')
                s++;
 
-           flag = *s;
+           flag = (unsigned char) *s;
            continue;
        }
        if ((!suffixes) && (!prefixes))
@@ -409,7 +411,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename)
                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);
@@ -681,7 +683,10 @@ NISortAffixes(IspellDict * Conf)
                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;
index eb45ba078e11b6bb7d397623f010bfb6bb79aa32..db45de56be1721899a1fc234efc2603905012059 100644 (file)
@@ -238,7 +238,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, int2 weight
                (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)