0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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

View File

@@ -392,7 +392,7 @@ uc_list(char_u *name, size_t name_len)
long a; long a;
garray_T *gap; garray_T *gap;
/* In cmdwin, the alternative buffer should be used. */ // In cmdwin, the alternative buffer should be used.
gap = gap =
#ifdef FEAT_CMDWIN #ifdef FEAT_CMDWIN
(cmdwin_type != 0 && get_cmdline_type() == NUL) ? (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[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2396,
/**/ /**/
2395, 2395,
/**/ /**/

View File

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

File diff suppressed because it is too large Load Diff

View File

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