Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8a65b82

Browse files
committed
Suppress signed-vs-unsigned-char warnings in contrib.
1 parent 8889685 commit 8a65b82

File tree

15 files changed

+124
-105
lines changed

15 files changed

+124
-105
lines changed

contrib/dbase/dbf.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/* open a dbf-file, get it's field-info and store this information */
2121

2222
dbhead *
23-
dbf_open(u_char *file, int flags)
23+
dbf_open(char *file, int flags)
2424
{
2525
int file_no;
2626
dbhead *dbh;
@@ -200,7 +200,7 @@ dbf_put_fields(dbhead * dbh)
200200
}
201201

202202
int
203-
dbf_add_field(dbhead * dbh, u_char *name, u_char type,
203+
dbf_add_field(dbhead * dbh, char *name, u_char type,
204204
u_char length, u_char dec)
205205
{
206206
f_descr *ptr;
@@ -232,7 +232,7 @@ dbf_add_field(dbhead * dbh, u_char *name, u_char type,
232232
}
233233

234234
dbhead *
235-
dbf_open_new(u_char *name, int flags)
235+
dbf_open_new(char *name, int flags)
236236
{
237237
dbhead *dbh;
238238

@@ -339,7 +339,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
339339
end--;
340340
i--;
341341
}
342-
strncpy(fields[t].db_contents, dbffield, i);
342+
strncpy((char *) fields[t].db_contents, (char *) dbffield, i);
343343
fields[t].db_contents[i] = '\0';
344344
}
345345
else
@@ -351,7 +351,7 @@ dbf_get_record(dbhead * dbh, field * fields, u_long rec)
351351
end++;
352352
i--;
353353
}
354-
strncpy(fields[t].db_contents, end, i);
354+
strncpy((char *) fields[t].db_contents, (char *) end, i);
355355
fields[t].db_contents[i] = '\0';
356356
}
357357

@@ -419,7 +419,7 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
419419
u_char *data,
420420
end = 0x1a;
421421
double fl;
422-
u_char foo[128],
422+
char foo[128],
423423
format[32];
424424

425425
/* offset: offset in file for this record
@@ -473,30 +473,31 @@ dbf_put_record(dbhead * dbh, field * rec, u_long where)
473473
/* Handle text */
474474
if (rec[t].db_type == 'C')
475475
{
476-
if (strlen(rec[t].db_contents) > rec[t].db_flen)
476+
if (strlen((char *) rec[t].db_contents) > rec[t].db_flen)
477477
length = rec[t].db_flen;
478478
else
479-
length = strlen(rec[t].db_contents);
480-
strncpy(data + idx, rec[t].db_contents, length);
479+
length = strlen((char *) rec[t].db_contents);
480+
strncpy((char *) data + idx, (char *) rec[t].db_contents,
481+
length);
481482
}
482483
else
483484
{
484485
/* Handle the rest */
485486
/* Numeric is special, because of real numbers */
486487
if ((rec[t].db_type == 'N') && (rec[t].db_dec != 0))
487488
{
488-
fl = atof(rec[t].db_contents);
489+
fl = atof((char *) rec[t].db_contents);
489490
snprintf(format, 32, "%%.%df", rec[t].db_dec);
490491
snprintf(foo, 128, format, fl);
491492
}
492493
else
493-
strncpy(foo, rec[t].db_contents, 128);
494+
strncpy(foo, (char *) rec[t].db_contents, 128);
494495
if (strlen(foo) > rec[t].db_flen)
495496
length = rec[t].db_flen;
496497
else
497498
length = strlen(foo);
498499
h = rec[t].db_flen - length;
499-
strncpy(data + idx + h, foo, length);
500+
strncpy((char *) (data + idx + h), foo, length);
500501
}
501502
}
502503
idx += rec[t].db_flen;

contrib/dbase/dbf.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct
6060

