3
3
*
4
4
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
5
5
*
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 $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "common.h"
@@ -357,8 +357,8 @@ print_aligned_text(const char *title, const char *const * headers,
357
357
{
358
358
unsignedint col_count = 0 ;
359
359
unsignedint cell_count = 0 ;
360
- unsignedint i ,
361
- tmp ;
360
+ unsignedint i ;
361
+ int tmp ;
362
362
unsignedint * widths ,
363
363
total_w ;
364
364
unsignedint * heights ;
@@ -583,17 +583,22 @@ print_aligned_text(const char *title, const char *const * headers,
583
583
{
584
584
if (opt_numeric_locale )
585
585
{
586
- /* Assumption: This code used only on strings
586
+ /*
587
+ * Assumption: This code used only on strings
587
588
* without multibyte characters, otherwise
588
589
* 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 );
593
596
free (my_cell );
594
597
}
595
598
else
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 );
597
602
}
598
603
else
599
604
fprintf (fout ,"%-s%*s" ,this_line -> ptr ,
@@ -665,13 +670,13 @@ print_aligned_vertical(const char *title, const char *const * headers,
665
670
unsignedint record = 1 ;
666
671
const char * const * ptr ;
667
672
unsignedint i ,
668
- tmp = 0 ,
669
673
hwidth = 0 ,
670
674
dwidth = 0 ,
671
675
hheight = 1 ,
672
676
dheight = 1 ,
673
677
hformatsize = 0 ,
674
678
dformatsize = 0 ;
679
+ int tmp = 0 ;
675
680
char * divider ;
676
681
unsignedint cell_count = 0 ;
677
682
struct lineptr * hlineptr ,* dlineptr ;
@@ -823,11 +828,12 @@ print_aligned_vertical(const char *title, const char *const * headers,
823
828
{
824
829
if (opt_align [i %col_count ]== 'r' && opt_numeric_locale )
825
830
{
826
- char * my_cell = format_numeric_locale (dlineptr [line_count ].ptr );
831
+ char * my_cell = format_numeric_locale (( char * ) dlineptr [line_count ].ptr );
827
832
if (opt_border < 2 )
828
833
fprintf (fout ,"%s\n" ,my_cell );
829
834
else
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 )),"" );
831
837
free (my_cell );
832
838
}
833
839
else
@@ -1753,7 +1759,8 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f
1753
1759
headers = pg_local_calloc (nfields + 1 ,sizeof (* headers ));
1754
1760
1755
1761
for (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 );
1757
1764
1758
1765
/* set cells */
1759
1766
ncells = PQntuples (result )* nfields ;
@@ -1764,7 +1771,9 @@ printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout, FILE *f
1764
1771
if (PQgetisnull (result ,i /nfields ,i %nfields ))
1765
1772
cells [i ]= opt -> nullPrint ?opt -> nullPrint :"" ;
1766
1773
else
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 );
1768
1777
}
1769
1778
1770
1779
/* set footers */