*/
/*
-=item io_new_bufchain(ctx)
+=item im_io_new_bufchain(ctx)
+X<im_io_new_bufchain API>X<i_io_new_bufchain API>
=order 10
=category I/O Layers
-returns a new io_glue object that has the 'empty' source and but can
+Returns a new io_glue object that has the 'empty' source and but can
be written to and read from later (like a pseudo file).
+Also callable as C<io_new_bufchain()>.
+
=cut
*/
}
/*
-=item io_new_buffer(data, length)
+=item im_io_new_buffer(ctx, data, length)
+X<im_io_new_buffer API>X<io_new_buffer API>
=order 10
=category I/O Layers
Returns a new io_glue object that has the source defined as reading
from specified buffer. Note that the buffer is not copied.
+ ctx - an Imager context object
data - buffer to read from
length - length of buffer
+Also callable as C<io_new_buffer(data, length>.
+
=cut
*/
/*
-=item io_new_fd(fd)
+=item im_io_new_fd(ctx, file)
+X<io_new_fd API>X<im_io_new_fd API>
=order 10
=category I/O Layers
-returns a new io_glue object that has the source defined as reading
+Returns a new io_glue object that has the source defined as reading
from specified file descriptor. Note that the the interface to receiving
data from the io_glue callbacks hasn't been done yet.
- fd - file descriptor to read/write from
+ ctx - and Imager context object
+ file - file descriptor to read/write from
+
+Also callable as C<io_new_fd(file)>.
=cut
*/
}
/*
-=item io_new_cb(p, read_cb, write_cb, seek_cb, close_cb, destroy_cb)
+=item im_io_new_cb(ctx, p, read_cb, write_cb, seek_cb, close_cb, destroy_cb)
+X<im_io_new_cb API>X<io_new_cb API>
=category I/O Layers
=order 10
=back
+Also callable as C<io_new_cb(p, readcb, writecb, seekcb, closecb,
+destroycb)>.
+
=cut
*/
/*
=item io_slurp(ig, c)
+X<io_slurp API>
=category I/O Layers
Takes the source that the io_glue is bound to and allocates space for
size_t
io_slurp(io_glue *ig, unsigned char **c) {
ssize_t rc;
- off_t orgoff;
io_ex_bchain *ieb;
unsigned char *cc;
io_type inn = ig->type;
ieb = ig->exdata;
cc = *c = mymalloc( ieb->length );
- orgoff = ieb->gpos;
-
bufchain_seek(ig, 0, SEEK_SET);
rc = bufchain_read(ig, cc, ieb->length);
/*
=item io_glue_destroy(ig)
+X<io_glue_destroy API>
=category I/O Layers
=order 90
=synopsis io_glue_destroy(ig);
work = ig->buffer;
}
+ /* there should always be buffer space the first time around, but
+ avoid a compiler warning here */
+ rc = -1;
while (work < buf_end && (rc = i_io_raw_read(ig, work, buf_end - work)) > 0) {
work += rc;
good = 1;
}
-/* realseek_seek(ig, offset, whence)
+/*
+=item realseek_seek(ig, offset, whence)
Implements seeking for a source that is seekable, the purpose of having this is to be able to
have an offset into a file that is different from what the underlying library thinks.
}
-/* buffer_seek(ig, offset, whence)
+/*
+=item buffer_seek(ig, offset, whence)
Implements seeking for a buffer source.
}
-/* bufchain_seek(ig, offset, whence)
+/*
+=item bufchain_seek(ig, offset, whence)
Implements seeking for a source that is seekable, the purpose of having this is to be able to
have an offset into a file that is different from what the underlying library thinks.