changeset 13353:8412df1479a3 v8.0.1550

patch 8.0.1550: various small problems in source files commit https://github.com/vim/vim/commit/792f0e36593d1ec13ccb8a622ca5542c500577b4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 27 17:27:13 2018 +0100 patch 8.0.1550: various small problems in source files Problem: Various small problems in source files. Solution: Fix the problems.
author Christian Brabandt <cb@256bit.org>
date Tue, 27 Feb 2018 17:30:08 +0100
parents 764ce635fdc7
children 8b0167c77d90
files src/Makefile src/README.txt src/beval.c src/dosinst.c src/gui_gtk.c src/if_py_both.h src/if_python.c src/if_xcmdsrv.c src/iscygpty.c src/json_test.c src/libvterm/include/vterm_keycodes.h src/mbyte.c src/os_vms.c src/pty.c src/version.c src/vimrun.c uninstal.txt
diffstat 17 files changed, 98 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile
+++ b/src/Makefile
@@ -651,12 +651,16 @@ LINT_OPTIONS = -beprxzF
 
 # PROFILING - Uncomment the next two lines to do profiling with gcc and gprof.
 # Might not work with GUI or Perl.
-# For unknown reasons adding "-lc" fixes a linking problem with some versions
-# of GCC.  That's probably a bug in the "-pg" implementation.
 # After running Vim see the profile result with: gprof vim gmon.out | vim -
 # Need to recompile everything after changing this: "make clean" "make".
 #PROFILE_CFLAGS = -pg -g -DWE_ARE_PROFILING
 #PROFILE_LIBS = -pg
+
+# GCC 5 and later need the -no-pie argument.
+#PROFILE_LIBS = -pg -no-pie
+
+# For unknown reasons adding "-lc" fixes a linking problem with some versions
+# of GCC.  That's probably a bug in the "-pg" implementation.
 #PROFILE_LIBS = -pg -lc
 
 
--- a/src/README.txt
+++ b/src/README.txt
@@ -8,8 +8,8 @@ You might also want to read ":help devel
 
 JUMPING AROUND
 
-First of all, use ":make tags" to generate a tags file, so that you can use
-the ":tag" command to jump around the source code.
+First of all, use ":make tags" to generate a tags file, so that you can jump
+around in the source code.
 
 To jump to a function or variable definition, move the cursor on the name and
 use the CTRL-] command.  Use CTRL-T or CTRL-O to jump back.
@@ -43,6 +43,21 @@ Most code can be found in a file with an
 	window.c	handling split windows
 
 
+DEBUGGING
+
+If you have a reasonable recent version of gdb, you can use the :Termdebug
+command to debug Vim.  See  ":help :Termdebug".
+
+When something is time critical or stepping through code is a hassle, use the
+channel logging to create a time-stamped log file.  Add lines to the code like
+this:
+	ch_log(NULL, "Value is now %02x", value);
+After compiling and starting Vim, do:
+	:call ch_logfile('debuglog', 'w')
+And edit "debuglog" to see what happens.  The channel functions already have
+ch_log() calls, thus you always see that in the log.
+
+
 IMPORTANT VARIABLES
 
 The current mode is stored in "State".  The values it can have are NORMAL,
