MCPcopy Create free account
hub / github.com/DentonW/DevIL / iJp2WriteStream

Function iJp2WriteStream

DevIL/src-IL/src/il_jp2.cpp:502–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500
501
502jas_stream_t *iJp2WriteStream()
503{
504 jas_stream_t *stream;
505 jas_stream_memobj_t *obj;
506
507 if (!(stream = jas_stream_create())) {
508 return 0;
509 }
510
511 /* A stream associated with a memory buffer is always opened
512 for both reading and writing in binary mode. */
513 stream->openmode_ = JAS_STREAM_WRITE | JAS_STREAM_BINARY;
514
515 /* We use buffering whether it is from memory or a file. */
516 jas_stream_initbuf(stream, JAS_STREAM_FULLBUF);
517
518 /* Select the operations for a memory stream. */
519 stream->ops_ = &jas_stream_devilops;
520
521 /* Allocate memory for the underlying memory stream object. */
522 if (!(obj = (jas_stream_memobj_t*)jas_malloc(sizeof(jas_stream_memobj_t)))) {
523 jas_stream_destroy(stream);
524 return 0;
525 }
526 stream->obj_ = (void *) obj;
527
528 /* Initialize a few important members of the memory stream object. */
529 obj->myalloc_ = 0;
530 obj->buf_ = 0;
531
532 return stream;
533}
534
535
536

Callers 1

iSaveJp2InternalFunction · 0.85

Calls 3

jas_stream_createFunction · 0.85
jas_stream_initbufFunction · 0.85
jas_stream_destroyFunction · 0.85

Tested by

no test coverage detected