aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/character.c')
-rw-r--r--src/character.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/character.c b/src/character.c
index d0b18367a83..ae153a579d6 100644
--- a/src/character.c
+++ b/src/character.c
@@ -250,7 +250,7 @@ char_width (int c, struct Lisp_Char_Table *dp)
250 if (c >= 0) 250 if (c >= 0)
251 { 251 {
252 int w = CHARACTER_WIDTH (c); 252 int w = CHARACTER_WIDTH (c);
253 if (INT_ADD_WRAPV (width, w, &width)) 253 if (ckd_add (&width, width, w))
254 string_overflow (); 254 string_overflow ();
255 } 255 }
256 } 256 }
@@ -301,7 +301,7 @@ c_string_width (const unsigned char *str, ptrdiff_t len, int precision,
301 *nbytes = i_byte; 301 *nbytes = i_byte;
302 return width; 302 return width;
303 } 303 }
304 if (INT_ADD_WRAPV (thiswidth, width, &width)) 304 if (ckd_add (&width, width, thiswidth))
305 string_overflow (); 305 string_overflow ();
306 i++; 306 i++;
307 i_byte += bytes; 307 i_byte += bytes;
@@ -441,7 +441,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t from, ptrdiff_t to,
441 *nbytes = i_byte - from_byte; 441 *nbytes = i_byte - from_byte;
442 return width; 442 return width;
443 } 443 }
444 if (INT_ADD_WRAPV (thiswidth, width, &width)) 444 if (ckd_add (&width, width, thiswidth))
445 string_overflow (); 445 string_overflow ();
446 i += chars; 446 i += chars;
447 i_byte += bytes; 447 i_byte += bytes;
@@ -664,7 +664,7 @@ count_size_as_multibyte (const unsigned char *str, ptrdiff_t len)
664 for (ptrdiff_t i = 0; i < len; i++) 664 for (ptrdiff_t i = 0; i < len; i++)
665 nonascii += str[i] >> 7; 665 nonascii += str[i] >> 7;
666 ptrdiff_t bytes; 666 ptrdiff_t bytes;
667 if (INT_ADD_WRAPV (len, nonascii, &bytes)) 667 if (ckd_add (&bytes, len, nonascii))
668 string_overflow (); 668 string_overflow ();
669 return bytes; 669 return bytes;
670} 670}
@@ -780,21 +780,21 @@ string_escape_byte8 (Lisp_Object string)
780 if (byte8_count == 0) 780 if (byte8_count == 0)
781 return string; 781 return string;
782 782
783 if (INT_MULTIPLY_WRAPV (byte8_count, 3, &thrice_byte8_count)) 783 if (ckd_mul (&thrice_byte8_count, byte8_count, 3))
784 string_overflow (); 784 string_overflow ();
785 785
786 if (multibyte) 786 if (multibyte)
787 { 787 {
788 /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ 788 /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */
789 if (INT_ADD_WRAPV (nchars, thrice_byte8_count, &uninit_nchars) 789 if (ckd_add (&uninit_nchars, nchars, thrice_byte8_count)
790 || INT_ADD_WRAPV (nbytes, 2 * byte8_count, &uninit_nbytes)) 790 || ckd_add (&uninit_nbytes, nbytes, 2 * byte8_count))
791 string_overflow (); 791 string_overflow ();
792 val = make_uninit_multibyte_string (uninit_nchars, uninit_nbytes); 792 val = make_uninit_multibyte_string (uninit_nchars, uninit_nbytes);
793 } 793 }
794 else 794 else
795 { 795 {
796 /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ 796 /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */
797 if (INT_ADD_WRAPV (thrice_byte8_count, nbytes, &uninit_nbytes)) 797 if (ckd_add (&uninit_nbytes, thrice_byte8_count, nbytes))
798 string_overflow (); 798 string_overflow ();
799 val = make_uninit_string (uninit_nbytes); 799 val = make_uninit_string (uninit_nbytes);
800 } 800 }