--- a/src/beval.c
+++ b/src/beval.c
@@ -137,7 +137,7 @@ get_beval_info(
  * Show a balloon with "mesg" or "list".
  */
     void
-post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list)
+post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED)
 {
 # ifdef FEAT_BEVAL_TERM
 #  ifdef FEAT_GUI
--- a/src/dosinst.c
+++ b/src/dosinst.c
@@ -1200,8 +1200,8 @@ install_vimrc(int idx)
 
 	/* If the path has a space:  When using cmd.exe (Win NT/2000/XP) put
 	 * quotes around the diff command and rely on the default value of
-         * shellxquote to solve the quoting problem for the whole command.
-         *
+	 * shellxquote to solve the quoting problem for the whole command.
+	 *
 	 * Otherwise put a double quote just before the space and at the
 	 * end of the command.  Putting quotes around the whole thing
 	 * doesn't work on Win 95/98/ME.  This is mostly guessed! */
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1895,8 +1895,8 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
 	trigger.window     = gtk_widget_get_window(gui.drawarea);
 	trigger.send_event = FALSE;
 	trigger.time       = gui.event_time;
-	trigger.x          = 0.0;
-	trigger.y          = 0.0;
+	trigger.x	   = 0.0;
+	trigger.y	   = 0.0;
 	trigger.axes       = NULL;
 	trigger.state      = 0;
 	trigger.button     = 3;
@@ -1983,8 +1983,8 @@ gui_make_popup(char_u *path_name, int mo
 	trigger.window     = win;
 	trigger.send_event = FALSE;
 	trigger.time       = GDK_CURRENT_TIME;
-	trigger.x          = 0.0;
-	trigger.y          = 0.0;
+	trigger.x	   = 0.0;
+	trigger.y	   = 0.0;
 	trigger.axes       = NULL;
 	trigger.state      = 0;
 	trigger.button     = 0;
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -5996,7 +5996,7 @@ convert_dl(PyObject *obj, typval_T *tv,
     PyObject	*capsule;
     char	hexBuf[sizeof(void *) * 2 + 3];
 
-    sprintf(hexBuf, "%p", obj);
+    sprintf(hexBuf, "%p", (void *)obj);
 
 # ifdef PY_USE_CAPSULE
     capsule = PyDict_GetItemString(lookup_dict, hexBuf);
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -74,7 +74,7 @@
 #undef HAVE_FCNTL_H /* Clash with os_win32.h */
 
 #define PyBytes_FromString      PyString_FromString
-#define PyBytes_Check           PyString_Check
+#define PyBytes_Check		PyString_Check
 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
 
 #if !defined(FEAT_PYTHON) && defined(PROTO)
--- a/src/if_xcmdsrv.c
+++ b/src/if_xcmdsrv.c
@@ -1123,7 +1123,7 @@ GetRegProp(
  * This procedure is invoked by the various X event loops throughout Vims when
  * a property changes on the communication window.  This procedure reads the
  * property and enqueues command requests and responses. If immediate is true,
- * it runs the event immediatly instead of enqueuing it. Immediate can cause
+ * it runs the event immediately instead of enqueuing it. Immediate can cause
  * unintended behavior and should only be used for code that blocks for a
  * response.
  */
--- a/src/iscygpty.c
+++ b/src/iscygpty.c
@@ -62,20 +62,18 @@
 //#define USE_DYNFILEID
 #ifdef USE_DYNFILEID
 typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)(
-		HANDLE                    hFile,
-		FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
-		LPVOID                    lpFileInformation,
-		DWORD                     dwBufferSize
-);
+		HANDLE						hFile,
+		FILE_INFO_BY_HANDLE_CLASS	FileInformationClass,
+		LPVOID						lpFileInformation,
+		DWORD						dwBufferSize);
 static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;
 
 # ifndef USE_FILEEXTD
 static BOOL WINAPI stub_GetFileInformationByHandleEx(
-		HANDLE                    hFile,
-		FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
-		LPVOID                    lpFileInformation,
-		DWORD                     dwBufferSize
-		)
+		HANDLE						hFile,
+		FILE_INFO_BY_HANDLE_CLASS	FileInformationClass,
+		LPVOID						lpFileInformation,
+		DWORD						dwBufferSize)
 {
 	return FALSE;
 }
--- a/src/json_test.c
+++ b/src/json_test.c
@@ -162,7 +162,7 @@ test_fill_called_on_find_end(void)
     reader.js_fill = fill_from_cookie;
     reader.js_used = 0;
     reader.js_buf = (char_u *)"  [  \"a\"  ,  123  ";
-    reader.js_cookie =        "  [  \"a\"  ,  123  ]  ";
+    reader.js_cookie =	      "  [  \"a\"  ,  123  ]  ";
     assert(json_find_end(&reader, 0) == OK);
     reader.js_buf = (char_u *)"  [  \"a\"  ,  ";
     assert(json_find_end(&reader, 0) == OK);
@@ -186,7 +186,7 @@ test_fill_called_on_string(void)
     reader.js_used = 0;
     reader.js_buf = (char_u *)" \"foo";
     reader.js_end = reader.js_buf + STRLEN(reader.js_buf);
-    reader.js_cookie =        " \"foobar\"  ";
+    reader.js_cookie =	      " \"foobar\"  ";
     assert(json_decode_string(&reader, NULL, '"') == OK);
 }
 #endif
--- a/src/libvterm/include/vterm_keycodes.h
+++ b/src/libvterm/include/vterm_keycodes.h
@@ -8,6 +8,7 @@ typedef enum {
   VTERM_MOD_CTRL  = 0x04
 } VTermModifier;
 
