summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/cmd/jpg/gif.c2
-rw-r--r--sys/src/cmd/jpg/imagefile.h2
-rw-r--r--sys/src/cmd/jpg/readgif.c10
3 files changed, 8 insertions, 6 deletions
diff --git a/sys/src/cmd/jpg/gif.c b/sys/src/cmd/jpg/gif.c
index 228fb2637..54eaf3054 100644
--- a/sys/src/cmd/jpg/gif.c
+++ b/sys/src/cmd/jpg/gif.c
@@ -288,7 +288,7 @@ show(int fd, char *name)
char buf[32];
err = nil;
- images = readgif(fd, CRGB);
+ images = readgif(fd, CRGB, dflag);
if(images == nil){
fprint(2, "gif: decode %s failed: %r\n", name);
return "decode";
diff --git a/sys/src/cmd/jpg/imagefile.h b/sys/src/cmd/jpg/imagefile.h
index 13d94a5c3..5c808b685 100644
--- a/sys/src/cmd/jpg/imagefile.h
+++ b/sys/src/cmd/jpg/imagefile.h
@@ -55,7 +55,7 @@ Rawimage** readpng(int, int);
Rawimage** Breadpng(Biobuf*, int);
Rawimage** readtif(int, int);
Rawimage** Breadtif(Biobuf*, int);
-Rawimage** readgif(int, int);
+Rawimage** readgif(int, int, int);
Rawimage** readpixmap(int, int);
Rawimage* torgbv(Rawimage*, int);
Rawimage* totruecolor(Rawimage*, int);
diff --git a/sys/src/cmd/jpg/readgif.c b/sys/src/cmd/jpg/readgif.c
index cac585325..02ac7712c 100644
--- a/sys/src/cmd/jpg/readgif.c
+++ b/sys/src/cmd/jpg/readgif.c
@@ -39,7 +39,7 @@ static char readerr[] = "ReadGIF: read error: %r";
static char extreaderr[] = "ReadGIF: can't read extension: %r";
static char memerr[] = "ReadGIF: malloc failed: %r";
-static Rawimage** readarray(Header*);
+static Rawimage** readarray(Header*, int);
static Rawimage* readone(Header*);
static void readheader(Header*);
static void skipextension(Header*);
@@ -100,7 +100,7 @@ giferror(Header *h, char *fmt, ...)
Rawimage**
-readgif(int fd, int colorspace)
+readgif(int fd, int colorspace, int justone)
{
Rawimage **a;
Biobuf b;
@@ -122,7 +122,7 @@ readgif(int fd, int colorspace)
if(setjmp(h->errlab))
a = nil;
else
- a = readarray(h);
+ a = readarray(h, justone);
giffreeall(h, 0);
free(h);
return a;
@@ -144,7 +144,7 @@ inittbl(Header *h)
static
Rawimage**
-readarray(Header *h)
+readarray(Header *h, int justone)
{
Entry *tbl;
Rawimage *new, **array;
@@ -202,6 +202,8 @@ readarray(Header *h)
array[nimages] = nil;
h->array = array;
h->new = nil;
+ if(justone)
+ goto Return;
break;
case 0x3B: /* Trailer */