Lines Matching refs:size
94 /* first element is the list size */
193 /* first element is the list size */
377 SANE_Status eds_ring_init(ring_buffer *ring, SANE_Int size)
379 ring->ring = realloc(ring->ring, size);
384 ring->size = size;
386 ring->end = ring->ring + size;
392 SANE_Status eds_ring_write(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
396 if (size > (ring->size - ring->fill)) {
397 DBG(1, "ring buffer full, requested: %d, available: %d\n", size, ring->size - ring->fill);
402 if (size < tail) {
404 memcpy(ring->wp, buf, size);
406 ring->wp += size;
407 ring->fill += size;
412 size -= tail;
415 memcpy(ring->wp, buf + tail, size);
417 ring->wp += size;
418 ring->fill += (tail + size);
424 SANE_Int eds_ring_read(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
431 if (size > ring->fill) {
433 size = ring->fill;
437 if (size < tail) {
439 memcpy(buf, ring->rp, size);
441 ring->rp += size;
442 ring->fill -= size;
444 return size;
449 size -= tail;
452 memcpy(buf + tail, ring->rp, size);
454 ring->rp += size;
455 ring->fill -= (size + tail);
457 return size + tail;
461 SANE_Int eds_ring_skip(ring_buffer *ring, SANE_Int size)
465 if (size > ring->fill)
466 size = ring->fill;
469 if (size < tail) {
470 ring->rp += size;
473 ring->rp = ring->ring + (size - tail);
476 ring->fill -= size;
478 return size;