+/* The order here must match keycodes[] in src/keyboard.c! */
 typedef enum {
   VTERM_KEY_NONE,
 
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2260,7 +2260,6 @@ utf_char2len(int c)
 /*
  * Convert Unicode character "c" to UTF-8 string in "buf[]".
  * Returns the number of bytes.
- * This does not include composing characters.
  */
     int
 utf_char2bytes(int c, char_u *buf)
--- a/src/os_vms.c
+++ b/src/os_vms.c
@@ -18,7 +18,7 @@
 /* based on Alpha's gen64def.h; the file is absent on VAX */
 typedef struct _generic_64 {
 #   pragma __nomember_alignment
-    __union  {                          /* You can treat me as...  */
+    __union  {				/* You can treat me as...  */
 	/* long long is not available on VAXen */
 	/* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */
 
@@ -461,8 +461,7 @@ mch_expand_wildcards(int num_pat, char_u
 	result = decc$translate_vms(vms_fixfilename(buf));
 	if ( (int) result == 0 || (int) result == -1  ) {
 	    cnt = 0;
-	}
-        else {
+	} else {
 	    cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ;
 	}
 	if (cnt > 0)
@@ -519,10 +518,9 @@ mch_expandpath(garray_T *gap, char_u *pa
     /* otherwise it might create ACCVIO error in decc$to_vms      */
     result = decc$translate_vms(vms_fixfilename(path));
     if ( (int) result == 0 || (int) result == -1  ) {
-        cnt = 0;
-    }
-    else {
-        cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
+	cnt = 0;
+    } else {
+	cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
     }
     if (cnt > 0)
 	cnt = vms_match_num;
@@ -741,68 +739,66 @@ RealWaitForChar(
 	get_tty();
 
     if (sec > 0) {
-        /* time-out specified; convert it to absolute time */
+	/* time-out specified; convert it to absolute time */
 	/* sec>0 requirement of lib$cvtf_to_internal_time()*/
 
-        /* get current time (number of 100ns ticks since the VMS Epoch) */
-        status = sys$gettim(&time_curr);
-        if (status != SS$_NORMAL)
-            return 0; /* error */
-        /* construct the delta time */
+	/* get current time (number of 100ns ticks since the VMS Epoch) */
+	status = sys$gettim(&time_curr);
+	if (status != SS$_NORMAL)
+	    return 0; /* error */
+	/* construct the delta time */
 #if __G_FLOAT==0
 # ifndef VAX
 	/* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */
-        status = lib$cvts_to_internal_time(
-                &convert_operation, &sec, &time_diff);
+	status = lib$cvts_to_internal_time(
+		&convert_operation, &sec, &time_diff);
 # endif
 #else   /* default on Alpha and VAX  */
-        status = lib$cvtf_to_internal_time(
+	status = lib$cvtf_to_internal_time(
 		&convert_operation, &sec, &time_diff);
 #endif
-        if (status != LIB$_NORMAL)
-            return 0; /* error */
-        /* add them up */
-        status = lib$add_times(
-                &time_curr,
-                &time_diff,
-                &time_out);
-        if (status != LIB$_NORMAL)
-            return 0; /* error */
+	if (status != LIB$_NORMAL)
+	    return 0; /* error */
+	/* add them up */
+	status = lib$add_times(
+		&time_curr,
+		&time_diff,
+		&time_out);
+	if (status != LIB$_NORMAL)
+	    return 0; /* error */
     }
 
     while (TRUE) {
-        /* select() */
-        status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
-                0, 0, &typeahead, 8, 0, 0, 0, 0);
+	/* select() */
+	status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
+		0, 0, &typeahead, 8, 0, 0, 0, 0);
 	if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
-            return 0; /* error */
+	    return 0; /* error */
 
-        if (typeahead.numchars)
-            return 1; /* ready to read */
+	if (typeahead.numchars)
+	    return 1; /* ready to read */
 
-        /* there's nothing to read; what now? */
-        if (msec == 0) {
-            /* immediate time-out; return impatiently */
-            return 0;
-        }
-        else if (msec < 0) {
-            /* no time-out; wait on indefinitely */
-            continue;
-        }
-        else {
-            /* time-out needs to be checked */
-            status = sys$gettim(&time_curr);
-            if (status != SS$_NORMAL)
-                return 0; /* error */
+	/* there's nothing to read; what now? */
+	if (msec == 0) {
+	    /* immediate time-out; return impatiently */
+	    return 0;
+	} else if (msec < 0) {
+	    /* no time-out; wait on indefinitely */
+	    continue;
+	} else {
+	    /* time-out needs to be checked */
+	    status = sys$gettim(&time_curr);
+	    if (status != SS$_NORMAL)
+		return 0; /* error */
 
-            status = lib$sub_times(
-                    &time_out,
-                    &time_curr,
-                    &time_diff);
-            if (status != LIB$_NORMAL)
-                return 0; /* error, incl. time_diff < 0 (i.e. time-out) */
+	    status = lib$sub_times(
+		    &time_out,
+		    &time_curr,
+		    &time_diff);
+	    if (status != LIB$_NORMAL)
+		return 0; /* error, incl. time_diff < 0 (i.e. time-out) */
 
-            /* otherwise wait some more */
-        }
+	    /* otherwise wait some more */
+	}
     }
 }
--- a/src/pty.c
+++ b/src/pty.c
@@ -268,7 +268,7 @@ OpenPTY(char **ttyn)
 #endif
 
 #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \
-                    && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6))
+	    && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6))
 
 /* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
  * Same for Mac OS X Leopard (10.5). */
--- a/src/version.c
+++ b/src/version.c
@@ -779,6 +779,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1550,
+/**/
     1549,
 /**/
     1548,
--- a/src/vimrun.c
+++ b/src/vimrun.c
@@ -55,7 +55,7 @@ main(void)
 	++p;
     }
     while (*p == L' ')
-        ++p;
+	++p;
 
     /*
      * "-s" argument: don't wait for a key hit.
--- a/uninstal.txt
+++ b/uninstal.txt
@@ -5,7 +5,7 @@ There are three ways to remove Vim:
 1. With the GUI uninstaller.
    This is only available when Vim was installed with the self-installing
    executable.  This has a minimal number of questions.  It can delete
-   everything that was installed.  This also unregisters the VisVim.dll
+   everything that was installed.  This also unregisters the VisVim.dll.
 
 2. With uninstal.exe.
    This removes most installed items, but does not delete the files you