From 3d39c76eff8763373ebf76ba95f0d8b5d872981f Mon Sep 17 00:00:00 2001 From: Reiner Steib Date: Sun, 9 Dec 2007 12:32:43 +0000 Subject: [PATCH] (imap-string-to-integer): New function. --- lisp/ChangeLog | 4 ++++ lisp/imap.el | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0f6b1c850..9283c6d55 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-12-09 Reiner Steib + + * imap.el (imap-string-to-integer): New function. + 2007-12-07 Katsumi Yamaoka * dgnushack.el (dgnushack-emacs-compile-defcustom-p): New function; use diff --git a/lisp/imap.el b/lisp/imap.el index 8e41c6872..86b892ef8 100644 --- a/lisp/imap.el +++ b/lisp/imap.el @@ -1734,6 +1734,18 @@ is non-nil return these properties." (concat "UID STORE " articles " +FLAGS" (if silent ".SILENT") " (" flags ")")))))) +;; Cf. http://thread.gmane.org/gmane.emacs.gnus.general/65317/focus=65343 +;; Signal an error if we'd get an integer overflow. +;; +;; FIXME: Identify relevant calls to `string-to-number' and replace them with +;; `imap-string-to-integer'. +(defun imap-string-to-integer (string &optional base) + (let ((number (string-to-number string base))) + (if (> number most-positive-fixnum) + (error + (format "String %s cannot be converted to a lisp integer" number)) + number))) + (defun imap-message-copyuid-1 (mailbox) (if (imap-capability 'UIDPLUS) (list (nth 0 (imap-mailbox-get-1 'copyuid mailbox)) -- 2.25.1