comparison src/file-coding.c @ 5126:2a462149bd6a ben-lisp-object

merge
author Ben Wing <ben@xemacs.org>
date Wed, 24 Feb 2010 19:04:27 -0600
parents b5df3737028a 9410323e4b0d
children a9c41067dd88
comparison
equal deleted inserted replaced
5125:b5df3737028a 5126:2a462149bd6a
1858 Dynarr_add_many (str->convert_from, 0, readmore); 1858 Dynarr_add_many (str->convert_from, 0, readmore);
1859 read_size = Lstream_read (str->other_end, 1859 read_size = Lstream_read (str->other_end,
1860 Dynarr_atp (str->convert_from, rejected), 1860 Dynarr_atp (str->convert_from, rejected),
1861 readmore); 1861 readmore);
1862 /* Trim size down to how much we actually got */ 1862 /* Trim size down to how much we actually got */
1863 Dynarr_set_length (str->convert_from, rejected + max (0, read_size)); 1863 Dynarr_set_lengthr (str->convert_from, rejected + max (0, read_size));
1864 } 1864 }
1865 1865
1866 if (read_size < 0) /* LSTREAM_ERROR */ 1866 if (read_size < 0) /* LSTREAM_ERROR */
1867 { 1867 {
1868 error_occurred = 1; 1868 error_occurred = 1;
1892 assert (processed <= to_process); 1892 assert (processed <= to_process);
1893 if (processed < to_process) 1893 if (processed < to_process)
1894 memmove (Dynarr_begin (str->convert_from), 1894 memmove (Dynarr_begin (str->convert_from),
1895 Dynarr_atp (str->convert_from, processed), 1895 Dynarr_atp (str->convert_from, processed),
1896 to_process - processed); 1896 to_process - processed);
1897 Dynarr_set_length (str->convert_from, to_process - processed); 1897 Dynarr_set_lengthr (str->convert_from, to_process - processed);
1898 } 1898 }
1899 } 1899 }
1900 1900
1901 if (data - orig_data == 0) 1901 if (data - orig_data == 0)
1902 return error_occurred ? -1 : 0; 1902 return error_occurred ? -1 : 0;
4417 data->stream.next_out = 4417 data->stream.next_out =
4418 Dynarr_atp (dst, Dynarr_length (dst) - reserved); 4418 Dynarr_atp (dst, Dynarr_length (dst) - reserved);
4419 data->stream.avail_out = reserved; 4419 data->stream.avail_out = reserved;
4420 zerr = inflate (&data->stream, Z_NO_FLUSH); 4420 zerr = inflate (&data->stream, Z_NO_FLUSH);
4421 /* Lop off the unused portion */ 4421 /* Lop off the unused portion */
4422 Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); 4422 Dynarr_set_lengthr (dst, Dynarr_length (dst) - data->stream.avail_out);
4423 if (zerr != Z_OK) 4423 if (zerr != Z_OK)
4424 break; 4424 break;
4425 } 4425 }
4426 4426
4427 if (zerr == Z_STREAM_END) 4427 if (zerr == Z_STREAM_END)
4477 data->stream.avail_out = reserved; 4477 data->stream.avail_out = reserved;
4478 zerr = 4478 zerr =
4479 deflate (&data->stream, 4479 deflate (&data->stream,
4480 str->eof ? Z_FINISH : Z_NO_FLUSH); 4480 str->eof ? Z_FINISH : Z_NO_FLUSH);
4481 /* Lop off the unused portion */ 4481 /* Lop off the unused portion */
4482 Dynarr_set_length (dst, Dynarr_length (dst) - data->stream.avail_out); 4482 Dynarr_set_lengthr (dst, Dynarr_length (dst) - data->stream.avail_out);
4483 if (zerr != Z_OK) 4483 if (zerr != Z_OK)
4484 break; 4484 break;
4485 } 4485 }
4486 4486
4487 if ((Bytecount) data->stream.avail_in < n) 4487 if ((Bytecount) data->stream.avail_in < n)