summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.122
-rw-r--r--src/nsterm.m9
-rw-r--r--src/unexmacosx.c21
-rw-r--r--src/xsmfns.c4
-rw-r--r--src/xwidget.c34
5 files changed, 47 insertions, 23 deletions
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 3045ecdca92..b2df482ba77 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -2895,7 +2895,7 @@
(wait_reading_process_output, init_process_emacs):
Assume O_NONBLOCK.
(wait_reading_process_output): Put in a special case for WINDOWSNT
- to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK.
+ to mimic the older behavior where it had O_NDELAY but not O_NONBLOCK.
It's not clear this is needed, but it's a more-conservative change.
(create_process): Assume FD_CLOEXEC.
(create_process, create_pty): Assume O_NOCTTY.
diff --git a/src/nsterm.m b/src/nsterm.m
index 4048ac46546..34c5395b630 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -596,8 +596,15 @@ ns_init_locale (void)
@try
{
+ /* It seems OS X should probably use UTF-8 everywhere.
+ 'localeIdentifier' does not specify the encoding, and I can't
+ find any way to get the OS to tell us which encoding to use,
+ so hard-code '.UTF-8'. */
+ NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
+ [locale localeIdentifier]];
+
/* Set LANG to locale, but not if LANG is already set. */
- setenv("LANG", [[locale localeIdentifier] UTF8String], 0);
+ setenv("LANG", [localeID UTF8String], 0);
}
@catch (NSException *e)
{
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 827eda56e08..bdacc8b540b 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -103,9 +103,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <stdint.h>
#include <sys/types.h>
#include <unistd.h>
#include <mach/mach.h>
+#include <mach/vm_map.h>
#include <mach-o/loader.h>
#include <mach-o/reloc.h>
#ifdef HAVE_MALLOC_MALLOC_H
@@ -217,10 +219,27 @@ unexec_read (void *dest, size_t n)
static int
unexec_write (off_t dest, const void *src, size_t count)
{
+ task_t task = mach_task_self();
+ if (task == MACH_PORT_NULL || task == MACH_PORT_DEAD)
+ return false;
+
if (lseek (outfd, dest, SEEK_SET) != dest)
return 0;
- return write (outfd, src, count) == count;
+ /* We use the Mach virtual memory API to read our process memory
+ because using src directly would be undefined behavior and fails
+ under Address Sanitizer. */
+ bool success = false;
+ vm_offset_t data;
+ mach_msg_type_number_t data_count;
+ if (vm_read (task, (uintptr_t) src, count, &data, &data_count)
+ == KERN_SUCCESS)
+ {
+ success =
+ write (outfd, (const void *) (uintptr_t) data, data_count) == count;
+ vm_deallocate (task, data, data_count);
+ }
+ return success;
}
/* Write COUNT bytes of zeros to outfd starting at offset DEST.
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 296b1cc3603..a7ec8e0c7e2 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -545,7 +545,7 @@ syms_of_xsmfns (void)
Changing the value does not change the session id used by Emacs.
The value is nil if no session manager is running.
See also `x-session-previous-id', `emacs-save-session-functions',
-`emacs-session-save' and `emacs-session-restore'." */);
+`emacs-session-save' and `emacs-session-restore'. */);
Vx_session_id = Qnil;
DEFVAR_LISP ("x-session-previous-id", Vx_session_previous_id,
@@ -568,7 +568,7 @@ The session id Emacs has while it is running is in the variable
same, depending on how the session manager works.
See also `emacs-save-session-functions', `emacs-session-save' and
-`emacs-session-restore'." */);
+`emacs-session-restore'. */);
Vx_session_previous_id = Qnil;
defsubr (&Shandle_save_session);
diff --git a/src/xwidget.c b/src/xwidget.c
index 8ff4c23b1f2..7e96307bdd8 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -578,24 +578,22 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
other time to know things like window placement etc. */
xv = xwidget_init_view (xww, s, x, y);
- /* Calculate clipping, which is used for all manner of onscreen
- xwidget views. Each widget border can get clipped by other emacs
- objects so there are four clipping variables. */
- clip_right =
- min (xww->width,
- WINDOW_RIGHT_EDGE_X (s->w) - x -
- WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w) -
- WINDOW_RIGHT_FRINGE_WIDTH (s->w));
- clip_left =
- max (0,
- WINDOW_LEFT_EDGE_X (s->w) - x +
- WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w) +
- WINDOW_LEFT_FRINGE_WIDTH (s->w));
-
- clip_bottom =
- min (xww->height,
- WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
- clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);
+ int text_area_x, text_area_y, text_area_width, text_area_height;
+
+ window_box (s->w,
+ ANY_AREA,
+ &text_area_x,
+ &text_area_y,
+ &text_area_width,
+ &text_area_height);
+ clip_right = min (xww->width,
+ text_area_width);
+ clip_left = max (0,
+ text_area_x);
+
+ clip_bottom = min (xww->height,
+ text_area_height);
+ clip_top = max (0, text_area_y);
/* We are concerned with movement of the onscreen area. The area
might sit still when the widget actually moves. This happens