diff options
| author | Phillip Lord | 2016-01-15 22:20:34 +0000 |
|---|---|---|
| committer | Phillip Lord | 2016-01-15 22:20:34 +0000 |
| commit | bb0cd3193912032ae11a27016271d4587f876f98 (patch) | |
| tree | d07e7bade1a79bec532447af64c9a5e1e63fc7ee | |
| parent | 549a765efeca2748e68a5c6ce6c9238784e82535 (diff) | |
| parent | 9e5452f7166e3634f2d8e943815ed722e1672714 (diff) | |
| download | emacs-bb0cd3193912032ae11a27016271d4587f876f98.tar.gz emacs-bb0cd3193912032ae11a27016271d4587f876f98.zip | |
Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into emacs-25
| -rw-r--r-- | configure.ac | 16 | ||||
| -rw-r--r-- | doc/lispref/numbers.texi | 4 | ||||
| -rw-r--r-- | doc/man/etags.1 | 12 | ||||
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lib-src/etags.c | 3 | ||||
| -rw-r--r-- | lisp/gnus/gnus-start.el | 10 | ||||
| -rw-r--r-- | lisp/newcomment.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 8 | ||||
| -rw-r--r-- | lisp/textmodes/picture.el | 6 | ||||
| -rw-r--r-- | src/dispnew.c | 4 | ||||
| -rw-r--r-- | src/fns.c | 3 | ||||
| -rw-r--r-- | src/sysdep.c | 31 | ||||
| -rw-r--r-- | src/w32.c | 32 | ||||
| -rw-r--r-- | src/w32.h | 3 | ||||
| -rw-r--r-- | src/window.c | 10 |
16 files changed, 146 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac index 8c01abac9c6..6c9b621dd82 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -4153,6 +4153,22 @@ fi | |||
| 4153 | 4153 | ||
| 4154 | AC_TYPE_MBSTATE_T | 4154 | AC_TYPE_MBSTATE_T |
| 4155 | 4155 | ||
| 4156 | AC_MSG_CHECKING([whether "/dev/urandom" is available]) | ||
| 4157 | dev_urandom=no | ||
| 4158 | dnl MSYS, being a Cygwin fork, thinks "/dev/urandom" does exist, so | ||
| 4159 | dnl don't check this for the MinGW builds. | ||
| 4160 | if test "${opsys}" != "mingw32"; then | ||
| 4161 | if test -r "/dev/urandom"; then | ||
| 4162 | AC_DEFINE(HAVE_DEV_URANDOM, 1, [Define if the system supports the "/dev/urandom" device.]) | ||
| 4163 | dev_urandom=yes | ||
| 4164 | fi | ||
| 4165 | fi | ||
| 4166 | if test $dev_urandom = yes; then | ||
| 4167 | AC_MSG_RESULT(yes) | ||
| 4168 | else | ||
| 4169 | AC_MSG_RESULT(no) | ||
| 4170 | fi | ||
| 4171 | |||
| 4156 | dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear | 4172 | dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear |
| 4157 | dnl how the tty code is related to POSIX and/or other versions of termios. | 4173 | dnl how the tty code is related to POSIX and/or other versions of termios. |
| 4158 | dnl The following looks like a useful start. | 4174 | dnl The following looks like a useful start. |
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index 20d3c4290f3..3a9483af967 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi | |||
| @@ -1252,7 +1252,9 @@ any integer representable in Lisp, i.e., an integer between | |||
| 1252 | (@pxref{Integer Basics}). | 1252 | (@pxref{Integer Basics}). |
| 1253 | 1253 | ||
| 1254 | If @var{limit} is @code{t}, it means to choose a new seed as if Emacs | 1254 | If @var{limit} is @code{t}, it means to choose a new seed as if Emacs |
| 1255 | were restarting. | 1255 | were restarting. The new seed will be set from the system entropy, if |
| 1256 | that is available, or from the current time and Emacs process's PID | ||
| 1257 | (@pxref{System Environment, emacs-pid}) if not. | ||
| 1256 | 1258 | ||
| 1257 | If @var{limit} is a string, it means to choose a new seed based on the | 1259 | If @var{limit} is a string, it means to choose a new seed based on the |
| 1258 | string's contents. | 1260 | string's contents. |
diff --git a/doc/man/etags.1 b/doc/man/etags.1 index 7d5d374f99a..d34063f23cd 100644 --- a/doc/man/etags.1 +++ b/doc/man/etags.1 | |||
| @@ -17,7 +17,7 @@ etags, ctags \- generate tag file for Emacs, vi | |||
| 17 | [\|\-\-parse\-stdin=\fIfile\fP\|] | 17 | [\|\-\-parse\-stdin=\fIfile\fP\|] |
| 18 | .br | 18 | .br |
| 19 | [\|\-\-append\|] [\|\-\-no\-defines\|] [\|\-\-globals\|] | 19 | [\|\-\-append\|] [\|\-\-no\-defines\|] [\|\-\-globals\|] |
| 20 | [\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|] | 20 | [\|\-\-no\-globals\|] [\|\-\-no\-line\-directive\|] [\|\-\-include=\fIfile\fP\|] |
| 21 | [\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|] | 21 | [\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|] |
| 22 | [\|\-\-members\|] [\|\-\-no\-members\|] [\|\-\-output=\fItagfile\fP\|] | 22 | [\|\-\-members\|] [\|\-\-no\-members\|] [\|\-\-output=\fItagfile\fP\|] |
| 23 | [\|\-\-class\-qualify\|] | 23 | [\|\-\-class\-qualify\|] |
| @@ -31,8 +31,8 @@ etags, ctags \- generate tag file for Emacs, vi | |||
| 31 | [\|\-\-parse\-stdin=\fIfile\fP\|] | 31 | [\|\-\-parse\-stdin=\fIfile\fP\|] |
| 32 | .br | 32 | .br |
| 33 | [\|\-\-append\|] [\|\-\-backward\-search\|] | 33 | [\|\-\-append\|] [\|\-\-backward\-search\|] |
| 34 | [\|\-\-cxref\|] [\|\-\-no\-defines\|] | 34 | [\|\-\-cxref\|] [\|\-\-no\-defines\|] [\|\-\-globals\|] |
| 35 | [\|\-\-globals\|] [\|\-\-no\-globals\|] [\|\-\-ignore\-indentation\|] | 35 | [\|\-\-no\-globals\|] [\|\-\-no\-line\-directive\|] [\|\-\-ignore\-indentation\|] |
| 36 | [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|] [\|\-\-no\-members\|] | 36 | [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|] [\|\-\-no\-members\|] |
| 37 | [\|\-\-class\-qualify\|] | 37 | [\|\-\-class\-qualify\|] |
| 38 | [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|] | 38 | [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|] |
| @@ -105,6 +105,12 @@ the default in C and derived languages. | |||
| 105 | Do not tag global variables in C and derived languages. Typically this | 105 | Do not tag global variables in C and derived languages. Typically this |
| 106 | reduces the file size by one fourth. | 106 | reduces the file size by one fourth. |
| 107 | .TP | 107 | .TP |
| 108 | .B \-\-no\-line\-directive | ||
| 109 | Ignore \fB#line\fP preprocessor directives in C and derived languages. The | ||
| 110 | default is to honor those directives, and record the tags as if the | ||
| 111 | file scanned was the one named in the \fB#line\fP directive. This switch is | ||
| 112 | useful when the original file named by \fB#line\fP is no longer available. | ||
| 113 | .TP | ||
| 108 | \fB\-i\fP \fIfile\fP, \fB\-\-include=\fIfile\fP | 114 | \fB\-i\fP \fIfile\fP, \fB\-\-include=\fIfile\fP |
| 109 | Include a note in the tag file indicating that, when searching for a | 115 | Include a note in the tag file indicating that, when searching for a |
| 110 | tag, one should also consult the tags file \fIfile\fP after checking the | 116 | tag, one should also consult the tags file \fIfile\fP after checking the |
| @@ -214,6 +214,14 @@ for use in Emacs bug reports. | |||
| 214 | hiding character but the default `.' can be used by let-binding the | 214 | hiding character but the default `.' can be used by let-binding the |
| 215 | variable `read-hide-char'. | 215 | variable `read-hide-char'. |
| 216 | 216 | ||
| 217 | +++ | ||
| 218 | ** The Emacs pseudo-random number generator can be securely seeded. | ||
| 219 | On system where Emacs can access the system entropy or some other | ||
| 220 | cryptographically secure random stream, it now uses that when `random' | ||
| 221 | is called with its argument `t'. This allows cryptographically strong | ||
| 222 | random values; in particular, the Emacs server now uses this facility | ||
| 223 | to produce its authentication key. | ||
| 224 | |||
| 217 | --- | 225 | --- |
| 218 | ** New input methods: `tamil-dvorak' and `programmer-dvorak'. | 226 | ** New input methods: `tamil-dvorak' and `programmer-dvorak'. |
| 219 | 227 | ||
| @@ -726,8 +734,6 @@ to produce a neat summary. | |||
| 726 | 734 | ||
| 727 | --- | 735 | --- |
| 728 | ** New js.el option `js-indent-first-init'. | 736 | ** New js.el option `js-indent-first-init'. |
| 729 | It was renamed from `js-indent-first-initialiser', to avoid issues | ||
| 730 | with American vs British spelling. | ||
| 731 | 737 | ||
| 732 | ** Info | 738 | ** Info |
| 733 | 739 | ||
diff --git a/lib-src/etags.c b/lib-src/etags.c index 2192627c7e0..54ed1b428e9 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -951,8 +951,7 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 951 | Do not create tag entries for global variables in some\n\ | 951 | Do not create tag entries for global variables in some\n\ |
| 952 | languages. This makes the tags file smaller."); | 952 | languages. This makes the tags file smaller."); |
| 953 | 953 | ||
| 954 | if (PRINT_UNDOCUMENTED_OPTIONS_HELP) | 954 | puts ("--no-line-directive\n\ |
| 955 | puts ("--no-line-directive\n\ | ||
| 956 | Ignore #line preprocessor directives in C and derived languages."); | 955 | Ignore #line preprocessor directives in C and derived languages."); |
| 957 | 956 | ||
| 958 | if (CTAGS) | 957 | if (CTAGS) |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 4efec86f6e0..10f93d8e526 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -122,7 +122,6 @@ This variable can be a list of select methods which Gnus will query with | |||
| 122 | the `ask-server' method in addition to the primary, secondary, and archive | 122 | the `ask-server' method in addition to the primary, secondary, and archive |
| 123 | servers. | 123 | servers. |
| 124 | 124 | ||
| 125 | |||
| 126 | E.g.: | 125 | E.g.: |
| 127 | (setq gnus-check-new-newsgroups | 126 | (setq gnus-check-new-newsgroups |
| 128 | \\='((nntp \"some.server\") (nntp \"other.server\"))) | 127 | \\='((nntp \"some.server\") (nntp \"other.server\"))) |
| @@ -1673,10 +1672,11 @@ backend check whether the group actually exists." | |||
| 1673 | (push (setq method-group-list (list method method-type nil nil)) | 1672 | (push (setq method-group-list (list method method-type nil nil)) |
| 1674 | type-cache)) | 1673 | type-cache)) |
| 1675 | ;; Only add groups that need updating. | 1674 | ;; Only add groups that need updating. |
| 1676 | (if (funcall (if one-level #'= #'<=) (gnus-info-level info) | 1675 | (if (or (and foreign-level (null (numberp foreign-level))) |
| 1677 | (if (eq (cadr method-group-list) 'foreign) | 1676 | (funcall (if one-level #'= #'<=) (gnus-info-level info) |
| 1678 | foreign-level | 1677 | (if (eq (cadr method-group-list) 'foreign) |
| 1679 | alevel)) | 1678 | foreign-level |
| 1679 | alevel))) | ||
| 1680 | (setcar (nthcdr 2 method-group-list) | 1680 | (setcar (nthcdr 2 method-group-list) |
| 1681 | (cons info (nth 2 method-group-list))) | 1681 | (cons info (nth 2 method-group-list))) |
| 1682 | ;; The group is inactive, so we nix out the number of unread articles. | 1682 | ;; The group is inactive, so we nix out the number of unread articles. |
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 88ed08d4429..80b52ed9561 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el | |||
| @@ -990,6 +990,14 @@ comment markers." | |||
| 990 | (goto-char (point-max)))))) | 990 | (goto-char (point-max)))))) |
| 991 | (set-marker end nil)) | 991 | (set-marker end nil)) |
| 992 | 992 | ||
| 993 | (defun comment-make-bol-ws (len) | ||
| 994 | "Make a white-space string of width LEN for use at BOL. | ||
| 995 | When `indent-tabs-mode' is non-nil, tab characters will be used." | ||
| 996 | (if (and indent-tabs-mode (> tab-width 0)) | ||
| 997 | (concat (make-string (/ len tab-width) ?\t) | ||
| 998 | (make-string (% len tab-width) ? )) | ||
| 999 | (make-string len ? ))) | ||
| 1000 | |||
| 993 | (defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block) | 1001 | (defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block) |
| 994 | "Make the leading and trailing extra lines. | 1002 | "Make the leading and trailing extra lines. |
| 995 | This is used for `extra-line' style (or `box' style if BLOCK is specified)." | 1003 | This is used for `extra-line' style (or `box' style if BLOCK is specified)." |
| @@ -1025,8 +1033,8 @@ This is used for `extra-line' style (or `box' style if BLOCK is specified)." | |||
| 1025 | (setq cs (replace-match fill t t s))) | 1033 | (setq cs (replace-match fill t t s))) |
| 1026 | (string-match re e) | 1034 | (string-match re e) |
| 1027 | (setq ce (replace-match fill t t e)))) | 1035 | (setq ce (replace-match fill t t e)))) |
| 1028 | (cons (concat cs "\n" (make-string min-indent ? ) ccs) | 1036 | (cons (concat cs "\n" (comment-make-bol-ws min-indent) ccs) |
| 1029 | (concat cce "\n" (make-string (+ min-indent eindent) ? ) ce)))) | 1037 | (concat cce "\n" (comment-make-bol-ws (+ min-indent eindent)) ce)))) |
| 1030 | 1038 | ||
| 1031 | (defmacro comment-with-narrowing (beg end &rest body) | 1039 | (defmacro comment-with-narrowing (beg end &rest body) |
| 1032 | "Execute BODY with BEG..END narrowing. | 1040 | "Execute BODY with BEG..END narrowing. |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index b08c555e34f..63f01829845 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6739,6 +6739,9 @@ comment at the start of cc-engine.el for more info." | |||
| 6739 | (c-backward-syntactic-ws)) | 6739 | (c-backward-syntactic-ws)) |
| 6740 | (c-back-over-list-of-member-inits) | 6740 | (c-back-over-list-of-member-inits) |
| 6741 | (and (eq (char-before) ?:) | 6741 | (and (eq (char-before) ?:) |
| 6742 | (save-excursion | ||
| 6743 | (c-backward-token-2) | ||
| 6744 | (not (looking-at c-:$-multichar-token-regexp))) | ||
| 6742 | (c-just-after-func-arglist-p)))) | 6745 | (c-just-after-func-arglist-p)))) |
| 6743 | 6746 | ||
| 6744 | (while (and (not (and level-plausible | 6747 | (while (and (not (and level-plausible |
| @@ -6753,6 +6756,9 @@ comment at the start of cc-engine.el for more info." | |||
| 6753 | (c-backward-syntactic-ws) | 6756 | (c-backward-syntactic-ws) |
| 6754 | (c-back-over-list-of-member-inits) | 6757 | (c-back-over-list-of-member-inits) |
| 6755 | (and (eq (char-before) ?:) | 6758 | (and (eq (char-before) ?:) |
| 6759 | (save-excursion | ||
| 6760 | (c-backward-token-2) | ||
| 6761 | (not (looking-at c-:$-multichar-token-regexp))) | ||
| 6756 | (c-just-after-func-arglist-p))))) | 6762 | (c-just-after-func-arglist-p))))) |
| 6757 | 6763 | ||
| 6758 | (and at-top-level level-plausible))) | 6764 | (and at-top-level level-plausible))) |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index b52da3f662d..48dd9960886 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -1219,6 +1219,14 @@ operators." | |||
| 1219 | (c-lang-defvar c-assignment-op-regexp | 1219 | (c-lang-defvar c-assignment-op-regexp |
| 1220 | (c-lang-const c-assignment-op-regexp)) | 1220 | (c-lang-const c-assignment-op-regexp)) |
| 1221 | 1221 | ||
| 1222 | (c-lang-defconst c-:$-multichar-token-regexp | ||
| 1223 | ;; Regexp matching all tokens ending in ":" which are longer than one char. | ||
| 1224 | ;; Currently (2016-01-07) only used in C++ Mode. | ||
| 1225 | t (c-make-keywords-re nil | ||
| 1226 | (c-filter-ops (c-lang-const c-operators) t ".+:$"))) | ||
| 1227 | (c-lang-defvar c-:$-multichar-token-regexp | ||
| 1228 | (c-lang-const c-:$-multichar-token-regexp)) | ||
| 1229 | |||
| 1222 | (c-lang-defconst c-<>-multichar-token-regexp | 1230 | (c-lang-defconst c-<>-multichar-token-regexp |
| 1223 | ;; Regexp matching all tokens containing "<" or ">" which are longer | 1231 | ;; Regexp matching all tokens containing "<" or ">" which are longer |
| 1224 | ;; than one char. | 1232 | ;; than one char. |
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 4aee2734158..b77f8e9717c 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el | |||
| @@ -272,7 +272,11 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio | |||
| 272 | (or (eolp) | 272 | (or (eolp) |
| 273 | (let ((pos (point))) | 273 | (let ((pos (point))) |
| 274 | (move-to-column col t) | 274 | (move-to-column col t) |
| 275 | (delete-region pos (point))))) | 275 | (let ((old-width (string-width (buffer-substring pos (point))))) |
| 276 | (delete-region pos (point)) | ||
| 277 | (when (> old-width width) | ||
| 278 | (insert-char ? (- old-width width)) | ||
| 279 | (goto-char pos)))))) | ||
| 276 | (insert ch) | 280 | (insert ch) |
| 277 | (forward-char -1) | 281 | (forward-char -1) |
| 278 | (picture-move)))) | 282 | (picture-move)))) |
diff --git a/src/dispnew.c b/src/dispnew.c index 8d671f82e47..3e1557fa3b9 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -320,7 +320,9 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, int margin) | |||
| 320 | int width = w->total_cols; | 320 | int width = w->total_cols; |
| 321 | double d = max (0, margin); | 321 | double d = max (0, margin); |
| 322 | d = min (width / 2 - 1, d); | 322 | d = min (width / 2 - 1, d); |
| 323 | return (int) ((double) total_glyphs / width * d); | 323 | /* Since MARGIN is positive, we cannot possibly have less than |
| 324 | one glyph for the marginal area. */ | ||
| 325 | return max (1, (int) ((double) total_glyphs / width * d)); | ||
| 324 | } | 326 | } |
| 325 | return 0; | 327 | return 0; |
| 326 | } | 328 | } |
| @@ -50,7 +50,8 @@ All integers representable in Lisp, i.e. between `most-negative-fixnum' | |||
| 50 | and `most-positive-fixnum', inclusive, are equally likely. | 50 | and `most-positive-fixnum', inclusive, are equally likely. |
| 51 | 51 | ||
| 52 | With positive integer LIMIT, return random number in interval [0,LIMIT). | 52 | With positive integer LIMIT, return random number in interval [0,LIMIT). |
| 53 | With argument t, set the random number seed from the current time and pid. | 53 | With argument t, set the random number seed from the system's entropy |
| 54 | pool, or from the current time and pid if entropy is unavailable. | ||
| 54 | With a string argument, set the seed based on the string's contents. | 55 | With a string argument, set the seed based on the string's contents. |
| 55 | Other values of LIMIT are ignored. | 56 | Other values of LIMIT are ignored. |
| 56 | 57 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index a78c4c64c81..1fa422947ed 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2095,8 +2095,35 @@ seed_random (void *seed, ptrdiff_t seed_size) | |||
| 2095 | void | 2095 | void |
| 2096 | init_random (void) | 2096 | init_random (void) |
| 2097 | { | 2097 | { |
| 2098 | struct timespec t = current_timespec (); | 2098 | uintmax_t v; |
| 2099 | uintmax_t v = getpid () ^ t.tv_sec ^ t.tv_nsec; | 2099 | struct timespec t; |
| 2100 | bool success = false; | ||
| 2101 | |||
| 2102 | #if HAVE_DEV_URANDOM | ||
| 2103 | FILE *fp = fopen ("/dev/urandom", "rb"); | ||
| 2104 | |||
| 2105 | if (fp) | ||
| 2106 | { | ||
| 2107 | int i; | ||
| 2108 | |||
| 2109 | for (i = 0, v = 0; i < sizeof (uintmax_t); i++) | ||
| 2110 | { | ||
| 2111 | v <<= 8; | ||
| 2112 | v |= fgetc (fp); | ||
| 2113 | } | ||
| 2114 | fclose (fp); | ||
| 2115 | success = true; | ||
| 2116 | } | ||
| 2117 | #elif defined WINDOWSNT | ||
| 2118 | if (w32_init_random (&v, sizeof v) == 0) | ||
| 2119 | success = true; | ||
| 2120 | #endif /* HAVE_DEV_URANDOM || WINDOWSNT */ | ||
| 2121 | if (!success) | ||
| 2122 | { | ||
| 2123 | /* Fall back to current time value + PID. */ | ||
| 2124 | t = current_timespec (); | ||
| 2125 | v = getpid () ^ t.tv_sec ^ t.tv_nsec; | ||
| 2126 | } | ||
| 2100 | seed_random (&v, sizeof v); | 2127 | seed_random (&v, sizeof v); |
| 2101 | } | 2128 | } |
| 2102 | 2129 | ||
| @@ -224,6 +224,8 @@ typedef struct _REPARSE_DATA_BUFFER { | |||
| 224 | 224 | ||
| 225 | #include <iphlpapi.h> /* should be after winsock2.h */ | 225 | #include <iphlpapi.h> /* should be after winsock2.h */ |
| 226 | 226 | ||
| 227 | #include <wincrypt.h> | ||
| 228 | |||
| 227 | #include <c-strcase.h> | 229 | #include <c-strcase.h> |
| 228 | 230 | ||
| 229 | #include "w32.h" | 231 | #include "w32.h" |
| @@ -2093,6 +2095,34 @@ init_user_info (void) | |||
| 2093 | CloseHandle (token); | 2095 | CloseHandle (token); |
| 2094 | } | 2096 | } |
| 2095 | 2097 | ||
| 2098 | static HCRYPTPROV w32_crypto_hprov; | ||
| 2099 | static int | ||
| 2100 | w32_init_crypt_random (void) | ||
| 2101 | { | ||
| 2102 | if (!CryptAcquireContext (&w32_crypto_hprov, NULL, NULL, PROV_RSA_FULL, | ||
| 2103 | CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) | ||
| 2104 | { | ||
| 2105 | DebPrint (("CryptAcquireContext failed with error %x\n", | ||
| 2106 | GetLastError ())); | ||
| 2107 | w32_crypto_hprov = 0; | ||
| 2108 | return -1; | ||
| 2109 | } | ||
| 2110 | return 0; | ||
| 2111 | } | ||
| 2112 | |||
| 2113 | int | ||
| 2114 | w32_init_random (void *buf, ptrdiff_t buflen) | ||
| 2115 | { | ||
| 2116 | if (!w32_crypto_hprov) | ||
| 2117 | w32_init_crypt_random (); | ||
| 2118 | if (w32_crypto_hprov) | ||
| 2119 | { | ||
| 2120 | if (CryptGenRandom (w32_crypto_hprov, buflen, (BYTE *)buf)) | ||
| 2121 | return 0; | ||
| 2122 | } | ||
| 2123 | return -1; | ||
| 2124 | } | ||
| 2125 | |||
| 2096 | int | 2126 | int |
| 2097 | random (void) | 2127 | random (void) |
| 2098 | { | 2128 | { |
| @@ -9410,6 +9440,8 @@ globals_of_w32 (void) | |||
| 9410 | extern void dynlib_reset_last_error (void); | 9440 | extern void dynlib_reset_last_error (void); |
| 9411 | dynlib_reset_last_error (); | 9441 | dynlib_reset_last_error (); |
| 9412 | #endif | 9442 | #endif |
| 9443 | |||
| 9444 | w32_crypto_hprov = (HCRYPTPROV)0; | ||
| 9413 | } | 9445 | } |
| 9414 | 9446 | ||
| 9415 | /* For make-serial-process */ | 9447 | /* For make-serial-process */ |
| @@ -222,6 +222,9 @@ extern int w32_memory_info (unsigned long long *, unsigned long long *, | |||
| 222 | /* Compare 2 UTF-8 strings in locale-dependent fashion. */ | 222 | /* Compare 2 UTF-8 strings in locale-dependent fashion. */ |
| 223 | extern int w32_compare_strings (const char *, const char *, char *, int); | 223 | extern int w32_compare_strings (const char *, const char *, char *, int); |
| 224 | 224 | ||
| 225 | /* Return a cryptographically secure seed for PRNG. */ | ||
| 226 | extern int w32_init_random (void *, ptrdiff_t); | ||
| 227 | |||
| 225 | #ifdef HAVE_GNUTLS | 228 | #ifdef HAVE_GNUTLS |
| 226 | #include <gnutls/gnutls.h> | 229 | #include <gnutls/gnutls.h> |
| 227 | 230 | ||
diff --git a/src/window.c b/src/window.c index bb414e7d311..bbe47c7255a 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3970,9 +3970,11 @@ values. */) | |||
| 3970 | } | 3970 | } |
| 3971 | 3971 | ||
| 3972 | 3972 | ||
| 3973 | /* Resize frame F's windows when number of lines of F is set to SIZE. | 3973 | /* Resize frame F's windows when F's width or height is set to SIZE. |
| 3974 | HORFLAG means resize windows when number of columns of F is set to | 3974 | If HORFLAG is zero, F's width was set to SIZE, otherwise its height |
| 3975 | SIZE. PIXELWISE means to interpret SIZE as pixels. */ | 3975 | was set. SIZE is interpreted in F's canonical character units |
| 3976 | (a.k.a. "columns" or "lines"), unless PIXELWISE is non-zero, which | ||
| 3977 | means to interpret SIZE in pixel units. */ | ||
| 3976 | void | 3978 | void |
| 3977 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | 3979 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) |
| 3978 | { | 3980 | { |
| @@ -4073,7 +4075,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | |||
| 4073 | m = XWINDOW (mini); | 4075 | m = XWINDOW (mini); |
| 4074 | if (horflag) | 4076 | if (horflag) |
| 4075 | { | 4077 | { |
| 4076 | m->total_cols = size; | 4078 | m->total_cols = new_size; |
| 4077 | m->pixel_width = new_pixel_size; | 4079 | m->pixel_width = new_pixel_size; |
| 4078 | } | 4080 | } |
| 4079 | else | 4081 | else |