diff options
| author | Kenichi Handa | 2004-04-29 00:09:16 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-04-29 00:09:16 +0000 |
| commit | c185d7442189c36679054b8cbf67ec9d82a3d2bc (patch) | |
| tree | f3c2c851b2ff2876eb395ad45a7de28a86761ec4 /src | |
| parent | 0941d27e5ac10f14f3682f295faac5257790db7b (diff) | |
| download | emacs-c185d7442189c36679054b8cbf67ec9d82a3d2bc.tar.gz emacs-c185d7442189c36679054b8cbf67ec9d82a3d2bc.zip | |
(WRITE_BUF_SIZE): This macro deleted.
(e_write): Fix previous change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 82 |
1 files changed, 38 insertions, 44 deletions
diff --git a/src/fileio.c b/src/fileio.c index d20e3eecf89..ad8bb93284f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5333,9 +5333,6 @@ a_write (desc, string, pos, nchars, annot, coding) | |||
| 5333 | return 0; | 5333 | return 0; |
| 5334 | } | 5334 | } |
| 5335 | 5335 | ||
| 5336 | #ifndef WRITE_BUF_SIZE | ||
| 5337 | #define WRITE_BUF_SIZE (16 * 1024) | ||
| 5338 | #endif | ||
| 5339 | 5336 | ||
| 5340 | /* Write text in the range START and END into descriptor DESC, | 5337 | /* Write text in the range START and END into descriptor DESC, |
| 5341 | encoding them with coding system CODING. If STRING is nil, START | 5338 | encoding them with coding system CODING. If STRING is nil, START |
| @@ -5349,8 +5346,6 @@ e_write (desc, string, start, end, coding) | |||
| 5349 | int start, end; | 5346 | int start, end; |
| 5350 | struct coding_system *coding; | 5347 | struct coding_system *coding; |
| 5351 | { | 5348 | { |
| 5352 | int return_val = 0; | ||
| 5353 | |||
| 5354 | if (STRINGP (string)) | 5349 | if (STRINGP (string)) |
| 5355 | { | 5350 | { |
| 5356 | start = 0; | 5351 | start = 0; |
| @@ -5359,56 +5354,55 @@ e_write (desc, string, start, end, coding) | |||
| 5359 | 5354 | ||
| 5360 | /* We used to have a code for handling selective display here. But, | 5355 | /* We used to have a code for handling selective display here. But, |
| 5361 | now it is handled within encode_coding. */ | 5356 | now it is handled within encode_coding. */ |
| 5362 | do | 5357 | if (STRINGP (string)) |
| 5363 | { | 5358 | { |
| 5364 | if (STRINGP (string)) | 5359 | coding->src_multibyte = SCHARS (string) < SBYTES (string); |
| 5360 | if (CODING_REQUIRE_ENCODING (coding)) | ||
| 5365 | { | 5361 | { |
| 5366 | coding->src_multibyte = SCHARS (string) < SBYTES (string); | 5362 | encode_coding_object (coding, string, |
| 5367 | if (CODING_REQUIRE_ENCODING (coding)) | 5363 | start, string_char_to_byte (string, start), |
| 5368 | encode_coding_object (coding, string, | 5364 | end, string_char_to_byte (string, end), Qt); |
| 5369 | start, string_char_to_byte (string, start), | ||
| 5370 | end, string_char_to_byte (string, end), Qt); | ||
| 5371 | else | ||
| 5372 | coding->dst_object = string, coding->produced = SBYTES (string); | ||
| 5373 | } | 5365 | } |
| 5374 | else | 5366 | else |
| 5375 | { | 5367 | { |
| 5376 | int start_byte = CHAR_TO_BYTE (start); | 5368 | coding->dst_object = string; |
| 5377 | int end_byte = CHAR_TO_BYTE (end); | 5369 | coding->produced = SBYTES (string); |
| 5378 | |||
| 5379 | coding->src_multibyte = (end - start) < (end_byte - start_byte); | ||
| 5380 | if (CODING_REQUIRE_ENCODING (coding)) | ||
| 5381 | encode_coding_object (coding, Fcurrent_buffer (), | ||
| 5382 | start, CHAR_TO_BYTE (start), | ||
| 5383 | end, CHAR_TO_BYTE (end), Qt); | ||
| 5384 | else | ||
| 5385 | { | ||
| 5386 | coding->dst_object = Qnil; | ||
| 5387 | coding->produced = end - start; | ||
| 5388 | coding->dst_pos_byte = start_byte; | ||
| 5389 | } | ||
| 5390 | } | 5370 | } |
| 5371 | } | ||
| 5372 | else | ||
| 5373 | { | ||
| 5374 | int start_byte = CHAR_TO_BYTE (start); | ||
| 5375 | int end_byte = CHAR_TO_BYTE (end); | ||
| 5391 | 5376 | ||
| 5392 | if (coding->produced > 0) | 5377 | coding->src_multibyte = (end - start) < (end_byte - start_byte); |
| 5378 | if (CODING_REQUIRE_ENCODING (coding)) | ||
| 5393 | { | 5379 | { |
| 5394 | coding->produced -= | 5380 | encode_coding_object (coding, Fcurrent_buffer (), |
| 5395 | emacs_write (desc, | 5381 | start, CHAR_TO_BYTE (start), |
| 5396 | STRINGP (coding->dst_object) | 5382 | end, CHAR_TO_BYTE (end), Qt); |
| 5397 | ? SDATA (coding->dst_object) | 5383 | } |
| 5398 | : BYTE_POS_ADDR (coding->dst_pos_byte), | 5384 | else |
| 5399 | coding->produced); | 5385 | { |
| 5400 | 5386 | coding->dst_object = Qnil; | |
| 5401 | if (coding->produced) | 5387 | coding->produced = end - start; |
| 5402 | { | 5388 | coding->dst_pos_byte = start_byte; |
| 5403 | return_val = -1; | ||
| 5404 | break; | ||
| 5405 | } | ||
| 5406 | } | 5389 | } |
| 5407 | start += coding->consumed_char; | ||
| 5408 | } | 5390 | } |
| 5409 | while (start < end); | ||
| 5410 | 5391 | ||
| 5411 | return return_val; | 5392 | if (coding->produced > 0) |
| 5393 | { | ||
| 5394 | coding->produced -= | ||
| 5395 | emacs_write (desc, | ||
| 5396 | STRINGP (coding->dst_object) | ||
| 5397 | ? SDATA (coding->dst_object) | ||
| 5398 | : BYTE_POS_ADDR (coding->dst_pos_byte), | ||
| 5399 | coding->produced); | ||
| 5400 | |||
| 5401 | if (coding->produced) | ||
| 5402 | return -1; | ||
| 5403 | } | ||
| 5404 | |||
| 5405 | return 0; | ||
| 5412 | } | 5406 | } |
| 5413 | 5407 | ||
| 5414 | DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, | 5408 | DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, |