diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-24 17:53:28 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-09-24 17:53:28 +0000 |
| commit | 8889685555e0ae7d5396038be9924ced2d330bd3 (patch) | |
| tree | 6dc4bc817e1abfcaaa048c603e7514f456f039f2 /src/bin | |
| parent | 54a8af058e73b452278031b4959bd2fe9be0ba0c (diff) | |
| download | postgresql-8889685555e0ae7d5396038be9924ced2d330bd3.tar.gz | |
Suppress signed-vs-unsigned-char warnings.
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_backup_custom.c | 14 | ||||
| -rw-r--r-- | src/bin/psql/mbprint.c | 26 | ||||
| -rw-r--r-- | src/bin/psql/mbprint.h | 8 | ||||
| -rw-r--r-- | src/bin/psql/print.c | 12 |
4 files changed, 28 insertions, 32 deletions
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 543cb8f2d6..115375c343 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -19,7 +19,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.31 2005/06/21 20:45:44 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.32 2005/09/24 17:53:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -27,8 +27,6 @@ #include "pg_backup.h" #include "pg_backup_archiver.h" -#include <errno.h> - /*-------- * Routines in the format interface *-------- @@ -548,7 +546,7 @@ _PrintData(ArchiveHandle *AH) ctx->filePos += blkLen; - zp->next_in = in; + zp->next_in = (void *) in; zp->avail_in = blkLen; #ifdef HAVE_LIBZ @@ -557,7 +555,7 @@ _PrintData(ArchiveHandle *AH) { while (zp->avail_in != 0) { - zp->next_out = out; + zp->next_out = (void *) out; zp->avail_out = zlibOutSize; res = inflate(zp, 0); if (res != Z_OK && res != Z_STREAM_END) @@ -587,7 +585,7 @@ _PrintData(ArchiveHandle *AH) zp->avail_in = 0; while (res != Z_STREAM_END) { - zp->next_out = out; + zp->next_out = (void *) out; zp->avail_out = zlibOutSize; res = inflate(zp, 0); if (res != Z_OK && res != Z_STREAM_END) @@ -891,7 +889,7 @@ _StartDataCompressor(ArchiveHandle *AH, TocEntry *te) #endif /* Just be paranoid - maybe End is called after Start, with no Write */ - zp->next_out = ctx->zlibOut; + zp->next_out = (void *) ctx->zlibOut; zp->avail_out = zlibOutSize; } @@ -937,7 +935,7 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush) die_horribly(AH, modulename, "could not write compressed chunk\n"); ctx->filePos += zlibOutSize - zp->avail_out; } - zp->next_out = out; + zp->next_out = (void *) out; zp->avail_out = zlibOutSize; } } diff --git a/src/bin/psql/mbprint.c b/src/bin/psql/mbprint.c index 27ee3f840f..dd4bfca211 100644 --- a/src/bin/psql/mbprint.c +++ b/src/bin/psql/mbprint.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.16 2005/01/01 05:43:08 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.17 2005/09/24 17:53:27 tgl Exp $ */ #include "postgres_fe.h" @@ -158,7 +158,7 @@ ucs_wcwidth(pg_wchar ucs) (ucs >= 0x20000 && ucs <= 0x2ffff))); } -pg_wchar +static pg_wchar utf2ucs(const unsigned char *c) { /* @@ -195,7 +195,7 @@ utf2ucs(const unsigned char *c) /* mb_utf_wcwidth : calculate column length for the utf8 string pwcs */ static int -mb_utf_wcswidth(unsigned char *pwcs, size_t len) +mb_utf_wcswidth(const unsigned char *pwcs, size_t len) { int w, l = 0; @@ -272,15 +272,15 @@ utf_charcheck(const unsigned char *c) return -1; } -static unsigned char * +static void mb_utf_validate(unsigned char *pwcs) { - int l = 0; unsigned char *p = pwcs; - unsigned char *p0 = pwcs; while (*pwcs) { + int l; + if ((l = utf_charcheck(pwcs)) > 0) { if (p != pwcs) @@ -304,7 +304,6 @@ mb_utf_validate(unsigned char *pwcs) } if (p != pwcs) *p = '\0'; - return p0; } /* @@ -312,10 +311,10 @@ mb_utf_validate(unsigned char *pwcs) */ int -pg_wcswidth(unsigned char *pwcs, size_t len, int encoding) +pg_wcswidth(const char *pwcs, size_t len, int encoding) { if (encoding == PG_UTF8) - return mb_utf_wcswidth(pwcs, len); + return mb_utf_wcswidth((const unsigned char *) pwcs, len); else { /* @@ -326,17 +325,18 @@ pg_wcswidth(unsigned char *pwcs, size_t len, int encoding) } } -unsigned char * -mbvalidate(unsigned char *pwcs, int encoding) +char * +mbvalidate(char *pwcs, int encoding) { if (encoding == PG_UTF8) - return mb_utf_validate(pwcs); + mb_utf_validate((unsigned char *) pwcs); else { /* * other encodings needing validation should add their own * routines here */ - return pwcs; } + + return pwcs; } diff --git a/src/bin/psql/mbprint.h b/src/bin/psql/mbprint.h index 7b1aa054db..17a8b98ea6 100644 --- a/src/bin/psql/mbprint.h +++ b/src/bin/psql/mbprint.h @@ -1,13 +1,11 @@ -/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.7 2003/11/29 22:40:49 pgsql Exp $ */ +/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.8 2005/09/24 17:53:27 tgl Exp $ */ #ifndef MBPRINT_H #define MBPRINT_H #include "mb/pg_wchar.h" -pg_wchar utf2ucs(const unsigned char *c); +extern char *mbvalidate(char *pwcs, int encoding); -unsigned char *mbvalidate(unsigned char *pwcs, int encoding); - -int pg_wcswidth(unsigned char *pwcs, size_t len, int encoding); +extern int pg_wcswidth(const char *pwcs, size_t len, int encoding); #endif /* MBPRINT_H */ diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index b2c060765c..544d04dd78 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.73 2005/09/22 15:51:51 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.74 2005/09/24 17:53:27 tgl Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -391,7 +391,7 @@ print_aligned_text(const char *title, const char *const *headers, /* calc column widths */ for (i = 0; i < col_count; i++) { - tmp = pg_wcswidth((unsigned char *) headers[i], strlen(headers[i]), encoding); + tmp = pg_wcswidth(headers[i], strlen(headers[i]), encoding); if (tmp > widths[i]) widths[i] = tmp; head_w[i] = tmp; @@ -406,7 +406,7 @@ print_aligned_text(const char *title, const char *const *headers, else numeric_locale_len = 0; - tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numeric_locale_len; + tmp = pg_wcswidth(*ptr, strlen(*ptr), encoding) + numeric_locale_len; if (tmp > widths[i % col_count]) widths[i % col_count] = tmp; cell_w[i] = tmp; @@ -425,7 +425,7 @@ print_aligned_text(const char *title, const char *const *headers, /* print title */ if (title && !opt_tuples_only) { - tmp = pg_wcswidth((unsigned char *) title, strlen(title), encoding); + tmp = pg_wcswidth(title, strlen(title), encoding); if (tmp >= total_w) fprintf(fout, "%s\n", title); else @@ -591,7 +591,7 @@ print_aligned_vertical(const char *title, const char *const *headers, for (i = 0; i < col_count; i++) { - tmp = pg_wcswidth((unsigned char *) headers[i], strlen(headers[i]), encoding); + tmp = pg_wcswidth(headers[i], strlen(headers[i]), encoding); if (tmp > hwidth) hwidth = tmp; head_w[i] = tmp; @@ -623,7 +623,7 @@ print_aligned_vertical(const char *title, const char *const *headers, else numeric_locale_len = 0; - tmp = pg_wcswidth((unsigned char *) *ptr, strlen(*ptr), encoding) + numeric_locale_len; + tmp = pg_wcswidth(*ptr, strlen(*ptr), encoding) + numeric_locale_len; if (tmp > dwidth) dwidth = tmp; cell_w[i] = tmp; |
