@@ -107,7 +107,7 @@ void print_version (char const* arg);
107
107
void print_usage (char const * arg );
108
108
109
109
/* functionality */
110
- int check_localdate (void );
110
+ long check_localdate (void );
111
111
int update_localdate (void );
112
112
int has_localdb (void );
113
113
int update_localdb (int verbose );
@@ -244,7 +244,7 @@ main(int argc, char** argv)
244
244
245
245
if (optind < argc )
246
246
{
247
- int len , sum ;
247
+ size_t len , sum ;
248
248
char buf [4096 ];
249
249
250
250
sum = 0 ;
@@ -328,7 +328,7 @@ parse_tldrpage(char const* input)
328
328
int i , len ;
329
329
int start = -1 ;
330
330
331
- len = strlen (input );
331
+ len = ( int ) strlen (input );
332
332
333
333
fprintf (stdout , "\n" );
334
334
for (i = 0 ; i < len ; ++ i )
@@ -547,7 +547,7 @@ print_usage(char const* arg)
547
547
/* *INDENT-ON* */
548
548
}
549
549
550
- int
550
+ long
551
551
check_localdate (void )
552
552
{
553
553
FILE * fp ;
@@ -561,19 +561,19 @@ check_localdate(void)
561
561
time_t difftime ;
562
562
563
563
homedir = _gethome ();
564
- if (homedir == NULL ) { return 1 ; }
564
+ if (homedir == NULL ) { return - 1 ; }
565
565
566
566
curlen = 0 ;
567
567
if (sstrncat (outdir , & curlen , STRBUFSIZ , homedir , strlen (homedir )))
568
- { return 1 ; }
568
+ { return - 1 ; }
569
569
if (sstrncat (outdir , & curlen , STRBUFSIZ , TLDR_DATE , TLDR_DATE_LEN ))
570
- { return 1 ; }
570
+ { return - 1 ; }
571
571
572
572
fp = fopen (outdir , "rb" );
573
573
if (!fp ) { return -1 ; }
574
574
575
575
if (fseek (fp , 0 , SEEK_END )) { goto error ; }
576
- len = ftell (fp );
576
+ if (( len = ( size_t ) ftell (fp )) == ( size_t ) EOF ) { goto error ; }
577
577
if (fseek (fp , 0 , SEEK_SET )) { goto error ; }
578
578
579
579
read = fread (buffer , 1 , len , fp );
@@ -777,7 +777,7 @@ get_file_content(char const* path, char** out, int verbose)
777
777
if (!fp ) { return 1 ; }
778
778
779
779
if (fseek (fp , 0 , SEEK_END )) { goto error ; }
780
- len = ftell (fp );
780
+ if (( len = ( size_t ) ftell (fp )) == ( size_t ) EOF ) { goto error ; }
781
781
if (fseek (fp , 0 , SEEK_SET )) { goto error ; }
782
782
783
783
* out = malloc (len );
874
874
_unzip (char const * path , char const * outpath )
875
875
{
876
876
int err ;
877
- int i , len ;
877
+ long i , len ;
878
878
size_t filelen ;
879
879
struct zip * archive ;
880
880
struct zip_file * file ;
@@ -893,7 +893,7 @@ _unzip(char const* path, char const* outpath)
893
893
len = zip_get_num_entries (archive , 0 );
894
894
for (i = 0 ; i < len ; i ++ )
895
895
{
896
- if (zip_stat_index (archive , i , 0 , & stat ))
896
+ if (zip_stat_index (archive , ( zip_uint64_t ) i , 0 , & stat ))
897
897
{
898
898
goto error ;
899
899
}
@@ -918,7 +918,7 @@ _unzip(char const* path, char const* outpath)
918
918
}
919
919
else
920
920
{
921
- file = zip_fopen_index (archive , i , 0 );
921
+ file = zip_fopen_index (archive , ( zip_uint64_t ) i , 0 );
922
922
if (!file )
923
923
{
924
924
fprintf (stderr , "Error: Opening zip content: %s" , tmp );
@@ -936,7 +936,7 @@ _unzip(char const* path, char const* outpath)
936
936
sum = 0 ;
937
937
while (sum != stat .size )
938
938
{
939
- filelen = zip_fread (file , buf , 4096 );
939
+ filelen = ( size_t ) zip_fread (file , buf , 4096 );
940
940
if (len < 0 )
941
941
{
942
942
fprintf (stderr , "Error: Reading file: %s\n" , tmp );
@@ -999,7 +999,7 @@ progress_callback(void* clientp, curl_off_t dltotal, curl_off_t dlnow,
999
999
if (dltotal <= 0 ) { return 0 ; }
1000
1000
1001
1001
progress = dlnow / dltotal ;
1002
- total = _round (progress * 40.0 );
1002
+ total = ( int ) _round (progress * 40.0 );
1003
1003
1004
1004
printf ("%s [" , (char * )clientp );
1005
1005
for (i = 0 ; i < total ; i ++ )
@@ -1033,7 +1033,8 @@ download_file(char const* url, char const* outfile, int verbose)
1033
1033
curl = curl_easy_init ();
1034
1034
if (curl )
1035
1035
{
1036
- int len , ret = 1 ;
1036
+ size_t len ;
1037
+ int ret = 1 ;
1037
1038
FILE * file ;
1038
1039
char * base ;
1039
1040
char filename [FILENAME_MAX ];
0 commit comments