diff --git a/fitz_cgo.go b/fitz_cgo.go index 51035ab..10480a4 100644 --- a/fitz_cgo.go +++ b/fitz_cgo.go @@ -135,9 +135,7 @@ func NewFromMemory(b []byte) (f *Document, err error) { C.fz_register_document_handlers(f.ctx) - stream := C.fz_open_memory(f.ctx, (*C.uchar)(&b[0]), C.size_t(len(b))) - f.stream = C.fz_keep_stream(f.ctx, stream) - + f.stream = C.fz_open_memory(f.ctx, (*C.uchar)(&b[0]), C.size_t(len(b))) if f.stream == nil { err = ErrOpenMemory return diff --git a/fitz_nocgo.go b/fitz_nocgo.go index aeb29be..b4bac12 100644 --- a/fitz_nocgo.go +++ b/fitz_nocgo.go @@ -74,9 +74,7 @@ func NewFromMemory(b []byte) (f *Document, err error) { fzRegisterDocumentHandlers(f.ctx) - stream := fzOpenMemory(f.ctx, unsafe.SliceData(b), uint64(len(b))) - f.stream = fzKeepStream(f.ctx, stream) - + f.stream = fzOpenMemory(f.ctx, unsafe.SliceData(b), uint64(len(b))) if f.stream == nil { err = ErrOpenMemory return @@ -533,7 +531,6 @@ var ( fzOpenDocument func(ctx *fzContext, filename string) *fzDocument fzOpenDocumentWithStream func(ctx *fzContext, magic string, stream *fzStream) *fzDocument fzOpenMemory func(ctx *fzContext, data *uint8, len uint64) *fzStream - fzKeepStream func(ctx *fzContext, stm *fzStream) *fzStream fzDropStream func(ctx *fzContext, stm *fzStream) fzRegisterDocumentHandlers func(ctx *fzContext) fzNeedsPassword func(ctx *fzContext, doc *fzDocument) int @@ -591,7 +588,6 @@ func init() { purego.RegisterLibFunc(&fzOpenDocument, libmupdf, "fz_open_document") purego.RegisterLibFunc(&fzOpenDocumentWithStream, libmupdf, "fz_open_document_with_stream") purego.RegisterLibFunc(&fzOpenMemory, libmupdf, "fz_open_memory") - purego.RegisterLibFunc(&fzKeepStream, libmupdf, "fz_keep_stream") purego.RegisterLibFunc(&fzDropStream, libmupdf, "fz_drop_stream") purego.RegisterLibFunc(&fzRegisterDocumentHandlers, libmupdf, "fz_register_document_handlers") purego.RegisterLibFunc(&fzNeedsPassword, libmupdf, "fz_needs_password")