Paul Eggert [Wed, 13 Apr 2011 05:02:54 +0000 (22:02 -0700)]
emacs_write: Return size_t, not ssize_t, to avoid overflow issues.
* gnutls.c, gnutls.h (emacs_gnutls_write): Return size_t, not ssize_t.
* sysdep.c, lisp.h (emacs_write): Likewise.
Without the above change, emacs_gnutls_write and emacs_write had
undefined behavior and would typically mistakenly report an error
when writing a buffer whose size exceeds SSIZE_MAX.
(emacs_read, emacs_write): Remove check for negative size, as the
Emacs source code has been audited now.
(emacs_write): Adjust to new signature, making the code look more
like that of emacs_gnutls_write.
* process.c (send_process): Adjust to the new signatures of
emacs_write and emacs_gnutls_write. Do not attempt to store
a byte offset into an 'int'; it might overflow.
Paul Eggert [Wed, 13 Apr 2011 03:22:40 +0000 (20:22 -0700)]
* sound.c: Don't assume sizes fit in 'int'.
(struct sound_device.period_size, alsa_period_size):
Return size_t, not int.
(struct sound_device.write, vox_write, alsa_write):
Accept size_t, not int.
(wav_play, au_play): Use size_t to store sizes, and ssize_t to
record read return values.
gnus.texi (Window Layout): @itemize @code doesn't exist. It's @table @code.
gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): Fix logic bug.
(gnus-registry-post-process-groups): Fix logging of no results and quote sender and subject.
network-stream.el (network-stream-open-starttls): Only do opportunistic STARTTLS upgrades if we have built-in gnutls support. Upgrades via gnutls-cli are too slow to be done opportunistically.
gnus-start.el (gnus-get-unread-articles): Slight cleanup.
(gnus-read-active-for-groups): Don't try to finish getting stuff where we had no early-data returned.
(gnus-get-unread-articles): Add a sanity check so that we don't issue two async commands to the same server at the same time.
gnus-sum.el (gnus-summary-select-article-buffer): Doc fix.
gnus-registry.el (gnus-registry-remake-db): Put the warning on a "warning" level.
Paul Eggert [Tue, 12 Apr 2011 08:12:01 +0000 (01:12 -0700)]
* sysdep.c (emacs_read, emacs_write): Check for negative sizes
since callers should never pass a negative size.
Change the signature to match that of plain 'read' and 'write'; see
<http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>.
* lisp.h: Update prototypes of emacs_write and emacs_read.
gnus-registry.el (gnus-registry-action): Remove properties and simplify subject in `gnus-registry-handle-action'.
(gnus-registry-spool-action): Get subject and sender from message if they are not passed in.
(gnus-registry-handle-action): Remove properties and simplify subject consistently.
Eli Zaretskii [Mon, 11 Apr 2011 16:39:09 +0000 (19:39 +0300)]
Fix bug #8468 with redisplay and scroll-margin > 0.
src/xdisp.c (redisplay_window): Don't try to determine the character
position of the scroll margin if the window start point w->startp
is outside the buffer's accessible region.
Eli Zaretskii [Mon, 11 Apr 2011 15:59:30 +0000 (18:59 +0300)]
Fix bug #8468 with redisplay when scroll-margin > 0.
src/xdisp.c (redisplay_window): Don't try to determine the character
position of the scroll margin if the window start point w->startp
is outside the buffer's accessible region.
Fix bad interaction between icomplete and completion inline help (Bug#5849).
* lisp/minibuffer.el (completion-show-inline-help): New var.
(completion--do-completion, minibuffer-complete)
(minibuffer-force-complete, minibuffer-complete-word): Inhibit
minibuffer messages if completion-show-inline-help is nil.
* lisp/icomplete.el (icomplete-mode): Bind completion-show-inline-help
to avoid interference from inline help.
Eli Zaretskii [Sun, 10 Apr 2011 20:43:08 +0000 (23:43 +0300)]
Fix write-region and its subroutines for buffers > 2GB.
src/fileio.c (a_write, e_write): Modify declaration of arguments and
local variables to support buffers larger than 2GB.
(Fcopy_file): Use EMACS_INT for return value of emacs_read.
src/sysdep.c (emacs_write, emacs_read): Use ssize_t for last
argument, local variables, and return value.
src/lisp.h: Update prototypes of emacs_write and emacs_read.
src/sound.c (vox_write): Use ssize_t for return value of emacs_write.
Jim Meyering [Sun, 10 Apr 2011 14:00:13 +0000 (16:00 +0200)]
use ssize_t and size_t for read- and write-like emacs_gnutls_* functions
* gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like:
return ssize_t not "int", and use size_t as the buffer length.
(emacs_gnutls_write): Likewise, and make the buffer pointer "const".
* gnutls.h: Update declarations.
* process.c (read_process_output): Use ssize_t, to match.
(send_process): Likewise.
* lisp/image-mode.el (image-toggle-display-image): Signal an error if
not in Image mode.
(image-transform-mode, image-transform-resize)
(image-transform-set-rotation): Doc fix.
(image-transform-set-resize): Deleted.
(image-transform-set-scale, image-transform-fit-to-height)
(image-transform-fit-to-width): Handle image-toggle-display-image
and image-transform-resize directly.
* src/image.c (Fimagemagick_types): Doc fix, and comment cleanup.
Paul Eggert [Sat, 9 Apr 2011 20:19:05 +0000 (13:19 -0700)]
* callint.c (Fcall_interactively): <, not <=, for optimization.
(Fcall_interactively): Count the number of arguments produced,
not the number of arguments given. This is simpler and lets GCC
4.6.0 generate slightly better code.
Paul Eggert [Sat, 9 Apr 2011 19:14:12 +0000 (12:14 -0700)]
* ftfont.c: Distingish more carefully between FcChar8 and char.
The previous code passed unsigned char * to a functions like
strlen and xstrcasecmp that expect char *, which does not
conform to the C standard.
(get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for
arguments to FcPatternGetString, and explicitly cast FcChar8 * to
char * when the C standard requires it.
Eli Zaretskii [Sat, 9 Apr 2011 06:59:26 +0000 (09:59 +0300)]
Produce more accurate results from file-size-human-readable.
lisp/files.el (file-size-human-readable): Produce one digit after
decimal, like "ls -lh" does.
lisp/ls-lisp.el (ls-lisp-format-file-size): Allow for 7 characters in
the file size representation.
Paul Eggert [Fri, 8 Apr 2011 23:28:52 +0000 (16:28 -0700)]
* eval.c: Port to Windows vsnprintf (Bug#8435).
Include <limits.h>.
(SIZE_MAX): Define if the headers do not.
(verror): Do not give up if vsnprintf returns a negative count.
Instead, grow the buffer. This ports to Windows vsnprintf, which
does not conform to C99. Problem reported by Eli Zaretskii.
Also, simplify the allocation scheme, by avoiding the need for
calling realloc, and removing the ALLOCATED variable.
* doc-view.el (doc-view-fit-width-to-window)
(doc-view-fit-height-to-window, doc-view-fit-page-to-window): New
functions for fitting the shown image to the Emacs window size.
(doc-view-mode-map): Add bindings for the new functions.
Eli Zaretskii [Fri, 8 Apr 2011 15:31:33 +0000 (18:31 +0300)]
New function file-size-human-readable.
lisp/files.el (file-size-human-readable): New function.
lisp/ls-lisp.el (ls-lisp-format-file-size): Use it, instead of
computing the representation inline. Don't require `cl'.
* lisp/vc/log-edit.el (log-edit-empty-buffer-p): New function.
(log-edit-insert-cvs-template, log-edit-insert-cvs-rcstemplate):
Use log-edit-empty-buffer-p.
gnus-registry.el (gnus-registry-handle-action): More debugging.
gnus-start.el (gnus-gnus-to-newsrc-format): Add a way to run interactively so the newsrc file can contain foreign groups too. Useful for debugging but not much for users.
registry.el (registry-usage-test): Only do `registry-lookup-breaks-before-lexbind' testing for Emacs24 with lexical binding.
Paul Eggert [Thu, 7 Apr 2011 03:34:05 +0000 (20:34 -0700)]
error: Print 32- and 64-bit integers portably (Bug#8435).
Without this change, on typical 64-bit hosts error ("...%d...", N)
was used to print both 32- and 64-bit integers N, which relied on
undefined behavior.
* lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
New macro.
* lisp.h (error, verror): Mark as printf-like functions.
* eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
Report overflow in size calculations when allocating printf buffer.
Do not truncate output string at its first null byte.
* xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
Truncate the output at a character boundary, since vsnprintf does not
do that.
* charset.c (check_iso_charset_parameter): Convert internal
character to string before calling 'error', since %c now has the
printf meaning.
* coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
overflow when computing char to be passed to 'error'. Do not
pass Lisp_Object to 'error'; pass the integer instead.
* nsfns.m (Fns_do_applescript): Use int, not long, since it's
formatted with plain %d.
registry.el, gnus-registry.el: Use `ignore-errors' instead of third argument NOERROR for `require', since XEmacs 21.4 does not support it.
registry.el (initialize-instance): Change :after to :AFTER to be compatible with old EIEIO version in XEmacs.
gnus-registry.el (gnus-registry-post-process-groups)
(gnus-registry--split-fancy-with-parent-internal): Fix splitting bugs and provide better messaging.
gnus-registry.el: Load ERT unconditionally anyway, discarding errors.
registry.el: Load ERT unconditionally anyway, discarding errors.
* lisp/simple.el: Lisp reimplement of list-processes. Based on an
earlier reimplementation by Leo Liu, but using tabulated-list.el.
(process-menu-mode): New major mode.
(list-processes--refresh, list-processes):
(process-menu-visit-buffer): New functions.
* lisp/files.el (save-buffers-kill-emacs): Don't assume any return
value of list-processes, which is undocumented anyway.
* emacs-lisp/package.el: Use Tabulated List mode.
(package-menu-mode-map): Inherit from tabulated-list-mode-map.
(package-menu-mode): Derive from tabulated-list-mode. Set up the
table format using Tabulated List mode variables.
(package--push): New macro, replacing package-list-maybe-add.
(package-menu--generate): Use package--push. Renamed from
package--generate-package-list.
(package-menu-refresh, list-packages): Use it.
(package-menu--print-info): Renamed from package-print-package.
Return insertion data instead of inserting it directly.
(package-menu-describe-package, package-menu-execute): Use
tabulated-list-get-id.
(package-menu-mark-delete, package-menu-mark-install)
(package-menu-mark-unmark, package-menu-backup-unmark)
(package-menu-mark-obsolete-for-deletion): Use
tabulated-list-put-tag.
(package--list-packages, package-menu-revert)
(package-menu-get-package, package-menu-get-version)
(package-menu-sort-by-column): Functions deleted.
(package-menu-package-list, package-menu-sort-key): Vars deleted.
(package-menu--status-predicate, package-menu--version-predicate)
(package-menu--name-predicate)
(package-menu--description-predicate): Handle arguments in the
Tabulated List format.
(package-list-packages-no-fetch): Call list-packages.
* lisp/files.el (after-find-file-from-revert-buffer): Remove variable.
(after-find-file): Dont' bind it.
(revert-buffer-in-progress-p): New variable.
(revert-buffer): Bind it.
Pass nil for `after-find-file-from-revert-buffer'.
* lisp/saveplace.el (save-place-find-file-hook): Use new variable
`rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
* etc/NEWS: New variable `revert-buffer-in-progress-p'.
Eli Zaretskii [Wed, 6 Apr 2011 17:49:21 +0000 (20:49 +0300)]
Adapt the MS-DOS build to changes in gnulib.
msdos/sedlibmk.inp: Update checklist.
(am_libgnu_a_OBJECTS): Remove careadlinkat.$(OBJEXT).
($(top_builddir)/config.status): Edit away, both as target and in
prerequisites.
(@am__fastdepCC_FALSE@): Fix editing.
(@GL_GENERATE_STDBOOL_H_TRUE@, @GL_GENERATE_STDBOOL_H_FALSE@)
(@GL_GENERATE_STDDEF_H_TRUE@, @GL_GENERATE_STDDEF_H_FALSE@)
(@GL_GENERATE_STDINT_H_TRUE@, @GL_GENERATE_STDINT_H_FALSE@): Edit
to either nothing or "#".
src/msdos.c (careadlinkat, careadlinkatcwd): MS-DOS replacements.
Eli Zaretskii [Wed, 6 Apr 2011 15:44:32 +0000 (18:44 +0300)]
Fix the Windows build due to introduction of ATTRIBUTE_FORMAT_PRINTF.
nt/config.nt (NO_INLINE, ATTRIBUTE_FORMAT)
(ATTRIBUTE_FORMAT_PRINTF): Define, as followup to 2011-04-06T05:19:39Z!eggert@cs.ucla.edu
on the trunk on 2011-04-06.
gnus-registry.el: Don't use ERT if it's not available.
(gnus-registry-delete-entries): New convenience function.
(gnus-registry-import-eld): Import from old .eld registry.
registry.el: Don't use ERT if it's not available.
proto-stream.el (gnutls-negotiate): Revert inadvertent commit of the version from the Claudio Bley GnuTLS patch (extra optional parametersnand host name).