33 *
44 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
55 *
6- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.81 2006/02/1015:48:05 momjian Exp $
6+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.82 2006/02/1022:29:06 tgl Exp $
77 */
88#include "postgres_fe.h"
99#include "common.h"
@@ -357,8 +357,8 @@ print_aligned_text(const char *title, const char *const * headers,
357357{
358358unsignedint col_count = 0 ;
359359unsignedint cell_count = 0 ;
360- unsignedint i ,
361- tmp ;
360+ unsignedint i ;
361+ int tmp ;
362362unsignedint * widths ,
363363total_w ;
364364unsignedint * heights ;
@@ -583,17 +583,22 @@ print_aligned_text(const char *title, const char *const * headers,
583583{
584584if (opt_numeric_locale )
585585{
586- /* Assumption: This code used only on strings
586+ /*
587+ * Assumption: This code used only on strings
587588 * without multibyte characters, otherwise
588589 * this_line->width < strlen(this_ptr) and we
589- * get an overflow */
590-
591- char * my_cell = format_numeric_locale (this_line -> ptr );
592- fprintf (fout ,"%*s%s" ,widths [i %col_count ]- strlen (my_cell ),"" ,my_cell );
590+ * get an overflow
591+ */
592+ char * my_cell = format_numeric_locale ((char * )this_line -> ptr );
593+ fprintf (fout ,"%*s%s" ,
594+ (int ) (widths [i %col_count ]- strlen (my_cell )),"" ,
595+ my_cell );
593596free (my_cell );
594597}
595598else
596- fprintf (fout ,"%*s%s" ,widths [j ]- this_line -> width ,"" ,this_line -> ptr );
599+ fprintf (fout ,"%*s%s" ,
600+ widths [j ]- this_line -> width ,"" ,
601+ this_line -> ptr );
597602}
598603else
599604fprintf (fout ,"%-s%*s" ,this_line -> ptr ,
@@ -665,13 +670,13 @@ print_aligned_vertical(const char *title, const char *const * headers,
665670unsignedint record = 1 ;
666671const char * const * ptr ;
667672unsignedint i ,
668- tmp = 0 ,
669673hwidth = 0 ,
670674dwidth = 0 ,
671675hheight = 1 ,
672676dheight = 1 ,
673677hformatsize = 0 ,
674678dformatsize = 0 ;
679+ int tmp = 0 ;
675680char * divider ;
676681unsignedint cell_count = 0 ;
677682struct lineptr * hlineptr ,* dlineptr ;
@@ -823,11 +828,12 @@ print_aligned_vertical(const char *title, const char *const * headers,
823828{
824829if (opt_align [i %col_count ]== 'r' && opt_numeric_locale )
825830 {
826- char * my_cell = format_numeric_locale (dlineptr [line_count ].ptr );
831+ char * my_cell = format_numeric_locale (( char * ) dlineptr [line_count ].ptr );
827832if (opt_border < 2 )
828833fprintf (fout ,"%s\n" ,my_cell );
829834else
830- fprintf (fout ,"%-s%*s |\n" ,my_cell ,dwidth - strlen (my_cell ),"" );
835+ fprintf (fout ,"%-s%*s |\n" ,my_cell ,
836+ (int ) (dwidth - strlen (my_cell )),"" );
831837free (my_cell );
832838 }
833839else
@@ -1753,7 +1759,8 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f
17531759headers = pg_local_calloc (nfields + 1 ,sizeof (* headers ));
17541760
17551761for (i = 0 ;i < nfields ;i ++ )
1756- headers [i ]= mbvalidate (PQfname (result ,i ),opt -> topt .encoding );
1762+ headers [i ]= (char * )mbvalidate ((unsignedchar * )PQfname (result ,i ),
1763+ opt -> topt .encoding );
17571764
17581765/* set cells */
17591766ncells = PQntuples (result )* nfields ;
@@ -1764,7 +1771,9 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f
17641771if (PQgetisnull (result ,i /nfields ,i %nfields ))
17651772cells [i ]= opt -> nullPrint ?opt -> nullPrint :"" ;
17661773else
1767- cells [i ]= mbvalidate (PQgetvalue (result ,i /nfields ,i %nfields ),opt -> topt .encoding );
1774+ cells [i ]= (char * )
1775+ mbvalidate ((unsignedchar * )PQgetvalue (result ,i /nfields ,i %nfields ),
1776+ opt -> topt .encoding );
17681777}
17691778
17701779/* set footers */