patch 8.1.2396: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar
2019-12-05 21:50:01 +01:00
parent 0d6f5d9740
commit e38eab22c1
9 changed files with 1311 additions and 1312 deletions

388
src/ui.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
* - the Vim entry in the Start Menu
*/
/* Include common code for dosinst.c and uninstall.c. */
// Include common code for dosinst.c and uninstall.c.
#include "dosinst.h"
/*
@ -41,9 +41,9 @@ reg_delete_key(HKEY hRootKey, const char *key, DWORD flag)
if (!did_load)
{
/* The RegDeleteKeyEx() function is only available on new systems. It
* is required for 64-bit registry access. For other systems fall
* back to RegDeleteKey(). */
// The RegDeleteKeyEx() function is only available on new systems. It
// is required for 64-bit registry access. For other systems fall
// back to RegDeleteKey().
did_load = TRUE;
advapi_lib = LoadLibrary("ADVAPI32.DLL");
if (advapi_lib != NULL)
@ -66,14 +66,14 @@ popup_gvim_path(char *buf, DWORD bufsize)
DWORD value_type;
int r;
/* Open the key where the path to gvim.exe is stored. */
// Open the key where the path to gvim.exe is stored.
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
KEY_WOW64_32KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
return 0;
/* get the DisplayName out of it to show the user */
// get the DisplayName out of it to show the user
r = RegQueryValueEx(key_handle, "path", 0,
&value_type, (LPBYTE)buf, &bufsize);
RegCloseKey(key_handle);
@ -92,13 +92,13 @@ openwith_gvim_path(char *buf, DWORD bufsize)
DWORD value_type;
int r;
/* Open the key where the path to gvim.exe is stored. */
// Open the key where the path to gvim.exe is stored.
if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
"Applications\\gvim.exe\\shell\\edit\\command", 0,
KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
return 0;
/* get the DisplayName out of it to show the user */
// get the DisplayName out of it to show the user
r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf, &bufsize);
RegCloseKey(key_handle);
@ -210,7 +210,7 @@ batfile_thisversion(char *path)
while (fgets(line, sizeof(line), fd) != NULL)
{
for (p = line; *p != 0; ++p)
/* don't accept "vim60an" when looking for "vim60". */
// don't accept "vim60an" when looking for "vim60".
if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
&& !isdigit(p[ver_len])
&& !isalpha(p[ver_len]))
@ -293,7 +293,7 @@ remove_start_menu(void)
remove_if_exists(path, targets[i].lnkname);
remove_if_exists(path, "uninstall.lnk");
remove_if_exists(path, "Help.lnk");
/* Win95 uses .pif, WinNT uses .lnk */
// Win95 uses .pif, WinNT uses .lnk
remove_if_exists(path, "Vim tutor.pif");
remove_if_exists(path, "Vim tutor.lnk");
remove_if_exists(path, "Vim online.url");
@ -322,13 +322,13 @@ main(int argc, char *argv[])
char path[MAX_PATH];
char popup_path[MAX_PATH];
/* The nsis uninstaller calls us with a "-nsis" argument. */
// The nsis uninstaller calls us with a "-nsis" argument.
if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
interactive = FALSE;
else
interactive = TRUE;
/* Initialize this program. */
// Initialize this program.
do_inits(argv);
printf("This program will remove the following items:\n");
@ -342,8 +342,8 @@ main(int argc, char *argv[])
if (!interactive || confirm())
{
remove_popup();
/* Assume the "Open With" entry can be removed as well, don't
* bother the user with asking him again. */
// Assume the "Open With" entry can be removed as well, don't
// bother the user with asking him again.
remove_openwith();
}
}

View File

@ -392,7 +392,7 @@ uc_list(char_u *name, size_t name_len)
long a;
garray_T *gap;
/* In cmdwin, the alternative buffer should be used. */
// In cmdwin, the alternative buffer should be used.
gap =
#ifdef FEAT_CMDWIN
(cmdwin_type != 0 && get_cmdline_type() == NUL) ?

