@@ -282,11 +282,10 @@ NC_s3urlrebuild(NCURI* url, NCS3INFO* s3, NCURI** newurlp)
282282static int
283283endswith (const char * s , const char * suffix )
284284{
285- ssize_t ls , lsf , delta ;
286285 if (s == NULL || suffix == NULL ) return 0 ;
287- ls = strlen (s );
288- lsf = strlen (suffix );
289- delta = (ls - lsf );
286+ size_t ls = strlen (s );
287+ size_t lsf = strlen (suffix );
288+ ssize_t delta = ( ssize_t ) (ls - lsf );
290289 if (delta < 0 ) return 0 ;
291290 if (memcmp (s + delta ,suffix ,lsf )!= 0 ) return 0 ;
292291 return 1 ;
@@ -404,11 +403,10 @@ static void
404403freeprofile (struct AWSprofile * profile )
405404{
406405 if (profile ) {
407- int i ;
408406#ifdef AWSDEBUG
409407fprintf (stderr ,">>> freeprofile: %s\n" ,profile -> name );
410408#endif
411- for (i = 0 ;i < nclistlength (profile -> entries );i ++ ) {
409+ for (size_t i = 0 ;i < nclistlength (profile -> entries );i ++ ) {
412410 struct AWSentry * e = (struct AWSentry * )nclistget (profile -> entries ,i );
413411 freeentry (e );
414412 }
422420NC_s3freeprofilelist (NClist * profiles )
423421{
424422 if (profiles ) {
425- int i ;
426- for (i = 0 ;i < nclistlength (profiles );i ++ ) {
423+ for (size_t i = 0 ;i < nclistlength (profiles );i ++ ) {
427424 struct AWSprofile * p = (struct AWSprofile * )nclistget (profiles ,i );
428425 freeprofile (p );
429426 }
549546NC_authgets3profile (const char * profilename , struct AWSprofile * * profilep )
550547{
551548 int stat = NC_NOERR ;
552- int i = -1 ;
553549 NCglobalstate * gstate = NC_getglobalstate ();
554550
555- for (i = 0 ;i < nclistlength (gstate -> rcinfo -> s3profiles );i ++ ) {
551+ for (size_t i = 0 ;i < nclistlength (gstate -> rcinfo -> s3profiles );i ++ ) {
556552 struct AWSprofile * profile = (struct AWSprofile * )nclistget (gstate -> rcinfo -> s3profiles ,i );
557553 if (strcmp (profilename ,profile -> name )== 0 )
558554 {if (profilep ) {* profilep = profile ; goto done ;}}
@@ -572,13 +568,13 @@ NC_authgets3profile(const char* profilename, struct AWSprofile** profilep)
572568int
573569NC_s3profilelookup (const char * profile , const char * key , const char * * valuep )
574570{
575- int i , stat = NC_NOERR ;
571+ int stat = NC_NOERR ;
576572 struct AWSprofile * awsprof = NULL ;
577573 const char * value = NULL ;
578574
579575 if (profile == NULL ) return NC_ES3 ;
580576 if ((stat = NC_authgets3profile (profile ,& awsprof ))== NC_NOERR && awsprof != NULL ) {
581- for (i = 0 ;i < nclistlength (awsprof -> entries );i ++ ) {
577+ for (size_t i = 0 ;i < nclistlength (awsprof -> entries );i ++ ) {
582578 struct AWSentry * entry = (struct AWSentry * )nclistget (awsprof -> entries ,i );
583579 if (strcasecmp (entry -> key ,key )== 0 ) {
584580 value = entry -> value ;
@@ -735,7 +731,6 @@ typedef struct AWSparser {
735731static int
736732awslex (AWSparser * parser )
737733{
738- int c ;
739734 int token = 0 ;
740735 char * start ;
741736 size_t count ;
@@ -751,7 +746,7 @@ awslex(AWSparser* parser)
751746 }
752747
753748 while (token == 0 ) { /* avoid need to goto when retrying */
754- c = * parser -> pos ;
749+ char c = * parser -> pos ;
755750 if (c == '\0' ) {
756751 token = AWS_EOF ;
757752 } else if (c == '\n' ) {
@@ -785,7 +780,7 @@ awslex(AWSparser* parser)
785780 }
786781 /* Pushback last char */
787782 parser -> pos -- ;
788- count = ((parser -> pos ) - start );
783+ count = (size_t ) (parser -> pos - start );
789784 ncbytesappendn (parser -> yytext ,start ,count );
790785 ncbytesnull (parser -> yytext );
791786 token = AWS_WORD ;
@@ -811,7 +806,7 @@ fprintf(stderr,"%s(%d): |%s|\n",tokenname(token),token,ncbytescontents(parser->y
811806static int
812807awsparse (const char * text , NClist * profiles )
813808{
814- int i , stat = NC_NOERR ;
809+ int stat = NC_NOERR ;
815810 size_t len ;
816811 AWSparser * parser = NULL ;
817812 struct AWSprofile * profile = NULL ;
@@ -891,7 +886,7 @@ fprintf(stderr,">>> parse: entry=(%s,%s)\n",entry->key,entry->value);
891886 }
892887
893888 /* If this profile already exists, then replace old one */
894- for (i = 0 ;i < nclistlength (profiles );i ++ ) {
889+ for (size_t i = 0 ;i < nclistlength (profiles );i ++ ) {
895890 struct AWSprofile * p = (struct AWSprofile * )nclistget (profiles ,i );
896891 if (strcasecmp (p -> name ,profile -> name )== 0 ) {
897892 nclistset (profiles ,i ,profile );
0 commit comments