diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-07-31 10:12:37 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-07-31 10:13:38 -0700 |
commit | eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2 (patch) | |
tree | f2debb3a46b3e18217d8cd1736fc7d8add90e3bd /lisp/textmodes | |
parent | 0f23e95b29a7a0a07bba0e9bc796cd7b7bc7232a (diff) | |
download | emacs-eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2.tar.gz |
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/textmodes')
-rw-r--r-- | lisp/textmodes/bibtex.el | 2 | ||||
-rw-r--r-- | lisp/textmodes/flyspell.el | 4 | ||||
-rw-r--r-- | lisp/textmodes/table.el | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 9d6d19e6e1e..b1232d4c0a0 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -2099,7 +2099,7 @@ If FLAG is nil, a message is echoed if point was incremented at least (let* ((size (- (point-max) (point-min))) (perc (if (= size 0) 100 - (/ (* 100 (- (point) (point-min))) size)))) + (floor (* 100.0 (- (point) (point-min))) size)))) (when (>= perc (+ bibtex-progress-lastperc bibtex-progress-interval)) (setq bibtex-progress-lastperc perc) diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index e0749180611..64aa3de146e 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1350,7 +1350,7 @@ that may be included as part of a word (see `ispell-dictionary-alist')." (if (and flyspell-issue-message-flag (= count 100)) (progn (message "Spell Checking...%d%%" - (* 100 (/ (float (- (point) beg)) (- end beg)))) + (floor (* 100.0 (- (point) beg)) (- end beg))) (setq count 0)) (setq count (+ 1 count))) (flyspell-word) @@ -1403,7 +1403,7 @@ The buffer to mark them in is `flyspell-large-region-buffer'." ;; be unnecessary too. -- rms. (if flyspell-issue-message-flag (message "Spell Checking...%d%% [%s]" - (* 100 (/ (float (point)) (point-max))) + (floor (* 100.0 (point)) (point-max)) word)) (with-current-buffer flyspell-large-region-buffer (goto-char buffer-scan-pos) diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el index edc78e52efa..fa9f0fa638a 100644 --- a/lisp/textmodes/table.el +++ b/lisp/textmodes/table.el @@ -1893,7 +1893,9 @@ all the table specific features." (while (and (re-search-forward border3 (point-max) t) (not (and (input-pending-p) table-abort-recognition-when-input-pending))) - (message "Recognizing tables...(%d%%)" (/ (* 100 (match-beginning 0)) (- (point-max) (point-min)))) + (message "Recognizing tables...(%d%%)" + (floor (* 100.0 (match-beginning 0)) + (- (point-max) (point-min)))) (let ((beg (match-beginning 0)) end) (if (re-search-forward non-border (point-max) t) |