6161
typedef struct
6262
{
63-
u_char dbf_name[DBF_NAMELEN]; /* field-name terminated with \0 */
63+
char dbf_name[DBF_NAMELEN]; /* field-name terminated with \0 */
6464
u_char dbf_type; /* field-type */
6565
u_char dbf_reserved[4]; /* some reserved stuff */
6666
u_char dbf_flen; /* field-length */
@@ -73,7 +73,7 @@ typedef struct
7373

7474
typedef struct
7575
{
76-
u_char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
76+
char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
7777
u_char db_type; /* field-type */
7878
u_char db_flen; /* field-length */
7979
u_char db_dec; /* number of decimal positions */
@@ -107,7 +107,7 @@ typedef struct
107107

108108
typedef struct
109109
{
110-
u_char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
110+
char db_name[DBF_NAMELEN]; /* field-name terminated with \0 */
111111
u_char db_type; /* field-type */
112112
u_char db_flen; /* field-length */
113113
u_char db_dec; /* number of decimal positions */
@@ -116,12 +116,12 @@ typedef struct
116116

117117
/* prototypes for functions */
118118

119-
extern dbhead *dbf_open(u_char *file, int flags);
119+
extern dbhead *dbf_open(char *file, int flags);
120120
extern int dbf_write_head(dbhead * dbh);
121121
extern int dbf_put_fields(dbhead * dbh);
122-
extern int dbf_add_field(dbhead * dbh, u_char *name, u_char type,
122+
extern int dbf_add_field(dbhead * dbh, char *name, u_char type,
123123
u_char length, u_char dec);
124-
extern dbhead *dbf_open_new(u_char *name, int flags);
124+
extern dbhead *dbf_open_new(char *name, int flags);
125125
extern void dbf_close(dbhead * dbh);
126126
extern int dbf_get_record(dbhead * dbh, field * fields, u_long rec);
127127
extern field *dbf_build_record(dbhead * dbh);

contrib/dbase/dbf2pg.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,11 @@ do_inserts(PGconn *conn, char *table, dbhead * dbh)
434434
* separator */
435435

436436
if (upper)
437-
strtoupper(fields[h].db_contents);
437+
strtoupper((char *) fields[h].db_contents);
438438
if (lower)
439-
strtolower(fields[h].db_contents);
439+
strtolower((char *) fields[h].db_contents);
440440

441-
foo = fields[h].db_contents;
441+
foo = (char *) fields[h].db_contents;
442442
#ifdef HAVE_ICONV_H
443443
if (charset_from)
444444
foo = convert_charset(foo);

contrib/ltree/ltree_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ lquery_in(PG_FUNCTION_ARGS)
469469
cur->totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len);
470470
lrptr->len = lptr->len;
471471
lrptr->flag = lptr->flag;
472-
lrptr->val = ltree_crc32_sz((uint8 *) lptr->start, lptr->len);
472+
lrptr->val = ltree_crc32_sz(lptr->start, lptr->len);
473473
memcpy(lrptr->name, lptr->start, lptr->len);
474474
lptr++;
475475
lrptr = LVAR_NEXT(lrptr);

contrib/ltree/ltxtquery_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
171171
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
172172
errmsg("word is too long")));
173173

174-
pushquery(state, type, ltree_crc32_sz((uint8 *) strval, lenval),
174+
pushquery(state, type, ltree_crc32_sz(strval, lenval),
175175
state->curop - state->op, lenval, flag);
176176

177177
while (state->curop - state->op + lenval + 1 >= state->lenop)

contrib/pgcrypto/crypt-des.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ px_crypt_des(const char *key, const char *setting)
651651
r0,
652652
r1,
653653
keybuf[2];
654-
uint8 *p,
655-
*q;
656-
static uint8 output[21];
654+
char *p;
655+
uint8 *q;
656+
static char output[21];
657657

658658
if (!des_initialised)
659659
des_init();
@@ -669,7 +669,7 @@ px_crypt_des(const char *key, const char *setting)
669669
if ((*q++ = *key << 1))
670670
key++;
671671
}
672-
if (des_setkey((uint8 *) keybuf))
672+
if (des_setkey((char *) keybuf))
673673
return (NULL);
674674

675675
#ifndef DISABLE_XDES
@@ -690,7 +690,7 @@ px_crypt_des(const char *key, const char *setting)
690690
/*
691691
* Encrypt the key with itself.
692692
*/
693-
if (des_cipher((uint8 *) keybuf, (uint8 *) keybuf, 0L, 1))
693+
if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1))
694694
return (NULL);
695695

696696
/*
@@ -700,7 +700,7 @@ px_crypt_des(const char *key, const char *setting)
700700
while (q - (uint8 *) keybuf - 8 && *key)
701701
*q++ ^= *key++ << 1;
702702

703-
if (des_setkey((uint8 *) keybuf))
703+
if (des_setkey((char *) keybuf))
704704
return (NULL);
705705
}
706706
strncpy(output, setting, 9);

contrib/pgcrypto/crypt-md5.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
1010
*
11-
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.4 2005/07/11 15:07:59 tgl Exp $
11+
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
1212
*/
1313

1414
#include "postgres.h"
@@ -63,18 +63,18 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
6363
err = px_find_digest("md5", &ctx1);
6464

6565
/* The password first, since that is what is most unknown */
66-
px_md_update(ctx, pw, strlen(pw));
66+
px_md_update(ctx, (uint8 *) pw, strlen(pw));
6767

6868
/* Then our magic string */
69-
px_md_update(ctx, magic, strlen(magic));
69+
px_md_update(ctx, (uint8 *) magic, strlen(magic));
7070

7171
/* Then the raw salt */
72-
px_md_update(ctx, sp, sl);
72+
px_md_update(ctx, (uint8 *) sp, sl);
7373

7474
/* Then just as many characters of the MD5(pw,salt,pw) */
75-
px_md_update(ctx1, pw, strlen(pw));
76-
px_md_update(ctx1, sp, sl);
77-
px_md_update(ctx1, pw, strlen(pw));
75+
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
76+
px_md_update(ctx1, (uint8 *) sp, sl);
77+
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
7878
px_md_finish(ctx1, final);
7979
for (pl = strlen(pw); pl > 0; pl -= MD5_SIZE)
8080
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)
8787
if (i & 1)
8888
px_md_update(ctx, final, 1);
8989
else
90-
px_md_update(ctx, pw, 1);
90+
px_md_update(ctx, (uint8 *) pw, 1);
9191

