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)
diff --git a/src/fileio.c b/src/fileio.c
index 82659be..87b85cf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -68,7 +68,7 @@
# 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 @@
# 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 @@
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 @@
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 @@
}
}
-#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 @@
}
# 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 @@
}
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 @@
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 @@
}
#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.