comparison src/process.c @ 52093:25ad7be098ba

(read_process_output): Return the actually read bytes instead of the result of decoding.
author Kenichi Handa <handa@m17n.org>
date Thu, 31 Jul 2003 01:24:27 +0000
parents 745eaece4a11
children 695cf19ef79e
comparison
equal deleted inserted replaced
52092:ef0c4b13c02b 52093:25ad7be098ba
4569 /* Adjust the multibyteness of TEXT to that of the filter. */ 4569 /* Adjust the multibyteness of TEXT to that of the filter. */
4570 if (NILP (p->filter_multibyte) != ! STRING_MULTIBYTE (text)) 4570 if (NILP (p->filter_multibyte) != ! STRING_MULTIBYTE (text))
4571 text = (STRING_MULTIBYTE (text) 4571 text = (STRING_MULTIBYTE (text)
4572 ? Fstring_as_unibyte (text) 4572 ? Fstring_as_unibyte (text)
4573 : Fstring_to_multibyte (text)); 4573 : Fstring_to_multibyte (text));
4574 nbytes = SBYTES (text); 4574 if (SBYTES (text) > 0)
4575 nchars = SCHARS (text);
4576 if (nbytes > 0)
4577 internal_condition_case_1 (read_process_output_call, 4575 internal_condition_case_1 (read_process_output_call,
4578 Fcons (outstream, 4576 Fcons (outstream,
4579 Fcons (proc, Fcons (text, Qnil))), 4577 Fcons (proc, Fcons (text, Qnil))),
4580 !NILP (Vdebug_on_error) ? Qnil : Qerror, 4578 !NILP (Vdebug_on_error) ? Qnil : Qerror,
4581 read_process_output_error_handler); 4579 read_process_output_error_handler);
4605 4603
4606 #ifdef VMS 4604 #ifdef VMS
4607 start_vms_process_read (vs); 4605 start_vms_process_read (vs);
4608 #endif 4606 #endif
4609 unbind_to (count, Qnil); 4607 unbind_to (count, Qnil);
4610 return nchars; 4608 return nbytes;
4611 } 4609 }
4612 4610
4613 /* If no filter, write into buffer if it isn't dead. */ 4611 /* If no filter, write into buffer if it isn't dead. */
4614 if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) 4612 if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name))
4615 { 4613 {
4676 if (NILP (current_buffer->enable_multibyte_characters) 4674 if (NILP (current_buffer->enable_multibyte_characters)
4677 != ! STRING_MULTIBYTE (text)) 4675 != ! STRING_MULTIBYTE (text))
4678 text = (STRING_MULTIBYTE (text) 4676 text = (STRING_MULTIBYTE (text)
4679 ? Fstring_as_unibyte (text) 4677 ? Fstring_as_unibyte (text)
4680 : Fstring_to_multibyte (text)); 4678 : Fstring_to_multibyte (text));
4681 nbytes = SBYTES (text);
4682 nchars = SCHARS (text);
4683 /* Insert before markers in case we are inserting where 4679 /* Insert before markers in case we are inserting where
4684 the buffer's mark is, and the user's next command is Meta-y. */ 4680 the buffer's mark is, and the user's next command is Meta-y. */
4685 insert_from_string_before_markers (text, 0, 0, nchars, nbytes, 0); 4681 insert_from_string_before_markers (text, 0, 0,
4682 SCHARS (text), SBYTES (text), 0);
4686 4683
4687 /* Make sure the process marker's position is valid when the 4684 /* Make sure the process marker's position is valid when the
4688 process buffer is changed in the signal_after_change above. 4685 process buffer is changed in the signal_after_change above.
4689 W3 is known to do that. */ 4686 W3 is known to do that. */
4690 if (BUFFERP (p->buffer) 4687 if (BUFFERP (p->buffer)