X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a1cd8c96cad685912749efb395593524b199c536..fa419c2398349f201cfac89c9754c400b709db29:/src/xselect.c diff --git a/src/xselect.c b/src/xselect.c index e7e3fe72b1..8de436f119 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -1,12 +1,12 @@ /* X Selection processing for Emacs. - Copyright (C) 1993-1997, 2000-2015 Free Software Foundation, Inc. + Copyright (C) 1993-1997, 2000-2016 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,12 +31,8 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "xterm.h" /* for all of the X includes */ -#include "dispextern.h" /* frame.h seems to want this */ #include "frame.h" /* Need this to get the X window of selected_frame */ #include "blockinput.h" -#include "character.h" -#include "buffer.h" -#include "process.h" #include "termhooks.h" #include "keyboard.h" @@ -219,7 +215,7 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym) if (EQ (sym, QDELETE)) return dpyinfo->Xatom_DELETE; if (EQ (sym, QMULTIPLE)) return dpyinfo->Xatom_MULTIPLE; if (EQ (sym, QINCR)) return dpyinfo->Xatom_INCR; - if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; + if (EQ (sym, Q_EMACS_TMP_)) return dpyinfo->Xatom_EMACS_TMP; if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; if (!SYMBOLP (sym)) emacs_abort (); @@ -277,7 +273,7 @@ x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom) if (atom == dpyinfo->Xatom_INCR) return QINCR; if (atom == dpyinfo->Xatom_EMACS_TMP) - return QEMACS_TMP; + return Q_EMACS_TMP_; if (atom == dpyinfo->Xatom_TARGETS) return QTARGETS; if (atom == dpyinfo->Xatom_NULL) @@ -316,7 +312,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, x_catch_errors (display); XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); x_check_errors (display, "Can't set selection: %s"); - x_uncatch_errors (); + x_uncatch_errors_after_check (); unblock_input (); /* Now update the local cache */ @@ -1179,7 +1175,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, XConvertSelection (display, selection_atom, type_atom, target_property, requestor_window, requestor_time); x_check_errors (display, "Can't convert selection: %s"); - x_uncatch_errors (); + x_uncatch_errors_after_check (); /* Prepare to block until the reply has been read. */ reading_selection_window = requestor_window; @@ -2334,10 +2330,11 @@ x_property_data_to_lisp (struct frame *f, const unsigned char *data, Atom type, int format, unsigned long size) { ptrdiff_t format_bytes = format >> 3; - if (PTRDIFF_MAX / format_bytes < size) + ptrdiff_t data_bytes; + if (INT_MULTIPLY_WRAPV (size, format_bytes, &data_bytes)) memory_full (SIZE_MAX); return selection_data_to_lisp_data (FRAME_DISPLAY_INFO (f), data, - size * format_bytes, type, format); + data_bytes, type, format); } DEFUN ("x-get-atom-name", Fx_get_atom_name, @@ -2364,7 +2361,7 @@ If the value is 0 or the atom is not known, return the empty string. */) x_catch_errors (dpy); name = atom ? XGetAtomName (dpy, atom) : empty; had_errors_p = x_had_errors_p (dpy); - x_uncatch_errors (); + x_uncatch_errors_after_check (); if (!had_errors_p) ret = build_string (name); @@ -2682,7 +2679,7 @@ A value of 0 means wait as long as necessary. This is initialized from the DEFSYM (QDELETE, "DELETE"); DEFSYM (QMULTIPLE, "MULTIPLE"); DEFSYM (QINCR, "INCR"); - DEFSYM (QEMACS_TMP, "_EMACS_TMP_"); + DEFSYM (Q_EMACS_TMP_, "_EMACS_TMP_"); DEFSYM (QTARGETS, "TARGETS"); DEFSYM (QATOM, "ATOM"); DEFSYM (QCLIPBOARD_MANAGER, "CLIPBOARD_MANAGER");