@@ -55,9 +55,9 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table);
5555static int list_table_status (MYSQL * mysql ,const char * db ,const char * table );
5656static int list_fields (MYSQL * mysql ,const char * db ,const char * table ,
5757 const char * field );
58- static void print_header (const char * header ,uint head_length ,...);
59- static void print_row (const char * header ,uint head_length ,...);
60- static void print_trailer (uint length ,...);
58+ static void print_header (const char * header ,size_t head_length ,...);
59+ static void print_row (const char * header ,size_t head_length ,...);
60+ static void print_trailer (size_t length ,...);
6161static void print_res_header (MYSQL_RES * result );
6262static void print_res_top (MYSQL_RES * result );
6363static void print_res_row (MYSQL_RES * result ,MYSQL_ROW cur );
@@ -411,7 +411,8 @@ static int
411411list_dbs (MYSQL * mysql ,const char * wild )
412412{
413413 const char * header ;
414- uint length , counter = 0 ;
414+ size_t length = 0 ;
415+ uint counter = 0 ;
415416 ulong rowcount = 0L ;
416417 char tables [NAME_LEN + 1 ], rows [NAME_LEN + 1 ];
417418 char query [NAME_LEN + 100 ];
@@ -449,7 +450,7 @@ list_dbs(MYSQL *mysql,const char *wild)
449450 printf ("Wildcard: %s\n" ,wild );
450451
451452 header = "Databases" ;
452- length = ( uint ) strlen (header );
453+ length = strlen (header );
453454 field = mysql_fetch_field (result );
454455 if (length < field -> max_length )
455456 length = field -> max_length ;
@@ -537,7 +538,8 @@ static int
537538list_tables (MYSQL * mysql ,const char * db ,const char * table )
538539{
539540 const char * header ;
540- uint head_length , counter = 0 ;
541+ size_t head_length ;
542+ uint counter = 0 ;
541543 char query [NAME_LEN + 100 ], rows [NAME_LEN ], fields [16 ];
542544 MYSQL_FIELD * field ;
543545 MYSQL_RES * result ;
@@ -575,7 +577,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
575577 putchar ('\n' );
576578
577579 header = "Tables" ;
578- head_length = ( uint ) strlen (header );
580+ head_length = strlen (header );
579581 field = mysql_fetch_field (result );
580582 if (head_length < field -> max_length )
581583 head_length = field -> max_length ;
@@ -805,10 +807,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
805807*****************************************************************************/
806808
807809static void
808- print_header (const char * header ,uint head_length ,...)
810+ print_header (const char * header ,size_t head_length ,...)
809811{
810812 va_list args ;
811- uint length ,i ,str_length ,pre_space ;
813+ size_t length ,i ,str_length ,pre_space ;
812814 const char * field ;
813815
814816 va_start (args ,head_length );
@@ -831,10 +833,10 @@ print_header(const char *header,uint head_length,...)
831833 putchar ('|' );
832834 for (;;)
833835 {
834- str_length = ( uint ) strlen (field );
836+ str_length = strlen (field );
835837 if (str_length > length )
836838 str_length = length + 1 ;
837- pre_space = ( uint ) ((( int ) length - ( int ) str_length )/2 )+ 1 ;
839+ pre_space = ((length - str_length )/2 )+ 1 ;
838840 for (i = 0 ; i < pre_space ; i ++ )
839841 putchar (' ' );
840842 for (i = 0 ; i < str_length ; i ++ )
@@ -868,11 +870,11 @@ print_header(const char *header,uint head_length,...)
868870
869871
870872static void
871- print_row (const char * header ,uint head_length ,...)
873+ print_row (const char * header ,size_t head_length ,...)
872874{
873875 va_list args ;
874876 const char * field ;
875- uint i ,length ,field_length ;
877+ size_t i ,length ,field_length ;
876878
877879 va_start (args ,head_length );
878880 field = header ; length = head_length ;
@@ -881,7 +883,7 @@ print_row(const char *header,uint head_length,...)
881883 putchar ('|' );
882884 putchar (' ' );
883885 fputs (field ,stdout );
884- field_length = ( uint ) strlen (field );
886+ field_length = strlen (field );
885887 for (i = field_length ; i <= length ; i ++ )
886888 putchar (' ' );
887889 if (!(field = va_arg (args ,char * )))
@@ -895,10 +897,10 @@ print_row(const char *header,uint head_length,...)
895897
896898
897899static void
898- print_trailer (uint head_length ,...)
900+ print_trailer (size_t head_length ,...)
899901{
900902 va_list args ;
901- uint length ,i ;
903+ size_t length ,i ;
902904
903905 va_start (args ,head_length );
904906 length = head_length ;
@@ -941,7 +943,7 @@ static void print_res_top(MYSQL_RES *result)
941943 mysql_field_seek (result ,0 );
942944 while ((field = mysql_fetch_field (result )))
943945 {
944- if ((length = ( uint ) strlen (field -> name )) > field -> max_length )
946+ if ((length = strlen (field -> name )) > field -> max_length )
945947 field -> max_length = length ;
946948 else
947949 length = field -> max_length ;
0 commit comments