aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2010-01-19 19:28:23 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2010-01-19 19:28:23 -0800
commitf7bd697cdf90dd8725b1a7e815750c7192d9e44a (patch)
tree49b746848089f5cc008be47d548688cf1b7a6c4f /src
parentba9dd18ef222e79ac30be5d2251f3e4bc40699fd (diff)
downloadmirror-meh-f7bd697cdf90dd8725b1a7e815750c7192d9e44a.tar.gz
mirror-meh-f7bd697cdf90dd8725b1a7e815750c7192d9e44a.tar.bz2
mirror-meh-f7bd697cdf90dd8725b1a7e815750c7192d9e44a.zip
2 bugs
Diffstat (limited to 'src')
-rw-r--r--src/jpeg.c4
-rw-r--r--src/scale.c4
-rw-r--r--src/xlib.c2
3 files changed, 7 insertions, 3 deletions
diff --git a/src/jpeg.c b/src/jpeg.c
index 90ff880..8ae0b52 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -60,6 +60,10 @@ static struct image *jpeg_open(FILE *f){
void jpeg_prep(struct image *img){
struct jpeg_t *j = (struct jpeg_t *)img;
+ /* We've previously loaded this image, clean that up*/
+ if(img->state & LOADED)
+ jpeg_destroy_decompress(&j->cinfo);
+
jpeg_create_decompress(&j->cinfo);
rewind(j->f);
jpeg_stdio_src(&j->cinfo, j->f);
diff --git a/src/scale.c b/src/scale.c
index eb9e689..bec380c 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -46,8 +46,8 @@ static void superscale(struct image *img, unsigned int width, unsigned int heigh
TDEBUG_START
- unsigned int divx[bytesperline];
- unsigned int divy[bytesperline];
+ unsigned int divx[width];
+ unsigned int divy[height];
memset(divx, 0, sizeof divx);
memset(divy, 0, sizeof divy);
for(x = 0; x < img->bufwidth; x++){
diff --git a/src/xlib.c b/src/xlib.c
index 3adda92..393617d 100644
--- a/src/xlib.c
+++ b/src/xlib.c
@@ -72,7 +72,7 @@ static void ximage(struct data_t *data, struct image *img, unsigned int width, u
width, height,
32, 0
);
- ximg->data = malloc(ximg->bytes_per_line * ximg->height);
+ ximg->data = malloc(ximg->bytes_per_line * ximg->height);
XInitImage(ximg);
}
(fast ? nearestscale : scale)(img, ximg->width, ximg->height, ximg->bytes_per_line, ximg->data);