1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-24 06:01:07 +03:00

Suppress signed-vs-unsigned-char warnings in contrib.

This commit is contained in:
Tom Lane
2005-09-24 19:14:05 +00:00
parent 8889685555
commit 8a65b820e2
15 changed files with 124 additions and 105 deletions

View 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;

View 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);

View 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);