static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes(RECSTREAM *rstrm, char *addr, int len) { size_t current; if (rstrm->nonblock) { if (len > (int)(rstrm->in_boundry - rstrm->in_finger)) return FALSE; memcpy(addr, rstrm->in_finger, (size_t)len); rstrm->in_finger += len; return TRUE; } while (len > 0) { current = (size_t)((long)rstrm->in_boundry - (long)rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = (len < current) ? len : current; memmove(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes(RECSTREAM *rstrm, char *addr, u_int len) { u_int current; if (rstrm->nonblock) { if (len > ((uintptr_t)rstrm->in_boundry - (uintptr_t)rstrm->in_finger)) return FALSE; memcpy(addr, rstrm->in_finger, len); rstrm->in_finger += len; return TRUE; } while (len > 0) { uintptr_t d = ((uintptr_t)rstrm->in_boundry - (uintptr_t)rstrm->in_finger); _DIAGASSERT(__type_fit(u_int, d)); current = (u_int)d; if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = (len < current) ? len : current; memmove(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
static bool_t get_input_bytes(RECSTREAM *rstrm, caddr_t addr, int frag_len, int len) { ptrdiff_t current; while (len > 0) { current = rstrm->in_boundry - rstrm->in_finger; #ifdef DEBUG printf("get_input_bytes: len = %d, frag_len = %d, current %d\n", len, frag_len, current); #endif /* * set_input_bytes doesn't know how large the fragment is, we * need to get the header so just grab a header's size worth */ if (frag_len == 0) frag_len = len; if (current == 0) { if (! fill_input_buf(rstrm, frag_len)) return (FALSE); continue; } current = (len < current) ? len : current; bcopy(rstrm->in_finger, addr, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
static bool_t /* consumes input bytes; knows nothing about records! */ skip_input_bytes(RECSTREAM *rstrm, long cnt) { u_int32_t current; while (cnt > 0) { current = (size_t)((long)rstrm->in_boundry - (long)rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = (u_int32_t)((cnt < current) ? cnt : current); rstrm->in_finger += current; cnt -= current; } return (TRUE); }
/* consumes input bytes; knows nothing about records! */ static bool_t skip_input_bytes(RECSTREAM *rstrm, int32_t cnt) { int current; while (cnt > 0) { current = (intptr_t)rstrm->in_boundry - (intptr_t)rstrm->in_finger; if (current == 0) { if (!fill_input_buf(rstrm, FALSE)) return (FALSE); continue; } current = (cnt < current) ? cnt : current; rstrm->in_finger += current; cnt -= current; } return (TRUE); }
static bool_t /* consumes input bytes; knows nothing about records! */ skip_input_bytes(RECSTREAM *rstrm, int32_t cnt) { ptrdiff_t current; #ifdef DEBUG printf("skip_input_fragment: cnt = %d\n", cnt); #endif while (cnt > 0) { current = rstrm->in_boundry - rstrm->in_finger; if (current == 0) { if (! fill_input_buf(rstrm, cnt)) return (FALSE); continue; } current = (cnt < current) ? cnt : current; rstrm->in_finger += current; cnt -= current; } return (TRUE); }
static bool_t /* consumes input bytes; knows nothing about records! */ skip_input_bytes( register RECSTREAM *rstrm, long cnt) { register int current; while (cnt > 0) { current = (int)(rstrm->in_boundry - rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = (cnt < current) ? (int)cnt : current; rstrm->in_finger += current; cnt -= current; } return (TRUE); }
static bool /* consumes input bytes; knows nothing about records! */ skip_input_bytes(RECSTREAM *rstrm, long cnt) { u_int32_t current; while (cnt > 0) { current = (size_t) (PtrToUlong(rstrm->in_boundry) - PtrToUlong(rstrm->in_finger)); if (current == 0) { if (!fill_input_buf(rstrm)) return (false); continue; } current = (u_int32_t) ((cnt < current) ? cnt : current); rstrm->in_finger += current; cnt -= current; } return (true); }
static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes(RECSTREAM *rstrm, caddr_t addr, int len) { register size_t current; while (len > 0) { current = (size_t)((long)rstrm->in_boundry - (long)rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = ((size_t)len < current) ? (size_t)len : current; memmove(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
static bool /* knows nothing about records! Only about input buffers */ get_input_bytes(RECSTREAM *rstrm, char *addr, int32_t len, int32_t maxreadahead) { int32_t current; while (len > 0) { current = (PtrToUlong(rstrm->in_boundry) - PtrToUlong(rstrm->in_finger)); if (current == 0) { if (! fill_input_buf(rstrm, maxreadahead)) return (FALSE); continue; } current = (len < current) ? len : current; memmove(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes( register RECSTREAM *rstrm, register char* addr, register int len) { register int current; while (len > 0) { current = (int)(rstrm->in_boundry - rstrm->in_finger); if (current == 0) { if (! fill_input_buf(rstrm)) return (FALSE); continue; } current = (len < current) ? len : current; bcopy(rstrm->in_finger, addr, current); rstrm->in_finger += current; addr += current; len -= current; } return (TRUE); }
/* knows nothing about records! Only about input buffers */ static bool_t get_input_bytes(RECSTREAM *rstrm, caddr_t addr, int len, bool_t do_align) { int current; if (rstrm->in_nonblock) { /* * Data should already be in the rstrm buffer, so we just * need to copy it to 'addr'. */ current = (int)(rstrm->in_boundry - rstrm->in_finger); if (len > current) return (FALSE); (void) memcpy(addr, rstrm->in_finger, len); rstrm->in_finger += len; addr += len; return (TRUE); } while (len > 0) { current = (intptr_t)rstrm->in_boundry - (intptr_t)rstrm->in_finger; if (current == 0) { if (!fill_input_buf(rstrm, do_align)) return (FALSE); continue; } current = (len < current) ? len : current; (void) memcpy(addr, rstrm->in_finger, current); rstrm->in_finger += current; addr += current; len -= current; do_align = FALSE; } return (TRUE); }
METHODDEF( void ) skip_input_data( j_decompress_ptr cinfo, long num ) { // int i; my_src_ptr src = (my_src_ptr) cinfo->src; // __named_message( "%d\n", num ); if (num > 0) { while (num > (long) src->pub.bytes_in_buffer) { num -= (long) src->pub.bytes_in_buffer; fill_input_buf(cinfo); /* note we assume that fill_input_buffer will never return FALSE, * so suspension need not be handled. */ } src->pub.next_input_byte += (size_t) num; src->pub.bytes_in_buffer -= (size_t) num; } }
// Check for CTRL-C typed by reading all available characters. // In cooked mode we should get SIGINT, no need to check. void os_breakcheck() { if (curr_tmode == TMODE_RAW && event_poll(0)) fill_input_buf(false); }