Mercurial > emacs
comparison src/character.c @ 91807:507bcfb4342c
* coding.c (coding_set_destination): Use BEG_BYTE rather than hardcoding 1.
(detect_coding_system):
* lisp.h (detect_coding_system, chars_in_text, multibyte_chars_in_text)
(string_char_to_byte, string_byte_to_char, insert_from_gap):
* insdel.c (insert_from_gap):
* fns.c (string_char_byte_cache_charpos, string_char_byte_cache_bytepos)
(string_char_to_byte, string_byte_to_char, string_make_multibyte)
(string_to_multibyte):
* character.c (chars_in_text, multibyte_chars_in_text):
* fileio.c (Finsert_file_contents): Use EMACS_INT for buffer positions.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 12 Feb 2008 21:35:15 +0000 |
parents | 541da5d81b14 |
children | 95fab6416567 |
comparison
equal
deleted
inserted
replaced
91806:6c0a55931b1c | 91807:507bcfb4342c |
---|---|
566 This works by looking at the contents and checking for multibyte | 566 This works by looking at the contents and checking for multibyte |
567 sequences while assuming that there's no invalid sequence. | 567 sequences while assuming that there's no invalid sequence. |
568 However, if the current buffer has enable-multibyte-characters = | 568 However, if the current buffer has enable-multibyte-characters = |
569 nil, we treat each byte as a character. */ | 569 nil, we treat each byte as a character. */ |
570 | 570 |
571 int | 571 EMACS_INT |
572 chars_in_text (ptr, nbytes) | 572 chars_in_text (ptr, nbytes) |
573 const unsigned char *ptr; | 573 const unsigned char *ptr; |
574 int nbytes; | 574 EMACS_INT nbytes; |
575 { | 575 { |
576 /* current_buffer is null at early stages of Emacs initialization. */ | 576 /* current_buffer is null at early stages of Emacs initialization. */ |
577 if (current_buffer == 0 | 577 if (current_buffer == 0 |
578 || NILP (current_buffer->enable_multibyte_characters)) | 578 || NILP (current_buffer->enable_multibyte_characters)) |
579 return nbytes; | 579 return nbytes; |
584 /* Return the number of characters in the NBYTES bytes at PTR. | 584 /* Return the number of characters in the NBYTES bytes at PTR. |
585 This works by looking at the contents and checking for multibyte | 585 This works by looking at the contents and checking for multibyte |
586 sequences while assuming that there's no invalid sequence. It | 586 sequences while assuming that there's no invalid sequence. It |
587 ignores enable-multibyte-characters. */ | 587 ignores enable-multibyte-characters. */ |
588 | 588 |
589 int | 589 EMACS_INT |
590 multibyte_chars_in_text (ptr, nbytes) | 590 multibyte_chars_in_text (ptr, nbytes) |
591 const unsigned char *ptr; | 591 const unsigned char *ptr; |
592 int nbytes; | 592 EMACS_INT nbytes; |
593 { | 593 { |
594 const unsigned char *endp = ptr + nbytes; | 594 const unsigned char *endp = ptr + nbytes; |
595 int chars = 0; | 595 int chars = 0; |
596 | 596 |
597 while (ptr < endp) | 597 while (ptr < endp) |