| 2295 | } |
| 2296 | |
| 2297 | void write_vstring(int f, const char *str, int len) |
| 2298 | { |
| 2299 | uchar lenbuf[3], *lb = lenbuf; |
| 2300 | |
| 2301 | if (len > 0x7F) { |
| 2302 | if (len > 0x7FFF) { |
| 2303 | rprintf(FERROR, |
| 2304 | "attempting to send over-long vstring (%d > %d)\n", |
| 2305 | len, 0x7FFF); |
| 2306 | exit_cleanup(RERR_PROTOCOL); |
| 2307 | } |
| 2308 | *lb++ = len / 0x100 + 0x80; |
| 2309 | } |
| 2310 | *lb = len; |
| 2311 | |
| 2312 | write_buf(f, (char*)lenbuf, lb - lenbuf + 1); |
| 2313 | if (len) |
| 2314 | write_buf(f, str, len); |
| 2315 | } |
| 2316 | |
| 2317 | /* Send a file-list index using a byte-reduction method. */ |
| 2318 | void write_ndx(int f, int32 ndx) |
no test coverage detected