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

patch 8.0.1236: Mac features are confusing

Problem:    Mac features are confusing.
Solution:   Make feature names more consistent, add "osxdarwin". Rename
            feature flags, cleanup Mac code. (Kazunobu Kuriyama, closes #2178)
This commit is contained in:
Bram Moolenaar
2017-10-28 21:11:06 +02:00
parent ef83956e1e
commit d057301b1f
38 changed files with 268 additions and 383 deletions

View File

@@ -68,7 +68,7 @@ static int au_find_group(char_u *name);
# define FIO_PUT_CP(x) (((x) & 0xffff) << 16) /* put codepage in top word */
# define FIO_GET_CP(x) (((x)>>16) & 0xffff) /* get codepage from top word */
# endif
# ifdef MACOS_X
# ifdef MACOS_CONVERT
# define FIO_MACROMAN 0x20 /* convert MacRoman */
# endif
# define FIO_ENDIAN_L 0x80 /* little endian */
@@ -127,7 +127,7 @@ static int make_bom(char_u *buf, char_u *name);
# ifdef WIN3264
static int get_win_fio_flags(char_u *ptr);
# endif
# ifdef MACOS_X
# ifdef MACOS_CONVERT
static int get_mac_fio_flags(char_u *ptr);
# endif
#endif
@@ -1088,7 +1088,7 @@ retry:
fio_flags = get_win_fio_flags(fenc);
# endif
# ifdef MACOS_X
# ifdef MACOS_CONVERT
/* Conversion from Apple MacRoman to latin1 or UTF-8 */
if (fio_flags == 0)
fio_flags = get_mac_fio_flags(fenc);
@@ -1274,7 +1274,7 @@ retry:
else if (fio_flags & FIO_CODEPAGE)
size = size / ICONV_MULT; /* also worst case */
# endif
# ifdef MACOS_X
# ifdef MACOS_CONVERT
else if (fio_flags & FIO_MACROMAN)
size = size / ICONV_MULT; /* also worst case */
# endif
@@ -4200,20 +4200,6 @@ buf_write(
}
}
#ifdef MACOS_CLASSIC /* TODO: Is it need for MACOS_X? (Dany) */
/*
* Before risking to lose the original file verify if there's
* a resource fork to preserve, and if cannot be done warn
* the users. This happens when overwriting without backups.
*/
if (backup == NULL && overwriting && !append)
if (mch_has_resource_fork(fname))
{
errmsg = (char_u *)_("E460: The resource fork would be lost (add ! to override)");
goto restore_backup;
}
#endif
#ifdef VMS
vms_remove_version(fname); /* remove version */
#endif
@@ -4271,7 +4257,7 @@ buf_write(
}
# endif
# ifdef MACOS_X
# ifdef MACOS_CONVERT
if (converted && wb_flags == 0 && (wb_flags = get_mac_fio_flags(fenc)) != 0)
{
write_info.bw_conv_buflen = bufsize * 3;
@@ -4474,13 +4460,7 @@ restore_backup:
}
write_info.bw_fd = fd;
#if defined(MACOS_CLASSIC) || defined(WIN3264)
/* TODO: Is it need for MACOS_X? (Dany) */
/*
* On macintosh copy the original files attributes (i.e. the backup)
* This is done in order to preserve the resource fork and the
* Finder attribute (label, comments, custom icons, file creator)
*/
#if defined(WIN3264)
if (backup != NULL && overwriting && !append)
{
if (backup_copy)
@@ -5199,10 +5179,6 @@ nofail:
got_int |= prev_got_int;
#ifdef MACOS_CLASSIC /* TODO: Is it need for MACOS_X? (Dany) */
/* Update machine specific information. */
mch_post_buffer_write(buf);
#endif
return retval;
}
@@ -5972,7 +5948,7 @@ get_win_fio_flags(char_u *ptr)
}
#endif
#ifdef MACOS_X
#ifdef MACOS_CONVERT
/*
* Check "ptr" for a Carbon supported encoding and return the FIO_ flags
* needed for the internal conversion to/from utf-8 or latin1.