diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-24 16:39:02 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-24 16:39:02 +0100 |
commit | a12a161b8ce09d024ed71c2134149fa323f8ee8e (patch) | |
tree | c427f558df74f47fb09ac84c091eba2ea28ecfd7 | |
parent | 091806d6f0f0481b88daa7d3a24006e54c25cd6f (diff) |
patch 8.1.0809: too many #ifdefsv8.1.0809
Problem: Too many #ifdefs.
Solution: Graduate FEAT_MBYTE, part 3.
-rw-r--r-- | src/os_amiga.c | 6 | ||||
-rw-r--r-- | src/os_mswin.c | 57 | ||||
-rw-r--r-- | src/os_unix.c | 24 | ||||
-rw-r--r-- | src/os_w32exe.c | 2 | ||||
-rw-r--r-- | src/os_win32.c | 134 | ||||
-rw-r--r-- | src/quickfix.c | 42 | ||||
-rw-r--r-- | src/regexp.c | 207 | ||||
-rw-r--r-- | src/regexp_nfa.c | 79 | ||||
-rw-r--r-- | src/screen.c | 371 | ||||
-rw-r--r-- | src/version.c | 2 |
10 files changed, 112 insertions, 812 deletions
diff --git a/src/os_amiga.c b/src/os_amiga.c index de8bf190ab..4a6814cfc5 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -165,18 +165,12 @@ mch_inchar( for (;;) /* repeat until we got a character */ { -# ifdef FEAT_MBYTE len = Read(raw_in, (char *)buf, (long)maxlen / input_conv.vc_factor); -# else - len = Read(raw_in, (char *)buf, (long)maxlen); -# endif if (len > 0) { -#ifdef FEAT_MBYTE /* Convert from 'termencoding' to 'encoding'. */ if (input_conv.vc_type != CONV_NONE) len = convert_input(buf, len, maxlen); -#endif return len; } } diff --git a/src/os_mswin.c b/src/os_mswin.c index 6310f47bc9..363dc4666e 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -282,7 +282,6 @@ mch_settitle( # else if (title != NULL) { -# ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { /* Convert the title from 'encoding' to the active codepage. */ @@ -295,7 +294,6 @@ mch_settitle( return; } } -# endif SetConsoleTitle((LPCSTR)title); } # endif @@ -361,7 +359,6 @@ mch_FullName( else #endif { -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wname; @@ -387,7 +384,6 @@ mch_FullName( vim_free(cname); } if (nResult == FAIL) /* fall back to non-wide function */ -#endif { if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL) { @@ -415,14 +411,10 @@ mch_FullName( int mch_isFullName(char_u *fname) { -#ifdef FEAT_MBYTE /* WinNT and later can use _MAX_PATH wide characters for a pathname, which * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is * UTF-8. */ char szName[_MAX_PATH * 3 + 1]; -#else - char szName[_MAX_PATH + 1]; -#endif /* A name like "d:/foo" and "//server/share" is absolute */ if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\')) @@ -538,11 +530,10 @@ stat_symlink_aware(const char *name, stat_T *stp) return stat(name, stp); } -#ifdef FEAT_MBYTE static int wstat_symlink_aware(const WCHAR *name, stat_T *stp) { -# if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__) +#if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__MINGW32__) /* Work around for VC12 or earlier (and MinGW). _wstat() can't handle * symlinks properly. * VC9 or earlier: _wstat() doesn't support a symlink at all. It retrieves @@ -587,10 +578,9 @@ wstat_symlink_aware(const WCHAR *name, stat_T *stp) return n; } } -# endif +#endif return _wstat(name, (struct _stat *)stp); } -#endif /* * stat() can't handle a trailing '/' or '\', remove it first. @@ -598,14 +588,10 @@ wstat_symlink_aware(const WCHAR *name, stat_T *stp) int vim_stat(const char *name, stat_T *stp) { -#ifdef FEAT_MBYTE /* WinNT and later can use _MAX_PATH wide characters for a pathname, which * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is * UTF-8. */ char_u buf[_MAX_PATH * 3 + 1]; -#else - char_u buf[_MAX_PATH + 1]; -#endif char_u *p; vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); @@ -628,7 +614,6 @@ vim_stat(const char *name, stat_T *stp) STRCAT(buf, "\\"); } } -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wp = enc_to_utf16(buf, NULL); @@ -641,7 +626,6 @@ vim_stat(const char *name, stat_T *stp) return n; } } -#endif return stat_symlink_aware((char *)buf, stp); } @@ -791,7 +775,6 @@ mch_chdir(char *path) if (*path == NUL) /* drive name only */ return 0; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p = enc_to_utf16((char_u *)path, NULL); @@ -804,7 +787,6 @@ mch_chdir(char *path) return n; } } -#endif return chdir(path); /* let the normal chdir() do the rest */ } @@ -1145,9 +1127,6 @@ static char_u *prt_name = NULL; #define IDC_PRINTTEXT2 402 #define IDC_PROGRESS 403 -#if !defined(FEAT_MBYTE) -# define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s) -#else static BOOL vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) { @@ -1166,7 +1145,6 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) } return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s); } -#endif /* * Convert BGR to RGB for Windows GDI calls @@ -1563,7 +1541,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; char_u *port_name = (char_u *)devname +devname->wOutputOffset; char_u *text = (char_u *)_("to %s on %s"); -#ifdef FEAT_MBYTE char_u *printer_name_orig = printer_name; char_u *port_name_orig = port_name; @@ -1580,18 +1557,15 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) if (to_free != NULL) port_name = to_free; } -#endif prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) + STRLEN(text))); if (prt_name != NULL) wsprintf((char *)prt_name, (const char *)text, printer_name, port_name); -#ifdef FEAT_MBYTE if (printer_name != printer_name_orig) vim_free(printer_name); if (port_name != port_name_orig) vim_free(port_name); -#endif } GlobalUnlock(prt_dlg.hDevNames); @@ -1680,9 +1654,7 @@ mch_print_begin(prt_settings_T *psettings) { int ret; char szBuffer[300]; -#if defined(FEAT_MBYTE) WCHAR *wp = NULL; -#endif hDlgPrint = CreateDialog(GetModuleHandle(NULL), TEXT("PrintDlgBox"), prt_dlg.hwndOwner, PrintDlgProc); @@ -1690,7 +1662,6 @@ mch_print_begin(prt_settings_T *psettings) wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); -#if defined(FEAT_MBYTE) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) wp = enc_to_utf16(psettings->jobname, NULL); if (wp != NULL) @@ -1704,7 +1675,6 @@ mch_print_begin(prt_settings_T *psettings) vim_free(wp); } else -#endif { DOCINFO di; @@ -1767,10 +1737,7 @@ mch_print_start_line(int margin, int page_line) int mch_print_text_out(char_u *p, int len) { -#if defined(FEAT_PROPORTIONAL_FONTS) || defined(FEAT_MBYTE) SIZE sz; -#endif -#if defined(FEAT_MBYTE) WCHAR *wp = NULL; int wlen = len; @@ -1801,7 +1768,6 @@ mch_print_text_out(char_u *p, int len) } return ret; } -#endif TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, prt_pos_y + prt_top_margin, (LPCSTR)p, len); @@ -1873,10 +1839,8 @@ mch_resolve_shortcut(char_u *fname) CHAR buf[MAX_PATH]; // could have simply reused 'wsz'... char_u *rfname = NULL; int len; -# ifdef FEAT_MBYTE IShellLinkW *pslw = NULL; WIN32_FIND_DATAW ffdw; // we get those free of charge -# endif /* Check if the file name ends in ".lnk". Avoid calling * CoCreateInstance(), it's quite slow. */ @@ -1888,7 +1852,6 @@ mch_resolve_shortcut(char_u *fname) CoInitialize(NULL); -# ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { // create a link manager object and request its interface @@ -1930,7 +1893,6 @@ shortcut_errorw: } goto shortcut_end; } -# endif // create a link manager object and request its interface hr = CoCreateInstance( &CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, @@ -1969,10 +1931,8 @@ shortcut_end: ppf->lpVtbl->Release(ppf); if (psl != NULL) psl->lpVtbl->Release(psl); -# ifdef FEAT_MBYTE if (pslw != NULL) pslw->lpVtbl->Release(pslw); -# endif CoUninitialize(); return rfname; @@ -2042,13 +2002,8 @@ serverSendEnc(HWND target) COPYDATASTRUCT data; data.dwData = COPYDATA_ENCODING; -#ifdef FEAT_MBYTE data.cbData = (DWORD)STRLEN(p_enc) + 1; data.lpData = p_enc; -#else - data.cbData = (DWORD)STRLEN("latin1") + 1; - data.lpData = "latin1"; -#endif (void)SendMessage(target, WM_COPYDATA, (WPARAM)message_window, (LPARAM)(&data)); } @@ -2118,11 +2073,9 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (data->dwData) { case COPYDATA_ENCODING: -# ifdef FEAT_MBYTE /* Remember the encoding that the client uses. */ vim_free(client_enc); client_enc = enc_canonize((char_u *)data->lpData); -# endif return 1; case COPYDATA_KEYS: @@ -2954,15 +2907,12 @@ get_logfont( int i; int ret = FAIL; static LOGFONT *lastlf = NULL; -#ifdef FEAT_MBYTE char_u *acpname = NULL; -#endif *lf = s_lfDefault; if (name == NULL) return OK; -#ifdef FEAT_MBYTE /* Convert 'name' from 'encoding' to the current codepage, because * lf->lfFaceName uses the current codepage. * TODO: Use Wide APIs instead of ANSI APIs. */ @@ -2972,7 +2922,6 @@ get_logfont( enc_to_acp(name, (int)STRLEN(name), &acpname, &len); name = acpname; } -#endif if (STRCMP(name, "*") == 0) { #if defined(FEAT_GUI_W32) @@ -3112,9 +3061,7 @@ theend: if (lastlf != NULL) mch_memmove(lastlf, lf, sizeof(LOGFONT)); } -#ifdef FEAT_MBYTE vim_free(acpname); -#endif return ret; } diff --git a/src/os_unix.c b/src/os_unix.c index 3757dc5593..5ab3bd3cf3 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2054,19 +2054,12 @@ get_x11_thing( retval = TRUE; if (!test_only) { -#if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE) - if (text_prop.encoding == XA_STRING -# ifdef FEAT_MBYTE - && !has_mbyte -# endif - ) + if (text_prop.encoding == XA_STRING && !has_mbyte) { -#endif if (get_title) oldtitle = vim_strsave((char_u *)text_prop.value); else oldicon = vim_strsave((char_u *)text_prop.value); -#if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE) } else { @@ -2093,7 +2086,6 @@ get_x11_thing( oldicon = vim_strsave((char_u *)text_prop.value); } } -#endif } XFree((void *)text_prop.value); } @@ -2105,7 +2097,7 @@ get_x11_thing( * systems X_HAVE_UTF8_STRING may be defined in a header file but * Xutf8SetWMProperties() is not in the X11 library. Configure checks for * that and defines HAVE_XUTF8SETWMPROPERTIES. */ -#if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE) +#if defined(X_HAVE_UTF8_STRING) # if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES # define USE_UTF8_STRING # endif @@ -4823,9 +4815,7 @@ mch_call_shell_fork( { # define BUFLEN 100 /* length for buffer, pseudo tty limit is 128 */ char_u buffer[BUFLEN + 1]; -# ifdef FEAT_MBYTE int buffer_off = 0; /* valid bytes in buffer[] */ -# endif char_u ta_buf[BUFLEN + 1]; /* TypeAHead */ int ta_len = 0; /* valid bytes in ta_buf[] */ int len; @@ -5031,11 +5021,9 @@ mch_call_shell_fork( } else if (ta_buf[i] == '\r') ta_buf[i] = '\n'; -# ifdef FEAT_MBYTE if (has_mbyte) i += (*mb_ptr2len_len)(ta_buf + i, ta_len + len - i) - 1; -# endif } /* @@ -5048,7 +5036,6 @@ mch_call_shell_fork( { if (ta_buf[i] == '\n' || ta_buf[i] == '\b') msg_putchar(ta_buf[i]); -# ifdef FEAT_MBYTE else if (has_mbyte) { int l = (*mb_ptr2len)(ta_buf + i); @@ -5056,7 +5043,6 @@ mch_call_shell_fork( msg_outtrans_len(ta_buf + i, l); i += l - 1; } -# endif else msg_outtrans_len(ta_buf + i, 1); } @@ -5114,11 +5100,7 @@ mch_call_shell_fork( while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL)) { len = read_eintr(fromshell_fd, buffer -# ifdef FEAT_MBYTE + buffer_off, (size_t)(BUFLEN - buffer_off) -# else - , (size_t)BUFLEN -# endif ); if (len <= 0) /* end of file or error */ goto finished; @@ -5138,7 +5120,6 @@ mch_call_shell_fork( ga_append(&ga, buffer[i]); } } -# ifdef FEAT_MBYTE else if (has_mbyte) { int l; @@ -5181,7 +5162,6 @@ mch_call_shell_fork( } buffer_off = 0; } -# endif /* FEAT_MBYTE */ else { buffer[len] = NUL; diff --git a/src/os_w32exe.c b/src/os_w32exe.c index 3beca193d7..f96bff4c8e 100644 --- a/src/os_w32exe.c +++ b/src/os_w32exe.c @@ -130,9 +130,7 @@ errout: free(argv); if (tofree != NULL) free(tofree); -#ifdef FEAT_MBYTE free_cmd_argsW(); -#endif return 0; } diff --git a/src/os_win32.c b/src/os_win32.c index b5a6ccebae..8966053b83 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -452,11 +452,7 @@ unescape_shellxquote(char_u *p, char_u *escaped) { if (*p == '^' && vim_strchr(escaped, p[1]) != NULL) mch_memmove(p, p + 1, l--); -#ifdef FEAT_MBYTE n = (*mb_ptr2len)(p); -#else - n = 1; -#endif p += n; l -= n; } @@ -1890,7 +1886,6 @@ mch_inchar( { int n = 1; -#ifdef FEAT_MBYTE if (ch2 == NUL) { int i; @@ -1912,7 +1907,6 @@ mch_inchar( } } else -#endif typeahead[typeaheadlen] = c; if (ch2 != NUL) { @@ -1950,17 +1944,11 @@ mch_inchar( if ((modifiers & MOD_MASK_ALT) && n == 1 && (typeahead[typeaheadlen] & 0x80) == 0 -#ifdef FEAT_MBYTE && !enc_dbcs -#endif ) { -#ifdef FEAT_MBYTE n = (*mb_char2bytes)(typeahead[typeaheadlen] | 0x80, typeahead + typeaheadlen); -#else - typeahead[typeaheadlen] |= 0x80; -#endif modifiers &= ~MOD_MASK_ALT; } @@ -2044,7 +2032,6 @@ executable_exists(char *name, char_u **path, int use_path) return FALSE; } -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p = enc_to_utf16((char_u *)name, NULL); @@ -2073,7 +2060,6 @@ executable_exists(char *name, char_u **path, int use_path) return TRUE; } } -#endif curpath = getenv("PATH"); newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3)); @@ -2768,7 +2754,6 @@ mch_check_win( } -#ifdef FEAT_MBYTE /* * fname_casew(): Wide version of fname_case(). Set the case of the file name, * if it already exists. When "len" is > 0, also expand short to long @@ -2878,7 +2863,6 @@ fname_casew( wcscpy(name, szTrueName); return OK; } -#endif /* * fname_case(): Set the case of the file name, if it already exists. @@ -2906,7 +2890,6 @@ fname_case( slash_adjust(name); -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p = enc_to_utf16(name, NULL); @@ -2933,7 +2916,6 @@ fname_case( } return; } -#endif /* If 'enc' is utf-8, flen can be larger than _MAX_PATH. * So we should check this after calling wide function. */ @@ -2962,7 +2944,6 @@ fname_case( porigPrev = porig; while (*porig != NUL && *porig != psepc) { -#ifdef FEAT_MBYTE int l; if (enc_dbcs) @@ -2972,7 +2953,6 @@ fname_case( *ptrue++ = *porig++; } else -#endif *ptrue++ = *porig++; } *ptrue = NUL; @@ -3044,7 +3024,6 @@ mch_get_user_name( char szUserName[256 + 1]; /* UNLEN is 256 */ DWORD cch = sizeof szUserName; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR wszUserName[256 + 1]; /* UNLEN is 256 */ @@ -3062,7 +3041,6 @@ mch_get_user_name( } } } -#endif if (GetUserName(szUserName, &cch)) { vim_strncpy(s, (char_u *)szUserName, len - 1); @@ -3083,7 +3061,6 @@ mch_get_host_name( { DWORD cch = len; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR wszHostName[256 + 1]; @@ -3101,7 +3078,6 @@ mch_get_host_name( } } } -#endif if (!GetComputerName((LPSTR)s, &cch)) vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1); } @@ -3135,7 +3111,6 @@ mch_dirname( * But the Win32s known bug list says that getcwd() doesn't work * so use the Win32 system call instead. <Negri> */ -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR wbuf[_MAX_PATH + 1]; @@ -3167,7 +3142,6 @@ mch_dirname( } return FAIL; } -#endif if (GetCurrentDirectory(len, (LPSTR)buf) == 0) return FAIL; lfnlen = GetLongPathNameA((LPCSTR)buf, (LPSTR)abuf, _MAX_PATH); @@ -3205,7 +3179,6 @@ mch_setperm(char_u *name, long perm) { long n = -1; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p = enc_to_utf16(name, NULL); @@ -3219,7 +3192,6 @@ mch_setperm(char_u *name, long perm) } } if (n == -1) -#endif n = _chmod((const char *)name, perm); if (n == -1) return FAIL; @@ -3290,7 +3262,6 @@ mch_isrealdir(char_u *name) int mch_mkdir(char_u *name) { -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p; @@ -3303,7 +3274,6 @@ mch_mkdir(char_u *name) vim_free(p); return retval; } -#endif return _mkdir((const char *)name); } @@ -3314,7 +3284,6 @@ mch_mkdir(char_u *name) int mch_rmdir(char_u *name) { -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *p; @@ -3327,7 +3296,6 @@ mch_rmdir(char_u *name) vim_free(p); return retval; } -#endif return _rmdir((const char *)name); } @@ -3353,7 +3321,6 @@ mch_is_symbolic_link(char_u *name) int res = FALSE; WIN32_FIND_DATAA findDataA; DWORD fileFlags = 0, reparseTag = 0; -#ifdef FEAT_MBYTE WCHAR *wn = NULL; WIN32_FIND_DATAW findDataW; @@ -3370,7 +3337,6 @@ mch_is_symbolic_link(char_u *name) } } else -#endif { hFind = FindFirstFile((LPCSTR)name, &findDataA); if (hFind != INVALID_HANDLE_VALUE) @@ -3415,7 +3381,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) { HANDLE hFile; int res = FILEINFO_READ_FAIL; -#ifdef FEAT_MBYTE WCHAR *wn = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) @@ -3436,7 +3401,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) vim_free(wn); } else -#endif hFile = CreateFile((LPCSTR)fname, /* file name */ GENERIC_READ, /* access mode */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */ @@ -3466,7 +3430,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) win32_getattrs(char_u *name) { int attr; -#ifdef FEAT_MBYTE WCHAR *p = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) @@ -3478,7 +3441,6 @@ win32_getattrs(char_u *name) vim_free(p); } else -#endif attr = GetFileAttributes((char *)name); return attr; @@ -3493,7 +3455,6 @@ win32_getattrs(char_u *name) win32_setattrs(char_u *name, int attrs) { int res; -#ifdef FEAT_MBYTE WCHAR *p = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) @@ -3505,7 +3466,6 @@ win32_setattrs(char_u *name, int attrs) vim_free(p); } else -#endif res = SetFileAttributes((char *)name, attrs); return res ? 0 : -1; @@ -3621,9 +3581,7 @@ mch_nodetype(char_u *name) { HANDLE hFile; int type; -#ifdef FEAT_MBYTE WCHAR *wn = NULL; -#endif /* We can't open a file with a name "\\.\con" or "\\.\prn" and trying to * read from it later will cause Vim to hang. Thus return NODE_WRITABLE @@ -3631,7 +3589,6 @@ mch_nodetype(char_u *name) if (STRNCMP(name, "\\\\.\\", 4) == 0) return NODE_WRITABLE; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) wn = enc_to_utf16(name, NULL); @@ -3647,7 +3604,6 @@ mch_nodetype(char_u *name) vim_free(wn); } else -#endif hFile = CreateFile((LPCSTR)name, /* file name */ GENERIC_WRITE, /* access mode */ 0, /* share mode */ @@ -3695,7 +3651,6 @@ mch_get_acl(char_u *fname) p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); if (p != NULL) { -# ifdef FEAT_MBYTE WCHAR *wn = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) @@ -3737,7 +3692,6 @@ mch_get_acl(char_u *fname) vim_free(wn); } else -# endif { /* Try to retrieve the entire security descriptor. */ err = GetNamedSecurityInfo( @@ -3815,9 +3769,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl) if (p != NULL) { -# ifdef FEAT_MBYTE WCHAR *wn = NULL; -# endif /* Set security flags */ if (p->pSidOwner) @@ -3836,7 +3788,6 @@ mch_set_acl(char_u *fname, vim_acl_T acl) if (p->pSacl) sec_info |= SACL_SECURITY_INFORMATION; -# ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) wn = enc_to_utf16(fname, NULL); if (wn != NULL) @@ -3853,7 +3804,6 @@ mch_set_acl(char_u *fname, vim_acl_T acl) vim_free(wn); } else -# endif { (void)SetNamedSecurityInfo( (LPSTR)fname, // Abstract filename @@ -4211,7 +4161,6 @@ vim_create_process( LPVOID *env, char *cwd) { -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { BOOL ret; @@ -4247,7 +4196,6 @@ vim_create_process( return ret; } fallback: -#endif return CreateProcess( NULL, /* Executable name */ cmd, /* Command to execute */ @@ -4267,7 +4215,6 @@ vim_shell_execute( char *cmd, INT n_show_cmd) { -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL); @@ -4279,7 +4226,6 @@ vim_shell_execute( return ret; } } -#endif return ShellExecute(NULL, NULL, cmd, NULL, NULL, n_show_cmd); } @@ -4466,20 +4412,9 @@ dump_pipe(int options, while (ret != 0 && availableBytes > 0) { repeatCount++; - toRead = -# ifdef FEAT_MBYTE - (DWORD)(BUFLEN - *buffer_off); -# else - (DWORD)BUFLEN; -# endif + toRead = (DWORD)(BUFLEN - *buffer_off); toRead = availableBytes < toRead ? availableBytes : toRead; - ReadFile(g_hChildStd_OUT_Rd, buffer -# ifdef FEAT_MBYTE - + *buffer_off, toRead -# else - , toRead -# endif - , &len, NULL); + ReadFile(g_hChildStd_OUT_Rd, buffer + *buffer_off, toRead , &len, NULL); /* If we haven't read anything, there is a problem */ if (len == 0) @@ -4501,7 +4436,6 @@ dump_pipe(int options, ga_append(ga, buffer[i]); } } -# ifdef FEAT_MBYTE else if (has_mbyte) { int l; @@ -4545,7 +4479,6 @@ dump_pipe(int options, } *buffer_off = 0; } -# endif /* FEAT_MBYTE */ else { buffer[len] = NUL; @@ -4740,11 +4673,9 @@ mch_system_piped(char *cmd, int options) } else if (ta_buf[i] == '\r') ta_buf[i] = '\n'; -# ifdef FEAT_MBYTE if (has_mbyte) i += (*mb_ptr2len_len)(ta_buf + i, ta_len + len - i) - 1; -# endif } /* @@ -4755,7 +4686,6 @@ mch_system_piped(char *cmd, int options) { if (ta_buf[i] == '\n' || ta_buf[i] == '\b') msg_putchar(ta_buf[i]); -# ifdef FEAT_MBYTE else if (has_mbyte) { int l = (*mb_ptr2len)(ta_buf + i); @@ -4763,7 +4693,6 @@ mch_system_piped(char *cmd, int options) msg_outtrans_len(ta_buf + i, l); i += l - 1; } -# endif else msg_outtrans_len(ta_buf + i, 1); } @@ -4857,7 +4786,6 @@ mch_system(char *cmd, int options) } #else -# ifdef FEAT_MBYTE static int mch_system(char *cmd, int options) { @@ -4873,9 +4801,6 @@ mch_system(char *cmd, int options) } return system(cmd); } -# else -# define mch_system(c, o) system(c) -# endif #endif @@ -4972,7 +4897,6 @@ mch_call_shell( int tmode = cur_tmode; #ifdef FEAT_TITLE char szShellTitle[512]; -# ifdef FEAT_MBYTE int did_set_title = FALSE; /* Change the title to reflect that we are in a subshell. */ @@ -5003,7 +4927,6 @@ mch_call_shell( } } if (!did_set_title) -# endif /* Change the title to reflect that we are in a subshell. */ if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) { @@ -5217,7 +5140,6 @@ mch_call_shell( "External commands will not pause after completion.\n" "See :help win32-vimrun for more information."); char *title = _("Vim Warning"); -# ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { WCHAR *wmsg = enc_to_utf16((char_u *)msg, NULL); @@ -5229,7 +5151,6 @@ mch_call_shell( vim_free(wtitle); } else -# endif MessageBox(NULL, msg, title, MB_ICONWARNING); need_vimrun_warning = FALSE; } @@ -5294,8 +5215,8 @@ job_io_file_open( DWORD dwFlagsAndAttributes) { HANDLE h; -# ifdef FEAT_MBYTE WCHAR *wn = NULL; + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { wn = enc_to_utf16(fname, NULL); @@ -5308,7 +5229,6 @@ job_io_file_open( } } if (wn == NULL) -# endif h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, NULL); @@ -6339,7 +6259,6 @@ write_chars( COORD coord = g_coord; DWORD written; -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { static WCHAR *unicodebuf = NULL; @@ -6392,7 +6311,6 @@ write_chars( } } else -#endif { if (!USE_VTP) { @@ -6763,10 +6681,8 @@ mch_delay( int mch_remove(char_u *name) { -#ifdef FEAT_MBYTE WCHAR *wn = NULL; int n; -#endif /* * On Windows, deleting a directory's symbolic link is done by @@ -6777,7 +6693,6 @@ mch_remove(char_u *name) win32_setattrs(name, FILE_ATTRIBUTE_NORMAL); -#ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { wn = enc_to_utf16(name, NULL); @@ -6788,7 +6703,6 @@ mch_remove(char_u *name) return n; } } -#endif return DeleteFile((LPCSTR)name) ? 0 : -1; } @@ -6839,7 +6753,6 @@ mch_total_mem(int special UNUSED) return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024); } -#ifdef FEAT_MBYTE /* * Same code as below, but with wide functions and no comments. * Return 0 for success, non-zero for failure. @@ -6893,7 +6806,6 @@ mch_wrename(WCHAR *wold, WCHAR *wnew) return 0; } -#endif /* @@ -6924,7 +6836,6 @@ mch_rename( char szNewPath[_MAX_PATH+1]; char *pszFilePart; HANDLE hf; -#ifdef FEAT_MBYTE WCHAR *wold = NULL; WCHAR *wnew = NULL; int retval = -1; @@ -6939,7 +6850,6 @@ mch_rename( vim_free(wnew); return retval; } -#endif /* * No need to play tricks unless the file name contains a "~" as the @@ -7024,25 +6934,20 @@ mch_access(char *n, int p) { HANDLE hFile; int retval = -1; /* default: fail */ -#ifdef FEAT_MBYTE WCHAR *wn = NULL; if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) wn = enc_to_utf16((char_u *)n, NULL); -#endif if (mch_isdir((char_u *)n)) { char TempName[_MAX_PATH + 16] = ""; -#ifdef FEAT_MBYTE WCHAR TempNameW[_MAX_PATH + 16] = L""; -#endif if (p & R_OK) { /* Read check is performed by seeing if we can do a find file on * the directory for any file. */ -#ifdef FEAT_MBYTE if (wn != NULL) { int i; @@ -7062,7 +6967,6 @@ mch_access(char *n, int p) (void)FindClose(hFile); } else -#endif { char *pch; WIN32_FIND_DATA d; @@ -7087,7 +6991,6 @@ mch_access(char *n, int p) * directories on read-only network shares. However, in * directories whose ACL allows writes but denies deletes will end * up keeping the temporary file :-(. */ -#ifdef FEAT_MBYTE if (wn != NULL) { if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW)) @@ -7096,7 +6999,6 @@ mch_access(char *n, int p) DeleteFileW(TempNameW); } else -#endif { if (!GetTempFileName(n, "VIM", 0, TempName)) goto getout; @@ -7114,12 +7016,10 @@ mch_access(char *n, int p) DWORD access_mode = ((p & W_OK) ? GENERIC_WRITE : 0) | ((p & R_OK) ? GENERIC_READ : 0); -#ifdef FEAT_MBYTE if (wn != NULL) hFile = CreateFileW(wn, access_mode, share_mode, NULL, OPEN_EXISTING, 0, NULL); else -#endif hFile = CreateFile(n, access_mode, share_mode, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -7129,13 +7029,10 @@ mch_access(char *n, int p) retval = 0; /* success */ getout: -#ifdef FEAT_MBYTE vim_free(wn); -#endif return retval; } -#if defined(FEAT_MBYTE) || defined(PROTO) /* * Version of open() that may use UTF-16 file name. */ @@ -7143,7 +7040,7 @@ getout: mch_open(const char *name, int flags, int mode) { /* _wopen() does not work with Borland C 5.5: creates a read-only file. */ -# ifndef __BORLANDC__ +#ifndef __BORLANDC__ WCHAR *wn; int f; @@ -7157,7 +7054,7 @@ mch_open(const char *name, int flags, int mode) return f; } } -# endif +#endif /* open() can open a file which name is longer than _MAX_PATH bytes * and shorter than _MAX_PATH characters successfully, but sometimes it @@ -7180,7 +7077,7 @@ mch_fopen(const char *name, const char *mode) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { -# if defined(DEBUG) && _MSC_VER >= 1400 +#if defined(DEBUG) && _MSC_VER >= 1400 /* Work around an annoying assertion i |