diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-10-05 22:06:50 +0200 |
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-10-05 22:06:50 +0200 |
| commit | a528ab8ce4e9625740e658131e7a60eea5ff4f5e (patch) | |
| tree | 3c76ea36474f6505aa0c3212c392ef7b242ab3f0 | |
| parent | 874c41537ac1702a4d020d4a5d6c8fc9302fae45 (diff) | |
use one buffer only
| -rw-r--r-- | src/pnmlcms.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/pnmlcms.c b/src/pnmlcms.c index f139b0f..0a8fdac 100644 --- a/src/pnmlcms.c +++ b/src/pnmlcms.c @@ -125,20 +125,17 @@ pam_transform(FILE *in_fp, FILE *out_fp, { int row, col; int nbytes = in_pnm->maxval == 65535?2:1; - char *in_buf = malloc(in_pnm->width * nbytes * 3); - char *out_buf = malloc(in_pnm->width * nbytes * 3); + char *buf = malloc(in_pnm->width * nbytes * 3); for (row = 0; row < in_pnm->height; row++) { - fread(in_buf, in_pnm->width, nbytes * 3, in_fp); + fread(buf, in_pnm->width, nbytes * 3, in_fp); - cmsDoTransform(*hTransform, in_buf, out_buf, in_pnm->width); + cmsDoTransform(*hTransform, buf, buf, in_pnm->width); - fwrite(out_buf, in_pnm->width, nbytes * 3, out_fp); + fwrite(buf, in_pnm->width, nbytes * 3, out_fp); } - free(in_buf); - free(out_buf); - + free(buf); return 0; } |