File diff suppressed because it is too large Load Diff

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2396,
/**/
2395,
/**/

View File

@ -61,11 +61,11 @@ utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
while (todo > 0)
{
/* Only convert if we have a complete sequence. */
// Only convert if we have a complete sequence.
l = utf_ptr2len_len(p, todo);
if (l > todo)
{
/* Return length of incomplete sequence. */
// Return length of incomplete sequence.
if (unconvlenp != NULL)
*unconvlenp = todo;
break;
@ -74,7 +74,7 @@ utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
ch = utf_ptr2char(p);
if (ch >= 0x10000)
{
/* non-BMP character, encoding with surrogate pairs */
// non-BMP character, encoding with surrogate pairs
++outlen;
if (outstr != NULL)
{
@ -113,7 +113,7 @@ utf16_to_utf8(short_u *instr, int inlen, char_u *outstr)
ch = *p;
if (ch >= 0xD800 && ch <= 0xDBFF && todo > 1)
{
/* surrogate pairs handling */
// surrogate pairs handling
ch2 = p[1];
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
{
@ -148,7 +148,7 @@ MultiByteToWideChar_alloc(UINT cp, DWORD flags,
LPWSTR *out, int *outlen)
{
*outlen = MultiByteToWideChar(cp, flags, in, inlen, 0, 0);
/* Add one one word to avoid a zero-length alloc(). */
// Add one one word to avoid a zero-length alloc().
*out = ALLOC_MULT(WCHAR, *outlen + 1);
if (*out != NULL)
{
@ -168,7 +168,7 @@ WideCharToMultiByte_alloc(UINT cp, DWORD flags,
LPCSTR def, LPBOOL useddef)
{
*outlen = WideCharToMultiByte(cp, flags, in, inlen, NULL, 0, def, useddef);
/* Add one one byte to avoid a zero-length alloc(). */
// Add one one byte to avoid a zero-length alloc().
*out = alloc(*outlen + 1);
if (*out != NULL)
{
@ -198,14 +198,14 @@ win_clip_init(void)
clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");
}
/* Type used for the clipboard type of Vim's data. */
// Type used for the clipboard type of Vim's data.
typedef struct
{
int type; /* MCHAR, MBLOCK or MLINE */
int txtlen; /* length of CF_TEXT in bytes */
int ucslen; /* length of CF_UNICODETEXT in words */
int rawlen; /* length of clip_star.format_raw, including encoding,
excluding terminating NUL */
int type; // MCHAR, MBLOCK or MLINE
int txtlen; // length of CF_TEXT in bytes
int ucslen; // length of CF_UNICODETEXT in words
int rawlen; // length of clip_star.format_raw, including encoding,
// excluding terminating NUL
} VimClipType_t;
/*
@ -227,7 +227,7 @@ clip_mch_own_selection(Clipboard_T *cbd UNUSED)
void
clip_mch_lose_selection(Clipboard_T *cbd UNUSED)
{
/* Nothing needs to be done here */
// Nothing needs to be done here
}
/*
@ -243,7 +243,7 @@ crnl_to_nl(const char_u *str, int *size)
char_u *ret;
char_u *retp;
/* Avoid allocating zero bytes, it generates an error message. */
// Avoid allocating zero bytes, it generates an error message.
ret = alloc(str_len == 0 ? 1 : str_len);
if (ret != NULL)
{
@ -274,9 +274,9 @@ vim_open_clipboard(void)
while (!OpenClipboard(NULL))
{
if (delay > 500)
return FALSE; /* waited too long, give up */
return FALSE; // waited too long, give up
Sleep(delay);
delay *= 2; /* wait for 10, 20, 40, 80, etc. msec */
delay *= 2; // wait for 10, 20, 40, 80, etc. msec
}
return TRUE;
}
@ -311,19 +311,19 @@ clip_mch_request_selection(Clipboard_T *cbd)
if (!vim_open_clipboard())
return;
/* Check for vim's own clipboard format first. This only gets the type of
* the data, still need to use CF_UNICODETEXT or CF_TEXT for the text. */
// Check for vim's own clipboard format first. This only gets the type of
// the data, still need to use CF_UNICODETEXT or CF_TEXT for the text.
if (IsClipboardFormatAvailable(cbd->format))
{
VimClipType_t *meta_p;
HGLOBAL meta_h;
/* We have metadata on the clipboard; try to get it. */
// We have metadata on the clipboard; try to get it.
if ((meta_h = GetClipboardData(cbd->format)) != NULL
&& (meta_p = (VimClipType_t *)GlobalLock(meta_h)) != NULL)
{
/* The size of "VimClipType_t" changed, "rawlen" was added later.
* Only copy what is available for backwards compatibility. */
// The size of "VimClipType_t" changed, "rawlen" was added later.
// Only copy what is available for backwards compatibility.
n = sizeof(VimClipType_t);
if (GlobalSize(meta_h) < n)
n = GlobalSize(meta_h);
@ -332,12 +332,12 @@ clip_mch_request_selection(Clipboard_T *cbd)
}
}
/* Check for Vim's raw clipboard format first. This is used without
* conversion, but only if 'encoding' matches. */
// Check for Vim's raw clipboard format first. This is used without
// conversion, but only if 'encoding' matches.
if (IsClipboardFormatAvailable(cbd->format_raw)
&& metadata.rawlen > (int)STRLEN(p_enc))
{
/* We have raw data on the clipboard; try to get it. */
// We have raw data on the clipboard; try to get it.
if ((rawh = GetClipboardData(cbd->format_raw)) != NULL)
{
char_u *rawp;
@ -358,7 +358,7 @@ clip_mch_request_selection(Clipboard_T *cbd)
}
if (str == NULL)
{
/* Try to get the clipboard in Unicode if it's not an empty string. */
// Try to get the clipboard in Unicode if it's not an empty string.
if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0)
{
HGLOBAL hMemW;
@ -367,8 +367,8 @@ clip_mch_request_selection(Clipboard_T *cbd)
{
WCHAR *hMemWstr = (WCHAR *)GlobalLock(hMemW);
/* Use the length of our metadata if possible, but limit it to
* the GlobalSize() for safety. */
// Use the length of our metadata if possible, but limit it to
// the GlobalSize() for safety.
maxlen = (int)(GlobalSize(hMemW) / sizeof(WCHAR));
if (metadata.ucslen >= 0)
{
@ -387,15 +387,15 @@ clip_mch_request_selection(Clipboard_T *cbd)
GlobalUnlock(hMemW);
}
}
/* Get the clipboard in the Active codepage. */
// Get the clipboard in the Active codepage.
else if (IsClipboardFormatAvailable(CF_TEXT))
{
if ((hMem = GetClipboardData(CF_TEXT)) != NULL)
{
str = (char_u *)GlobalLock(hMem);
/* The length is either what our metadata says or the strlen().
* But limit it to the GlobalSize() for safety. */
// The length is either what our metadata says or the strlen().
// But limit it to the GlobalSize() for safety.
maxlen = (int)GlobalSize(hMem);
if (metadata.txtlen >= 0)
{
@ -411,8 +411,8 @@ clip_mch_request_selection(Clipboard_T *cbd)
break;
}
/* The text is in the active codepage. Convert to
* 'encoding', going through UTF-16. */
// The text is in the active codepage. Convert to
// 'encoding', going through UTF-16.
acp_to_enc(str, str_size, &to_free, &maxlen);
if (to_free != NULL)
{
@ -427,11 +427,11 @@ clip_mch_request_selection(Clipboard_T *cbd)
{
char_u *temp_clipboard;
/* If the type is not known detect it. */
// If the type is not known detect it.
if (metadata.type == -1)
metadata.type = MAUTO;
/* Translate <CR><NL> into <NL>. */
// Translate <CR><NL> into <NL>.
temp_clipboard = crnl_to_nl(str, &str_size);
if (temp_clipboard != NULL)
{
@ -440,7 +440,7 @@ clip_mch_request_selection(Clipboard_T *cbd)
}
}
/* unlock the global object */
// unlock the global object
if (hMem != NULL)
GlobalUnlock(hMem);
if (rawh != NULL)
@ -463,12 +463,12 @@ clip_mch_set_selection(Clipboard_T *cbd)
HGLOBAL hMemVim = NULL;
HGLOBAL hMemW = NULL;
/* If the '*' register isn't already filled in, fill it in now */
// If the '*' register isn't already filled in, fill it in now
cbd->owned = TRUE;
clip_get_selection(cbd);
cbd->owned = FALSE;
/* Get the text to be put on the clipboard, with CR-LF. */
// Get the text to be put on the clipboard, with CR-LF.
metadata.type = clip_convert_selection(&str, &txtlen, cbd);
if (metadata.type < 0)
return;
@ -476,9 +476,9 @@ clip_mch_set_selection(Clipboard_T *cbd)
metadata.ucslen = 0;
metadata.rawlen = 0;
/* Always set the raw bytes: 'encoding', NUL and the text. This is used
* when copy/paste from/to Vim with the same 'encoding', so that illegal
* bytes can also be copied and no conversion is needed. */
// Always set the raw bytes: 'encoding', NUL and the text. This is used
// when copy/paste from/to Vim with the same 'encoding', so that illegal
// bytes can also be copied and no conversion is needed.
{
LPSTR lpszMemRaw;
@ -500,15 +500,15 @@ clip_mch_set_selection(Clipboard_T *cbd)
WCHAR *out;
int len = metadata.txtlen;
/* Convert the text to UTF-16. This is put on the clipboard as
* CF_UNICODETEXT. */
// Convert the text to UTF-16. This is put on the clipboard as
// CF_UNICODETEXT.
out = (WCHAR *)enc_to_utf16(str, &len);
if (out != NULL)
{
WCHAR *lpszMemW;
/* Convert the text for CF_TEXT to Active codepage. Otherwise it's
* p_enc, which has no relation to the Active codepage. */
// Convert the text for CF_TEXT to Active codepage. Otherwise it's
// p_enc, which has no relation to the Active codepage.
metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
NULL, 0, 0, 0);
vim_free(str);
@ -516,13 +516,13 @@ clip_mch_set_selection(Clipboard_T *cbd)
if (str == NULL)
{
vim_free(out);
return; /* out of memory */
return; // out of memory
}
WideCharToMultiByte(GetACP(), 0, out, len,
(LPSTR)str, metadata.txtlen, 0, 0);
/* Allocate memory for the UTF-16 text, add one NUL word to
* terminate the string. */
// Allocate memory for the UTF-16 text, add one NUL word to
// terminate the string.
hMemW = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
(len + 1) * sizeof(WCHAR));
lpszMemW = (WCHAR *)GlobalLock(hMemW);
@ -537,8 +537,7 @@ clip_mch_set_selection(Clipboard_T *cbd)
}
}
/* Allocate memory for the text, add one NUL byte to terminate the string.
*/
// Allocate memory for the text, add one NUL byte to terminate the string.
hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, metadata.txtlen + 1);
{
LPSTR lpszMem = (LPSTR)GlobalLock(hMem);
@ -550,7 +549,7 @@ clip_mch_set_selection(Clipboard_T *cbd)
}
}
/* Set up metadata: */
// Set up metadata:
{
VimClipType_t *lpszMemVim = NULL;
@ -580,8 +579,8 @@ clip_mch_set_selection(Clipboard_T *cbd)
if (SetClipboardData(CF_UNICODETEXT, hMemW) != NULL)
hMemW = NULL;
}
/* Always use CF_TEXT. On Win98 Notepad won't obtain the
* CF_UNICODETEXT text, only CF_TEXT. */
// Always use CF_TEXT. On Win98 Notepad won't obtain the
// CF_UNICODETEXT text, only CF_TEXT.
SetClipboardData(CF_TEXT, hMem);
hMem = 0;
}
@ -589,7 +588,7 @@ clip_mch_set_selection(Clipboard_T *cbd)
}
vim_free(str);
/* Free any allocations we didn't give to the clipboard: */
// Free any allocations we didn't give to the clipboard:
if (hMemRaw)
GlobalFree(hMemRaw);
if (hMem)
@ -600,7 +599,7 @@ clip_mch_set_selection(Clipboard_T *cbd)
GlobalFree(hMemVim);
}
#endif /* FEAT_CLIPBOARD */
#endif // FEAT_CLIPBOARD
/*
* Note: the following two functions are only guaranteed to work when using
@ -631,16 +630,16 @@ enc_to_utf16(char_u *str, int *lenp)
if (enc_codepage > 0)
{
/* We can do any CP### -> UTF-16 in one pass, and we can do it
* without iconv() (convert_* may need iconv). */
// We can do any CP### -> UTF-16 in one pass, and we can do it
// without iconv() (convert_* may need iconv).
MultiByteToWideChar_alloc(enc_codepage, 0, (LPCSTR)str, *lenp,
&ret, &length);
}
else
{
/* Use "latin1" by default, we might be called before we have p_enc
* set up. Convert to utf-8 first, works better with iconv(). Does
* nothing if 'encoding' is "utf-8". */
// Use "latin1" by default, we might be called before we have p_enc
// set up. Convert to utf-8 first, works better with iconv(). Does
// nothing if 'encoding' is "utf-8".
conv.vc_type = CONV_NONE;
if (convert_setup(&conv, p_enc ? p_enc : (char_u *)"latin1",
(char_u *)"utf-8") == FAIL)
@ -691,7 +690,7 @@ utf16_to_enc(short_u *str, int *lenp)
if (enc_codepage > 0)
{
/* We can do any UTF-16 -> CP### in one pass. */
// We can do any UTF-16 -> CP### in one pass.
int length;
WideCharToMultiByte_alloc(enc_codepage, 0, str, *lenp,
@ -700,19 +699,19 @@ utf16_to_enc(short_u *str, int *lenp)
return enc_str;
}
/* Avoid allocating zero bytes, it generates an error message. */
// Avoid allocating zero bytes, it generates an error message.
utf8_str = alloc(utf16_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
if (utf8_str != NULL)
{
*lenp = utf16_to_utf8(str, *lenp, utf8_str);
/* We might be called before we have p_enc set up. */
// We might be called before we have p_enc set up.
conv.vc_type = CONV_NONE;
convert_setup(&conv, (char_u *)"utf-8",
p_enc? p_enc: (char_u *)"latin1");
if (conv.vc_type == CONV_NONE)
{
/* p_enc is utf-8, so we're done. */
// p_enc is utf-8, so we're done.
enc_str = utf8_str;
}
else
@ -746,7 +745,7 @@ acp_to_enc(
&widestr, outlen);
if (widestr != NULL)
{
++*outlen; /* Include the 0 after the string */
++*outlen; // Include the 0 after the string
*out = utf16_to_enc((short_u *)widestr, outlen);
vim_free(widestr);
}

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
#include "xpm_w32.h"
/* Engage Windows support in libXpm */
// Engage Windows support in libXpm
#define FOR_MSW
#include "xpm.h"
@ -33,8 +33,8 @@ LoadXpmImage(
HBITMAP *hImage,
HBITMAP *hShape)
{
XImage *img; /* loaded image */
XImage *shp; /* shapeimage */
XImage *img; // loaded image
XImage *shp; // shapeimage
XpmAttributes attr;
int res;
HDC hdc = CreateCompatibleDC(NULL);