changeset 19091:1c75e1974313 v8.2.0106

patch 8.2.0106: printf formats are not exactly right Commit: https://github.com/vim/vim/commit/b16ad968499aeb29b6ff9be6cc64fb41522a4a5e Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 8 22:06:14 2020 +0100 patch 8.2.0106: printf formats are not exactly right Problem: Printf formats are not exactly right. Solution: Adjust signed/unsigned conversions. (Frazer Clews, closes https://github.com/vim/vim/issues/5456)
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Jan 2020 22:15:03 +0100
parents df1cb3cd21ab
children 6cb1f1c1f577
files runtime/tools/ccfilter.c src/libvterm/src/parser.c src/libvterm/src/pen.c src/ui.c src/version.c
diffstat 5 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/tools/ccfilter.c
+++ b/runtime/tools/ccfilter.c
@@ -184,7 +184,7 @@ int main( int argc, char *argv[] )
 	  case COMPILER_GCC:
 	    Severity = 'e';
 #ifdef GOTO_FROM_WHERE_INCLUDED
-	    rv = sscanf( Line, "In file included from %[^:]:%u:",
+	    rv = sscanf( Line, "In file included from %[^:]:%lu:",
 			       FileName, &Row );
 	    if ( rv == 2 )
 	      {
@@ -193,11 +193,11 @@ int main( int argc, char *argv[] )
 	    else
 #endif
 	      {
-		if ((rv = sscanf( Line, "%[^:]:%u: warning: %[^\n]",
+		if ((rv = sscanf( Line, "%[^:]:%lu: warning: %[^\n]",
 				   FileName, &Row, Reason ))==3) {
 		 Severity = 'w';
 		} else {
-		rv = sscanf( Line, "%[^:]:%u: %[^\n]",
+		rv = sscanf( Line, "%[^:]:%lu: %[^\n]",
 				   FileName, &Row, Reason );
 		}
 		ok = ( rv == 3 );
@@ -205,24 +205,24 @@ int main( int argc, char *argv[] )
 	    Col = (dec_col ? 1 : 0 );
 	    break;
 	  case COMPILER_AIX:
-	    rv = sscanf( Line, "\"%[^\"]\", line %u.%u: %*s (%c) %[^\n]",
+	    rv = sscanf( Line, "\"%[^\"]\", line %lu.%lu: %*s (%c) %[^\n]",
 			       FileName, &Row, &Col, &Severity, Reason );
 	    ok = ( rv == 5 );
 	    break;
 	  case COMPILER_HPUX:
-	    rv = sscanf( Line, "cc: \"%[^\"]\", line %u: %c%*[^:]: %[^\n]",
+	    rv = sscanf( Line, "cc: \"%[^\"]\", line %lu: %c%*[^:]: %[^\n]",
 			       FileName, &Row, &Severity, Reason );
 	    ok = ( rv == 4 );
 	    Col = (dec_col ? 1 : 0 );
 	    break;
 	  case COMPILER_SOLARIS:
-	    rv = sscanf( Line, "\"%[^\"]\", line %u: warning: %[^\n]",
+	    rv = sscanf( Line, "\"%[^\"]\", line %lu: warning: %[^\n]",
 			       FileName, &Row, Reason );
 	    Severity = 'w';
 	    ok = ( rv == 3 );
 	    if ( rv != 3 )
 	      {
-		rv = sscanf( Line, "\"%[^\"]\", line %u: %[^\n]",
+		rv = sscanf( Line, "\"%[^\"]\", line %lu: %[^\n]",
 				   FileName, &Row, Reason );
 		Severity = 'e';
 		ok = ( rv == 3 );
@@ -230,18 +230,18 @@ int main( int argc, char *argv[] )
 	    Col = (dec_col ? 1 : 0 );
 	    break;
 	  case COMPILER_ATT:
-	    rv	 = sscanf( Line, "%c \"%[^\"]\",L%u/C%u%*[^:]:%[^\n]",
+	    rv	 = sscanf( Line, "%c \"%[^\"]\",L%lu/C%lu%*[^:]:%[^\n]",
 				 &Severity, FileName, &Row, &Col, Reason );
 	    ok = ( rv == 5 );
 
 	    if (rv != 5)
-	      { rv   = sscanf( Line, "%c \"%[^\"]\",L%u/C%u: %[^\n]",
+	      { rv   = sscanf( Line, "%c \"%[^\"]\",L%lu/C%lu: %[^\n]",
 				     &Severity, FileName, &Row, &Col, Reason );
 		ok = ( rv == 5 );
 	      }
 
 	    if (rv != 5)
-	      { rv  = sscanf( Line, "%c \"%[^\"]\",L%u: %[^\n]",
+	      { rv  = sscanf( Line, "%c \"%[^\"]\",L%lu: %[^\n]",
 				   &Severity, FileName, &Row, Reason );
 		ok = ( rv == 4 );
 		Col = (dec_col ? 1 : 0 );
@@ -272,10 +272,10 @@ int main( int argc, char *argv[] )
 		  }
 		 else
 		  {
-		    rv = sscanf( p+2, "%[^:]: %u: %[^\n]",
+		    rv = sscanf( p+2, "%[^:]: %lu: %[^\n]",
 				 FileName, &Row, Reason );
 		    if (rv != 3)
-		      rv = sscanf( p+2, "%[^,], line %u: %[^\n]",
+		      rv = sscanf( p+2, "%[^,], line %lu: %[^\n]",
 				   FileName, &Row, Reason );
 		    ok = ( rv == 3 );
 		  }
@@ -315,10 +315,10 @@ int main( int argc, char *argv[] )
 	{
 	  for (p=Reason; (*p) && (isspace(*p)); p++);
 	  if ( BasePath[CWDlen] == 0 )
-	      printf( "%s:%u:%u:%c:%s\n", FileName, Row, Col, Severity, p );
+	      printf( "%s:%lu:%lu:%c:%s\n", FileName, Row, Col, Severity, p );
 	  else
 	    {
-	      printf( "%s/%s:%u:%u:%c:%s\n", &BasePath[CWDlen+1], FileName, Row, Col, Severity, p );
+	      printf( "%s/%s:%lu:%lu:%c:%s\n", &BasePath[CWDlen+1], FileName, Row, Col, Severity, p );
 	    }
 	}
       if (!prefetch)
--- a/src/libvterm/src/parser.c
+++ b/src/libvterm/src/parser.c
@@ -65,7 +65,7 @@ static void append_strbuffer(VTerm *vt, 
 {
   if(len > vt->parser.strbuffer_len - vt->parser.strbuffer_cur) {
     len = vt->parser.strbuffer_len - vt->parser.strbuffer_cur;
-    DEBUG_LOG1("Truncating strbuffer preserve to %zd bytes\n", len);
+    DEBUG_LOG1("Truncating strbuffer preserve to %zu bytes\n", len);
   }
 
   if(len > 0) {
--- a/src/libvterm/src/pen.c
+++ b/src/libvterm/src/pen.c
@@ -387,7 +387,7 @@ INTERNAL void vterm_state_setpen(VTermSt
 
     if (!done)
     {
-      DEBUG_LOG1("libvterm: Unhandled CSI SGR %lu\n", arg);
+      DEBUG_LOG1("libvterm: Unhandled CSI SGR %ld\n", arg);
     }
 
     while (CSI_ARG_HAS_MORE(args[argi++]))
--- a/src/ui.c
+++ b/src/ui.c
@@ -1168,7 +1168,7 @@ clip_start_selection(int col, int row, i
     cb->prev = cb->start;
 
 #ifdef DEBUG_SELECTION
-    printf("Selection started at (%u,%u)\n", cb->start.lnum, cb->start.col);
+    printf("Selection started at (%ld,%d)\n", cb->start.lnum, cb->start.col);
 #endif
 }
 
@@ -1203,7 +1203,7 @@ clip_process_selection(
 	}
 
 #ifdef DEBUG_SELECTION
-	printf("Selection ended: (%u,%u) to (%u,%u)\n", cb->start.lnum,
+	printf("Selection ended: (%ld,%d) to (%ld,%d)\n", cb->start.lnum,
 		cb->start.col, cb->end.lnum, cb->end.col);
 #endif
 	if (clip_isautosel_star()
@@ -1347,7 +1347,7 @@ clip_process_selection(
     cb->prev.col  = col;
 
 #ifdef DEBUG_SELECTION
-	printf("Selection is: (%u,%u) to (%u,%u)\n", cb->start.lnum,
+	printf("Selection is: (%ld,%d) to (%ld,%d)\n", cb->start.lnum,
 		cb->start.col, cb->end.lnum, cb->end.col);
 #endif
 }
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    106,
+/**/
     105,
 /**/
     104,