9292
/* Now make the output string */
9393
strcpy(passwd, magic);
@@ -105,20 +105,20 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
105105
{
106106
px_md_reset(ctx1);
107107
if (i & 1)
108-
px_md_update(ctx1, pw, strlen(pw));
108+
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
109109
else
110110
px_md_update(ctx1, final, MD5_SIZE);
111111

112112
if (i % 3)
113-
px_md_update(ctx1, sp, sl);
113+
px_md_update(ctx1, (uint8 *) sp, sl);
114114

115115
if (i % 7)
116-
px_md_update(ctx1, pw, strlen(pw));
116+
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
117117

118118
if (i & 1)
119119
px_md_update(ctx1, final, MD5_SIZE);
120120
else
121-
px_md_update(ctx1, pw, strlen(pw));
121+
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
122122
px_md_finish(ctx1, final);
123123
}
124124

contrib/pgcrypto/pgcrypto.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.18 2005/03/21 05:19:55 neilc Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.19 2005/09/24 19:14:04 tgl Exp $
3030
*/
3131

3232
#include "postgres.h"
@@ -75,8 +75,8 @@ pg_digest(PG_FUNCTION_ARGS)
7575
arg = PG_GETARG_BYTEA_P(0);
7676
len = VARSIZE(arg) - VARHDRSZ;
7777

78-
px_md_update(md, VARDATA(arg), len);
79-
px_md_finish(md, VARDATA(res));
78+
px_md_update(md, (uint8 *) VARDATA(arg), len);
79+
px_md_finish(md, (uint8 *) VARDATA(res));
8080
px_md_free(md);
8181

8282
PG_FREE_IF_COPY(arg, 0);
@@ -144,9 +144,9 @@ pg_hmac(PG_FUNCTION_ARGS)
144144
len = VARSIZE(arg) - VARHDRSZ;
145145
klen = VARSIZE(key) - VARHDRSZ;
146146

147-
px_hmac_init(h, VARDATA(key), klen);
148-
px_hmac_update(h, VARDATA(arg), len);
149-
px_hmac_finish(h, VARDATA(res));
147+
px_hmac_init(h, (uint8 *) VARDATA(key), klen);
148+
px_hmac_update(h, (uint8 *) VARDATA(arg), len);
149+
px_hmac_finish(h, (uint8 *) VARDATA(res));
150150
px_hmac_free(h);
151151

152152
PG_FREE_IF_COPY(arg, 0);
@@ -346,9 +346,10 @@ pg_encrypt(PG_FUNCTION_ARGS)
346346
rlen = px_combo_encrypt_len(c, dlen);
347347
res = palloc(VARHDRSZ + rlen);
348348

349-
err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
349+
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
350350
if (!err)
351-
err = px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
351+
err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
352+
(uint8 *) VARDATA(res), &rlen);
352353
px_combo_free(c);
353354

354355
PG_FREE_IF_COPY(data, 0);
@@ -397,9 +398,10 @@ pg_decrypt(PG_FUNCTION_ARGS)
397398
rlen = px_combo_decrypt_len(c, dlen);
398399
res = palloc(VARHDRSZ + rlen);
399400

400-
err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
401+
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
401402
if (!err)
402-
err = px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
403+
err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
404+
(uint8 *) VARDATA(res), &rlen);
403405

404406
px_combo_free(c);
405407

@@ -452,9 +454,11 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
452454
rlen = px_combo_encrypt_len(c, dlen);
453455
res = palloc(VARHDRSZ + rlen);
454456

455-
err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
457+
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
458+
(uint8 *) VARDATA(iv), ivlen);
456459
if (!err)
457-
px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
460+
px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
461+
(uint8 *) VARDATA(res), &rlen);
458462

459463
px_combo_free(c);
460464

@@ -508,9 +512,11 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
508512
rlen = px_combo_decrypt_len(c, dlen);
509513
res = palloc(VARHDRSZ + rlen);
510514

511-
err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
515+
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
516+
(uint8 *) VARDATA(iv), ivlen);
512517
if (!err)
513-
px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
518+
px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
519+
(uint8 *) VARDATA(res), &rlen);
514520

515521
px_combo_free(c);
516522

contrib/pgcrypto/pgp-decrypt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.4 2005/07/18 17:09:01 tgl Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
3030
*/
3131

3232
#include "postgres.h"
@@ -792,7 +792,7 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt)
792792
break;
793793
}
794794
if (res >= 0 && got_cr)
795-
res = mbuf_append(dst, "\r", 1);
795+
res = mbuf_append(dst, (const uint8 *) "\r", 1);
796796
return res;
797797
}
798798

0 commit comments

Comments
 (0)