diff options
| author | Paul Eggert | 2015-07-31 10:12:37 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-07-31 10:13:38 -0700 |
| commit | eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2 (patch) | |
| tree | f2debb3a46b3e18217d8cd1736fc7d8add90e3bd /lisp/textmodes | |
| parent | 0f23e95b29a7a0a07bba0e9bc796cd7b7bc7232a (diff) | |
| download | emacs-eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2.tar.gz emacs-eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2.zip | |
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 | |||
| 2099 | (let* ((size (- (point-max) (point-min))) | 2099 | (let* ((size (- (point-max) (point-min))) |
| 2100 | (perc (if (= size 0) | 2100 | (perc (if (= size 0) |
| 2101 | 100 | 2101 | 100 |
| 2102 | (/ (* 100 (- (point) (point-min))) size)))) | 2102 | (floor (* 100.0 (- (point) (point-min))) size)))) |
| 2103 | (when (>= perc (+ bibtex-progress-lastperc | 2103 | (when (>= perc (+ bibtex-progress-lastperc |
| 2104 | bibtex-progress-interval)) | 2104 | bibtex-progress-interval)) |
| 2105 | (setq bibtex-progress-lastperc perc) | 2105 | (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')." | |||
| 1350 | (if (and flyspell-issue-message-flag (= count 100)) | 1350 | (if (and flyspell-issue-message-flag (= count 100)) |
| 1351 | (progn | 1351 | (progn |
| 1352 | (message "Spell Checking...%d%%" | 1352 | (message "Spell Checking...%d%%" |
| 1353 | (* 100 (/ (float (- (point) beg)) (- end beg)))) | 1353 | (floor (* 100.0 (- (point) beg)) (- end beg))) |
| 1354 | (setq count 0)) | 1354 | (setq count 0)) |
| 1355 | (setq count (+ 1 count))) | 1355 | (setq count (+ 1 count))) |
| 1356 | (flyspell-word) | 1356 | (flyspell-word) |
| @@ -1403,7 +1403,7 @@ The buffer to mark them in is `flyspell-large-region-buffer'." | |||
| 1403 | ;; be unnecessary too. -- rms. | 1403 | ;; be unnecessary too. -- rms. |
| 1404 | (if flyspell-issue-message-flag | 1404 | (if flyspell-issue-message-flag |
| 1405 | (message "Spell Checking...%d%% [%s]" | 1405 | (message "Spell Checking...%d%% [%s]" |
| 1406 | (* 100 (/ (float (point)) (point-max))) | 1406 | (floor (* 100.0 (point)) (point-max)) |
| 1407 | word)) | 1407 | word)) |
| 1408 | (with-current-buffer flyspell-large-region-buffer | 1408 | (with-current-buffer flyspell-large-region-buffer |
| 1409 | (goto-char buffer-scan-pos) | 1409 | (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." | |||
| 1893 | (while (and (re-search-forward border3 (point-max) t) | 1893 | (while (and (re-search-forward border3 (point-max) t) |
| 1894 | (not (and (input-pending-p) | 1894 | (not (and (input-pending-p) |
| 1895 | table-abort-recognition-when-input-pending))) | 1895 | table-abort-recognition-when-input-pending))) |
| 1896 | (message "Recognizing tables...(%d%%)" (/ (* 100 (match-beginning 0)) (- (point-max) (point-min)))) | 1896 | (message "Recognizing tables...(%d%%)" |
| 1897 | (floor (* 100.0 (match-beginning 0)) | ||
| 1898 | (- (point-max) (point-min)))) | ||
| 1897 | (let ((beg (match-beginning 0)) | 1899 | (let ((beg (match-beginning 0)) |
| 1898 | end) | 1900 | end) |
| 1899 | (if (re-search-forward non-border (point-max) t) | 1901 | (if (re-search-forward non-border (point-max) t) |