summaryrefslogtreecommitdiff
path: root/src/libtiff/tif_pixarlog.c
diff options
context:
space:
mode:
authorscuri <scuri>2010-01-26 15:56:35 +0000
committerscuri <scuri>2010-01-26 15:56:35 +0000
commit10c47ef2af59dfba47633520faa9302af90a9ae7 (patch)
treeb232d571cffdc9d6d3481fac43965618faf957fc /src/libtiff/tif_pixarlog.c
parent8530450bdbc42d17fa32f34e5fef0f980c71439b (diff)
*** empty log message ***
Diffstat (limited to 'src/libtiff/tif_pixarlog.c')
-rw-r--r--src/libtiff/tif_pixarlog.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/libtiff/tif_pixarlog.c b/src/libtiff/tif_pixarlog.c
index b5f5c60..4779e6e 100644
--- a/src/libtiff/tif_pixarlog.c
+++ b/src/libtiff/tif_pixarlog.c
@@ -1,4 +1,4 @@
-/* $Id: tif_pixarlog.c,v 1.3 2009/12/11 15:17:41 scuri Exp $ */
+/* $Id: tif_pixarlog.c,v 1.4 2010/01/26 15:56:36 scuri Exp $ */
/*
* Copyright (c) 1996-1997 Sam Leffler
@@ -327,7 +327,7 @@ horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
while (n > 0) {
REPEAT(stride,
wp[stride] += *wp; *op = *wp&mask; wp++; op++)
- n -= stride;
+ n -= stride;
}
}
}
@@ -593,6 +593,7 @@ PixarLogMakeTables(PixarLogState *sp)
static int PixarLogEncode(TIFF*, tidata_t, tsize_t, tsample_t);
static int PixarLogDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+#define N(a) (sizeof(a)/sizeof(a[0]))
#define PIXARLOGDATAFMT_UNKNOWN -1
static int
@@ -767,18 +768,6 @@ PixarLogDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s)
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabArrayOfShort(up, nsamples);
- /*
- * if llen is not an exact multiple of nsamples, the decode operation
- * may overflow the output buffer, so truncate it enough to prevent
- * that but still salvage as much data as possible.
- */
- if (nsamples % llen) {
- TIFFWarningExt(tif->tif_clientdata, module,
- "%s: stride %d is not a multiple of sample count, "
- "%d, data truncated.", tif->tif_name, llen, nsamples);
- nsamples -= nsamples % llen;
- }
-
for (i = 0; i < nsamples; i += llen, up += llen) {
switch (sp->user_datafmt) {
case PIXARLOGDATAFMT_FLOAT:
@@ -1047,7 +1036,7 @@ PixarLogEncode(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
TIFFDirectory *td = &tif->tif_dir;
PixarLogState *sp = EncoderState(tif);
static const char module[] = "PixarLogEncode";
- int i, n, llen;
+ int i, n, llen;
unsigned short * up;
(void) s;
@@ -1289,23 +1278,11 @@ static const TIFFFieldInfo pixarlogFieldInfo[] = {
int
TIFFInitPixarLog(TIFF* tif, int scheme)
{
- static const char module[] = "TIFFInitPixarLog";
-
PixarLogState* sp;
assert(scheme == COMPRESSION_PIXARLOG);
/*
- * Merge codec-specific tag information.
- */
- if (!_TIFFMergeFieldInfo(tif, pixarlogFieldInfo,
- TIFFArrayCount(pixarlogFieldInfo))) {
- TIFFErrorExt(tif->tif_clientdata, module,
- "Merging PixarLog codec-specific tags failed");
- return 0;
- }
-
- /*
* Allocate state block so tag methods have storage to record values.
*/
tif->tif_data = (tidata_t) _TIFFmalloc(sizeof (PixarLogState));
@@ -1334,6 +1311,7 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
tif->tif_cleanup = PixarLogCleanup;
/* Override SetField so we can handle our private pseudo-tag */
+ _TIFFMergeFieldInfo(tif, pixarlogFieldInfo, N(pixarlogFieldInfo));
sp->vgetparent = tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
sp->vsetparent = tif->tif_tagmethods.vsetfield;
@@ -1355,7 +1333,7 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
return (1);
bad:
- TIFFErrorExt(tif->tif_clientdata, module,
+ TIFFErrorExt(tif->tif_clientdata, "TIFFInitPixarLog",
"No space for PixarLog state block");
return (0);
}