summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-07-31 10:12:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-07-31 10:13:38 -0700
commiteb0f65b4fbbea60100b53cb40a1d7138d47ad0d2 (patch)
treef2debb3a46b3e18217d8cd1736fc7d8add90e3bd /lisp/gnus
parent0f23e95b29a7a0a07bba0e9bc796cd7b7bc7232a (diff)
Don't overflow if computing approximate percentage
* lisp/align.el (align-region): * lisp/cedet/semantic.el (semantic-repeat-parse-whole-stream): * lisp/cedet/semantic/wisent.el (wisent-parse-region): * lisp/cus-edit.el (custom-buffer-create-internal): * lisp/emacs-lisp/checkdoc.el (checkdoc-interactive-ispell-loop) (checkdoc-message-interactive-ispell-loop, checkdoc-next-error) (checkdoc-next-message-error): * lisp/emacs-lisp/eieio-opt.el (eieio-display-method-list): * lisp/epa.el (epa-progress-callback-function): * lisp/erc/erc-dcc.el (erc-dcc-do-LIST-command): * lisp/ffap.el (ffap-menu-rescan): * lisp/gnus/nnbabyl.el (nnbabyl-retrieve-headers): * lisp/gnus/nndiary.el (nndiary-retrieve-headers): * lisp/gnus/nneething.el (nneething-retrieve-headers): * lisp/gnus/nnmbox.el (nnmbox-retrieve-headers): * lisp/gnus/nnmh.el (nnmh-retrieve-headers): * lisp/gnus/nnml.el (nnml-retrieve-headers): * lisp/gnus/nnspool.el (nnspool-retrieve-headers): * lisp/gnus/nntp.el (nntp-retrieve-headers) (nntp-retrieve-articles): * lisp/imenu.el (imenu--relative-position): * lisp/international/ja-dic-cnv.el (skkdic-collect-okuri-nasi) (skkdic-convert-okuri-nasi): * lisp/net/ange-ftp.el (ange-ftp-process-handle-hash): * lisp/nxml/rng-valid.el (rng-compute-mode-line-string): * lisp/org/org-list.el (org-update-checkbox-count): * lisp/org/org.el (org-table-map-tables) (org-update-parent-todo-statistics): * lisp/play/decipher.el (decipher-insert-frequency-counts) (decipher-analyze-buffer): * lisp/profiler.el (profiler-format-percent): * lisp/progmodes/cc-cmds.el (c-progress-update): * lisp/progmodes/cpp.el (cpp-highlight-buffer): * lisp/progmodes/idlwave.el (idlwave-convert-xml-system-routine-info) (idlwave-list-load-path-shadows): * lisp/progmodes/opascal.el (opascal-step-progress): * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info) (vhdl-scan-directory-contents): * lisp/textmodes/bibtex.el (bibtex-progress-message): * lisp/textmodes/flyspell.el (flyspell-small-region) (flyspell-external-point-words): * lisp/textmodes/table.el (table-recognize): Prefer (floor (* 100.0 NUMERATOR) DENOMINATOR) when calculating progress-report percentages and the like. This avoids problems if (* 100 NUMERATOR) would overflow. * lisp/gnus/gnus-registry.el (gnus-registry-import-eld): * lisp/gnus/registry.el (registry-reindex): Use (* 100.0 ...) rather than (* 100 ...) to avoid int overflow issues. * lisp/descr-text.el (describe-char): * lisp/org/org-colview.el (org-nofm-to-completion): * lisp/ps-print.el (ps-plot): * lisp/simple.el (what-cursor-position): Prefer (round (* 100.0 NUMERATOR) DENOMINATOR) to a more-complicated and less-accurate approximation.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/gnus-registry.el2
-rw-r--r--lisp/gnus/nnbabyl.el2
-rw-r--r--lisp/gnus/nndiary.el2
-rw-r--r--lisp/gnus/nneething.el2
-rw-r--r--lisp/gnus/nnmbox.el2
-rw-r--r--lisp/gnus/nnmh.el2
-rw-r--r--lisp/gnus/nnml.el2
-rw-r--r--lisp/gnus/nnspool.el2
-rw-r--r--lisp/gnus/nntp.el4
-rw-r--r--lisp/gnus/registry.el2
10 files changed, 11 insertions, 11 deletions
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 0cb596012c7..50443973a8d 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -1100,7 +1100,7 @@ only the last one's marks are returned."
(when (and (< 0 expected)
(= 0 (mod count 100)))
(message "importing: %d of %d (%.2f%%)"
- count expected (/ (* 100 count) expected)))
+ count expected (/ (* 100.0 count) expected)))
(setq entry (car-safe old)
old (cdr-safe old))
(let* ((id (car-safe entry))
diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el
index d060c2a80dd..ae417a0ffe8 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -105,7 +105,7 @@
(> number nnmail-large-newsgroup)
(zerop (% (incf count) 20))
(nnheader-message 5 "nnbabyl: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 027d8888705..31344382029 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -423,7 +423,7 @@ all. This may very well take some time.")
(> number nnmail-large-newsgroup)
(zerop (% count 20))
(nnheader-message 6 "nndiary: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index 183e3967632..0d9044fb712 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -106,7 +106,7 @@ included.")
(and large
(zerop (% count 20))
(nnheader-message 5 "nneething: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(when large
(nnheader-message 5 "nneething: Receiving headers...done"))
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index 78983a5cfef..a70a0395f37 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -106,7 +106,7 @@
(> number nnmail-large-newsgroup)
(zerop (% count 20))
(nnheader-message 5 "nnmbox: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el
index 04270a554cf..cdbf38ae62d 100644
--- a/lisp/gnus/nnmh.el
+++ b/lisp/gnus/nnmh.el
@@ -109,7 +109,7 @@ as unread by Gnus.")
(and large
(zerop (% count 20))
(nnheader-message 5 "nnmh: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(when large
(nnheader-message 5 "nnmh: Receiving headers...done"))
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 8275e19f3b6..c825e097481 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -178,7 +178,7 @@ non-nil.")
(> number nnmail-large-newsgroup)
(zerop (% count 20))
(nnheader-message 6 "nnml: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)
diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el
index 9e9537af1f9..f10b1ad6c54 100644
--- a/lisp/gnus/nnspool.el
+++ b/lisp/gnus/nnspool.el
@@ -174,7 +174,7 @@ there.")
(and do-message
(zerop (% (incf count) 20))
(nnheader-message 5 "nnspool: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(when do-message
(nnheader-message 5 "nnspool: Receiving headers...done"))
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index 0891dba0387..b617a1beeb2 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -728,7 +728,7 @@ command whose response triggered the error."
(> number nntp-large-newsgroup)
(zerop (% received 20))
(nnheader-message 6 "NNTP: Receiving headers... %d%%"
- (/ (* received 100) number)))
+ (floor (* received 100.0) number)))
(nntp-accept-response))))
(and (numberp nntp-large-newsgroup)
(> number nntp-large-newsgroup)
@@ -965,7 +965,7 @@ command whose response triggered the error."
(> number nntp-large-newsgroup)
(zerop (% received 20))
(nnheader-message 6 "NNTP: Receiving articles... %d%%"
- (/ (* received 100) number)))
+ (floor (* received 100.0) number)))
(nntp-accept-response))))
(and (numberp nntp-large-newsgroup)
(> number nntp-large-newsgroup)
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el
index 96a89fca1b7..7bada9f3095 100644
--- a/lisp/gnus/registry.el
+++ b/lisp/gnus/registry.el
@@ -320,7 +320,7 @@ Errors out if the key exists already."
(when (and (< 0 expected)
(= 0 (mod count 1000)))
(message "reindexing: %d of %d (%.2f%%)"
- count expected (/ (* 100 count) expected)))
+ count expected (/ (* 100.0 count) expected)))
(dolist (val (cdr-safe (assq tr v)))
(let* ((value-keys (registry-lookup-secondary-value db tr val)))
(push key value-keys)