comparison src/process.c @ 20433:a43789debf48

(read_process_output): Fix previous change, i.e, if proc_encode_coding_system[p->outfd] is NULL, instead of allocating `struct coding_system' for encoding, just skip setting up coding system for encoding. Set Vlast_coding_system_used after some text is read. (send_process): Set Vlast_coding_system_used after deciding a coding system to be used for encoding.
author Kenichi Handa <handa@m17n.org>
date Tue, 09 Dec 1997 04:12:03 +0000
parents 7351dc9f1c94
children 5f17380c85f1
comparison
equal deleted inserted replaced
20432:987ddd5cb6ee 20433:a43789debf48
2805 2805
2806 /* Don't call setup_coding_system for 2806 /* Don't call setup_coding_system for
2807 proc_decode_coding_system[channel] here. It is done in 2807 proc_decode_coding_system[channel] here. It is done in
2808 detect_coding called via decode_coding above. */ 2808 detect_coding called via decode_coding above. */
2809 2809
2810 /* If coding-system for encoding is not yet decided, we set it 2810 /* If coding-system for encoding is not yet decided, we set
2811 as the same as coding-system for decoding. */ 2811 it as the same as coding-system for decoding.
2812 if (NILP (p->encode_coding_system)) 2812
2813 But, before doing that we must check if
2814 proc_encode_coding_system[p->outfd] surely points to a
2815 valid memory because p->outfd will be changed once EOF is
2816 sent to the process. */
2817 if (NILP (p->encode_coding_system)
2818 && proc_encode_coding_system[p->outfd])
2813 { 2819 {
2814 p->encode_coding_system = coding->symbol; 2820 p->encode_coding_system = coding->symbol;
2815 if (!proc_encode_coding_system[p->outfd])
2816 proc_encode_coding_system[p->outfd]
2817 = ((struct coding_system *)
2818 xmalloc (sizeof (struct coding_system)));
2819 setup_coding_system (coding->symbol, 2821 setup_coding_system (coding->symbol,
2820 proc_encode_coding_system[p->outfd]); 2822 proc_encode_coding_system[p->outfd]);
2821 } 2823 }
2822 } 2824 }
2823 #ifdef VMS 2825 #ifdef VMS
2843 free (chars); 2845 free (chars);
2844 chars = XSTRING (p->decoding_buf)->data; 2846 chars = XSTRING (p->decoding_buf)->data;
2845 chars_in_decoding_buf = 1; 2847 chars_in_decoding_buf = 1;
2846 } 2848 }
2847 #endif 2849 #endif
2850
2851 Vlast_coding_system_used = coding->symbol;
2848 2852
2849 outstream = p->filter; 2853 outstream = p->filter;
2850 if (!NILP (outstream)) 2854 if (!NILP (outstream))
2851 { 2855 {
2852 /* We inhibit quit here instead of just catching it so that 2856 /* We inhibit quit here instead of just catching it so that
3045 error ("Process %s not running", procname); 3049 error ("Process %s not running", procname);
3046 if (XINT (XPROCESS (proc)->outfd) < 0) 3050 if (XINT (XPROCESS (proc)->outfd) < 0)
3047 error ("Output file descriptor of %s is closed", procname); 3051 error ("Output file descriptor of %s is closed", procname);
3048 3052
3049 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 3053 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
3054 Vlast_coding_system_used = coding->symbol;
3055
3050 if (CODING_REQUIRE_ENCODING (coding)) 3056 if (CODING_REQUIRE_ENCODING (coding))
3051 { 3057 {
3052 int require = encoding_buffer_size (coding, len); 3058 int require = encoding_buffer_size (coding, len);
3053 int offset, dummy; 3059 int offset, dummy;
3054 unsigned char *temp_buf = NULL; 3060 unsigned char *temp_buf = NULL;