Lines Matching refs:ip

140 buf_write_bytes(struct bw_info *ip)  in buf_write_bytes()  argument
143 char_u *buf = ip->bw_buf; // data to write in buf_write_bytes()
144 int len = ip->bw_len; // length of data in buf_write_bytes()
145 int flags = ip->bw_flags; // extra flags in buf_write_bytes()
157 p = ip->bw_conv_buf; // translate to buffer in buf_write_bytes()
160 buf = ip->bw_conv_buf; in buf_write_bytes()
161 len = (int)(p - ip->bw_conv_buf); in buf_write_bytes()
170 p = ip->bw_conv_buf; // translate to buffer in buf_write_bytes()
173 if (wlen == 0 && ip->bw_restlen != 0) in buf_write_bytes()
180 l = CONV_RESTLEN - ip->bw_restlen; in buf_write_bytes()
183 mch_memmove(ip->bw_rest + ip->bw_restlen, buf, (size_t)l); in buf_write_bytes()
184 n = utf_ptr2len_len(ip->bw_rest, ip->bw_restlen + l); in buf_write_bytes()
185 if (n > ip->bw_restlen + len) in buf_write_bytes()
190 if (ip->bw_restlen + len > CONV_RESTLEN) in buf_write_bytes()
192 ip->bw_restlen += len; in buf_write_bytes()
196 c = utf_ptr2char(ip->bw_rest); in buf_write_bytes()
198 c = ip->bw_rest[0]; in buf_write_bytes()
199 if (n >= ip->bw_restlen) in buf_write_bytes()
201 n -= ip->bw_restlen; in buf_write_bytes()
202 ip->bw_restlen = 0; in buf_write_bytes()
206 ip->bw_restlen -= n; in buf_write_bytes()
207 mch_memmove(ip->bw_rest, ip->bw_rest + n, in buf_write_bytes()
208 (size_t)ip->bw_restlen); in buf_write_bytes()
222 ip->bw_restlen = len - wlen; in buf_write_bytes()
223 mch_memmove(ip->bw_rest, buf + wlen, in buf_write_bytes()
224 (size_t)ip->bw_restlen); in buf_write_bytes()
233 if (ucs2bytes(c, &p, flags) && !ip->bw_conv_error) in buf_write_bytes()
235 ip->bw_conv_error = TRUE; in buf_write_bytes()
236 ip->bw_conv_error_lnum = ip->bw_start_lnum; in buf_write_bytes()
239 ++ip->bw_start_lnum; in buf_write_bytes()
245 buf = ip->bw_conv_buf; in buf_write_bytes()
246 len = (int)(p - ip->bw_conv_buf); in buf_write_bytes()
262 if (ip->bw_restlen > 0) in buf_write_bytes()
267 fromlen = len + ip->bw_restlen; in buf_write_bytes()
268 from = ip->bw_conv_buf + ip->bw_conv_buflen - fromlen; in buf_write_bytes()
269 mch_memmove(from, ip->bw_rest, (size_t)ip->bw_restlen); in buf_write_bytes()
270 mch_memmove(from + ip->bw_restlen, buf, (size_t)len); in buf_write_bytes()
278 to = ip->bw_conv_buf; in buf_write_bytes()
300 ip->bw_conv_error = TRUE; in buf_write_bytes()
303 mch_memmove(ip->bw_rest, from, fromlen); in buf_write_bytes()
304 ip->bw_restlen = (int)fromlen; in buf_write_bytes()
310 ip->bw_restlen = 0; in buf_write_bytes()
323 ip->bw_conv_error = TRUE; in buf_write_bytes()
327 ip->bw_rest[0] = from[fromlen - 1]; in buf_write_bytes()
328 ip->bw_restlen = 1; in buf_write_bytes()
331 (LPCSTR)from, (int)(fromlen - ip->bw_restlen), in buf_write_bytes()
336 ip->bw_conv_error = TRUE; in buf_write_bytes()
342 fromlen = to - ip->bw_conv_buf; in buf_write_bytes()
349 for (from = ip->bw_conv_buf; fromlen > 1; fromlen -= 2) in buf_write_bytes()
354 if (to + 6 >= ip->bw_conv_buf + ip->bw_conv_buflen) in buf_write_bytes()
356 ip->bw_conv_error = TRUE; in buf_write_bytes()
370 (LPCWSTR)ip->bw_conv_buf, (int)fromlen / sizeof(WCHAR), in buf_write_bytes()
371 (LPSTR)to, (int)(ip->bw_conv_buflen - fromlen), 0, in buf_write_bytes()
375 ip->bw_conv_error = TRUE; in buf_write_bytes()
389 if (ip->bw_restlen > 0) in buf_write_bytes()
394 fromlen = len + ip->bw_restlen; in buf_write_bytes()
395 from = ip->bw_conv_buf + ip->bw_conv_buflen - fromlen; in buf_write_bytes()
396 mch_memmove(from, ip->bw_rest, (size_t)ip->bw_restlen); in buf_write_bytes()
397 mch_memmove(from + ip->bw_restlen, buf, (size_t)len); in buf_write_bytes()
406 ip->bw_conv_buf, &len, ip->bw_conv_buflen, in buf_write_bytes()
407 ip->bw_rest, &ip->bw_restlen) == FAIL) in buf_write_bytes()
409 ip->bw_conv_error = TRUE; in buf_write_bytes()
412 buf = ip->bw_conv_buf; in buf_write_bytes()
417 if (ip->bw_iconv_fd != (iconv_t)-1) in buf_write_bytes()
425 if (ip->bw_restlen > 0) in buf_write_bytes()
432 fromlen = len + ip->bw_restlen; in buf_write_bytes()
433 fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen; in buf_write_bytes()
434 mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen); in buf_write_bytes()
435 mch_memmove(fp + ip->bw_restlen, buf, (size_t)len); in buf_write_bytes()
437 tolen = ip->bw_conv_buflen - fromlen; in buf_write_bytes()
443 tolen = ip->bw_conv_buflen; in buf_write_bytes()
445 to = (char *)ip->bw_conv_buf; in buf_write_bytes()
447 if (ip->bw_first) in buf_write_bytes()
452 (void)iconv(ip->bw_iconv_fd, NULL, NULL, &to, &tolen); in buf_write_bytes()
458 to = (char *)ip->bw_conv_buf; in buf_write_bytes()
461 ip->bw_first = FALSE; in buf_write_bytes()
465 if ((iconv(ip->bw_iconv_fd, (void *)&from, &fromlen, &to, &tolen) in buf_write_bytes()
469 ip->bw_conv_error = TRUE; in buf_write_bytes()
475 mch_memmove(ip->bw_rest, (void *)from, fromlen); in buf_write_bytes()
476 ip->bw_restlen = (int)fromlen; in buf_write_bytes()
478 buf = ip->bw_conv_buf; in buf_write_bytes()
479 len = (int)((char_u *)to - ip->bw_conv_buf); in buf_write_bytes()
484 if (ip->bw_fd < 0) in buf_write_bytes()
494 if (crypt_works_inplace(ip->bw_buffer->b_cryptstate)) in buf_write_bytes()
497 crypt_encode_inplace(ip->bw_buffer->b_cryptstate, buf, len, in buf_write_bytes()
498 ip->bw_finish); in buf_write_bytes()
506 ip->bw_finish); in buf_write_bytes()
509 wlen = write_eintr(ip->bw_fd, outbuf, len); in buf_write_bytes()
517 wlen = write_eintr(ip->bw_fd, buf, len); in buf_write_bytes()