Sigrid Solveig Haflínudóttirconvert image streams to plan 9 Memimage14a77355 years agoHistory
62 lines · 1007 B · C
RawDownload
#include <u.h>#include <libc.h>#include "pdf.h" /* 7.4.7 JBIG2Decode filter */ static u8int bh[] = {	/* id string  */ 0x97, 0x4a, 0x42, 0x32, 0x0d, 0x0a, 0x1a, 0x0a,	/* sequential */ 0x01,	/* one page   */ 0x00, 0x00, 0x00, 0x01,}; static void *memimage(Buffer *b){	char *argv[] = {"jbig2", nil};	return buf2memimage(b, "/bin/jbig2", argv);} static intflreadall(void *aux, Buffer *bi, Buffer *bo){	Stream *s; 	s = aux;	bufput(bo, bh, sizeof(bh));	if(s != nil)		bufput(bo, s->buf.b, s->buf.sz);	bufput(bo, bi->b, bi->sz);	bi->off = bi->sz;	bo->memimage = memimage; 	return 0;} static intflopen(Filter *f, Object *o){	Object *parms, *so;	Stream *s; 	parms = dictget(o, "DecodeParms");	s = nil;	if((so = dictget(parms, "JBIG2Globals")) != &null && (s = Sopen(so)) == nil)		return -1;	f->aux = s; 	return 0;} static voidflclose(Filter *f){	Sclose(f->aux);} Filter filterJBIG2 = {	.name = "JBIG2Decode",	.readall = flreadall,	.open = flopen,	.close = flclose,};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t