MCPcopy Index your code
hub / github.com/hoothin/UserScripts / read_buf

Function read_buf

Picviewer CE+/Picviewer CE+.user.js:6330–6352  ·  view source on GitHub ↗
(strm, buf, start, size)

Source from the content-addressed store, hash-verified

6328 * (See also flush_pending()).
6329 */
6330function read_buf(strm, buf, start, size) {
6331 var len = strm.avail_in;
6332
6333 if (len > size) { len = size; }
6334 if (len === 0) { return 0; }
6335
6336 strm.avail_in -= len;
6337
6338 // zmemcpy(buf, strm->next_in, len);
6339 utils.arraySet(buf, strm.input, strm.next_in, len, start);
6340 if (strm.state.wrap === 1) {
6341 strm.adler = adler32(strm.adler, buf, len, start);
6342 }
6343
6344 else if (strm.state.wrap === 2) {
6345 strm.adler = crc32(strm.adler, buf, len, start);
6346 }
6347
6348 strm.next_in += len;
6349 strm.total_in += len;
6350
6351 return len;
6352}
6353
6354
6355/* ===========================================================================

Callers 1

fill_windowFunction · 0.70

Calls 2

adler32Function · 0.70
crc32Function · 0.70

Tested by

no test coverage detected