Get rid of BSD data types (u_char, u_short, u_int, u_long).
This commit is contained in:
parent
22cee71144
commit
b115d4a982
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_lzw.c,v 1.22 2004-09-08 18:01:29 dron Exp $ */
|
||||
/* $Id: tif_lzw.c,v 1.23 2004-09-14 06:32:19 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -92,9 +92,9 @@
|
||||
typedef struct {
|
||||
TIFFPredictorState predict; /* predictor super class */
|
||||
|
||||
u_short nbits; /* # of bits/code */
|
||||
u_short maxcode; /* maximum code for lzw_nbits */
|
||||
u_short free_ent; /* next free entry in hash table */
|
||||
unsigned short nbits; /* # of bits/code */
|
||||
unsigned short maxcode; /* maximum code for lzw_nbits */
|
||||
unsigned short free_ent; /* next free entry in hash table */
|
||||
long nextdata; /* next bits of i/o */
|
||||
long nextbits; /* # of valid bits in lzw_nextdata */
|
||||
|
||||
@ -121,9 +121,9 @@ typedef struct {
|
||||
*/
|
||||
typedef struct code_ent {
|
||||
struct code_ent *next;
|
||||
u_short length; /* string len, including this token */
|
||||
u_char value; /* data value */
|
||||
u_char firstchar; /* first token of string */
|
||||
unsigned short length; /* string len, including this token */
|
||||
unsigned char value; /* data value */
|
||||
unsigned char firstchar; /* first token of string */
|
||||
} code_t;
|
||||
|
||||
typedef int (*decodeFunc)(TIFF*, tidata_t, tsize_t, tsample_t);
|
||||
@ -343,7 +343,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
char *op = (char*) op0;
|
||||
long occ = (long) occ0;
|
||||
char *tp;
|
||||
u_char *bp;
|
||||
unsigned char *bp;
|
||||
hcode_t code;
|
||||
int len;
|
||||
long nbits, nextbits, nextdata, nbitsmask;
|
||||
@ -394,7 +394,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
sp->dec_restart = 0;
|
||||
}
|
||||
|
||||
bp = (u_char *)tif->tif_rawcp;
|
||||
bp = (unsigned char *)tif->tif_rawcp;
|
||||
nbits = sp->lzw_nbits;
|
||||
nextdata = sp->lzw_nextdata;
|
||||
nextbits = sp->lzw_nextbits;
|
||||
@ -505,7 +505,7 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
}
|
||||
|
||||
tif->tif_rawcp = (tidata_t) bp;
|
||||
sp->lzw_nbits = (u_short) nbits;
|
||||
sp->lzw_nbits = (unsigned short) nbits;
|
||||
sp->lzw_nextdata = nextdata;
|
||||
sp->lzw_nextbits = nextbits;
|
||||
sp->dec_nbitsmask = nbitsmask;
|
||||
@ -527,10 +527,10 @@ LZWDecode(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
* Decode a "hunk of data" for old images.
|
||||
*/
|
||||
#define GetNextCodeCompat(sp, bp, code) { \
|
||||
nextdata |= (u_long) *(bp)++ << nextbits; \
|
||||
nextdata |= (unsigned long) *(bp)++ << nextbits; \
|
||||
nextbits += 8; \
|
||||
if (nextbits < nbits) { \
|
||||
nextdata |= (u_long) *(bp)++ << nextbits; \
|
||||
nextdata |= (unsigned long) *(bp)++ << nextbits;\
|
||||
nextbits += 8; \
|
||||
} \
|
||||
code = (hcode_t)(nextdata & nbitsmask); \
|
||||
@ -545,7 +545,7 @@ LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
char *op = (char*) op0;
|
||||
long occ = (long) occ0;
|
||||
char *tp;
|
||||
u_char *bp;
|
||||
unsigned char *bp;
|
||||
int code, nbits;
|
||||
long nextbits, nextdata, nbitsmask;
|
||||
code_t *codep, *free_entp, *maxcodep, *oldcodep;
|
||||
@ -590,7 +590,7 @@ LZWDecodeCompat(TIFF* tif, tidata_t op0, tsize_t occ0, tsample_t s)
|
||||
sp->dec_restart = 0;
|
||||
}
|
||||
|
||||
bp = (u_char *)tif->tif_rawcp;
|
||||
bp = (unsigned char *)tif->tif_rawcp;
|
||||
nbits = sp->lzw_nbits;
|
||||
nextdata = sp->lzw_nextdata;
|
||||
nextbits = sp->lzw_nextbits;
|
||||
@ -764,10 +764,10 @@ LZWPreEncode(TIFF* tif, tsample_t s)
|
||||
#define PutNextCode(op, c) { \
|
||||
nextdata = (nextdata << nbits) | c; \
|
||||
nextbits += nbits; \
|
||||
*op++ = (u_char)(nextdata >> (nextbits-8)); \
|
||||
*op++ = (unsigned char)(nextdata >> (nextbits-8)); \
|
||||
nextbits -= 8; \
|
||||
if (nextbits >= 8) { \
|
||||
*op++ = (u_char)(nextdata >> (nextbits-8)); \
|
||||
*op++ = (unsigned char)(nextdata >> (nextbits-8)); \
|
||||
nextbits -= 8; \
|
||||
} \
|
||||
outcount += nbits; \
|
||||
@ -970,7 +970,7 @@ LZWPostEncode(TIFF* tif)
|
||||
}
|
||||
PutNextCode(op, CODE_EOI);
|
||||
if (nextbits > 0)
|
||||
*op++ = (u_char)(nextdata << (8-nextbits));
|
||||
*op++ = (unsigned char)(nextdata << (8-nextbits));
|
||||
tif->tif_rawcc = (tsize_t)(op - tif->tif_rawdata);
|
||||
return (1);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_ojpeg.c,v 1.12 2004-05-27 10:04:49 dron Exp $ */
|
||||
/* $Id: tif_ojpeg.c,v 1.13 2004-09-14 06:32:19 dron Exp $ */
|
||||
|
||||
#include "tiffiop.h"
|
||||
#ifdef OJPEG_SUPPORT
|
||||
@ -213,7 +213,7 @@ typedef struct /* This module's private, per-image state variable */
|
||||
samplesperclump,
|
||||
scancount; /* No. of scan lines accumulated */
|
||||
J_COLOR_SPACE photometric; /* IJG JPEG Library's photometry code */
|
||||
u_char h_sampling, /* Luminance sampling factors */
|
||||
unsigned char h_sampling, /* Luminance sampling factors */
|
||||
v_sampling,
|
||||
jpegcolormode; /* Who performs RGB <-> YCbCr conversion? */
|
||||
/* JPEGCOLORMODE_RAW <=> TIFF Library or its client */
|
||||
@ -2137,7 +2137,7 @@ OJPEGVSetField(register TIFF *tif,ttag_t tag,va_list ap)
|
||||
bufoff=0;
|
||||
for(i2=0;i2<sp->jpegqtables_length;i2++){
|
||||
TIFFSeekFile(tif, v[i2], SEEK_SET);
|
||||
TIFFReadFile(tif, &(((u_char*)(sp->jpegqtables))[bufoff]),
|
||||
TIFFReadFile(tif, &(((unsigned char*)(sp->jpegqtables))[bufoff]),
|
||||
64);
|
||||
bufoff+=64;
|
||||
}
|
||||
@ -2193,14 +2193,14 @@ OJPEGVSetField(register TIFF *tif,ttag_t tag,va_list ap)
|
||||
for(i2=0;i2<sp->jpegdctables_length;i2++){
|
||||
TIFFSeekFile(tif, v[i2], SEEK_SET);
|
||||
TIFFReadFile(tif,
|
||||
&(((u_char*)(sp->jpegdctables))[bufoff]),
|
||||
&(((unsigned char*)(sp->jpegdctables))[bufoff]),
|
||||
16);
|
||||
code_count=0;
|
||||
for(k2=0;k2<16;k2++){
|
||||
code_count+=((u_char*)(sp->jpegdctables))[k2+bufoff];
|
||||
code_count+=((unsigned char*)(sp->jpegdctables))[k2+bufoff];
|
||||
}
|
||||
TIFFReadFile(tif,
|
||||
&(((u_char*)(sp->jpegdctables))[bufoff+16]),
|
||||
&(((unsigned char*)(sp->jpegdctables))[bufoff+16]),
|
||||
code_count);
|
||||
bufoff+=16;
|
||||
bufoff+=code_count;
|
||||
@ -2637,3 +2637,5 @@ TIFFInitOJPEG(register TIFF *tif,int scheme)
|
||||
# undef td
|
||||
}
|
||||
#endif /* OJPEG_SUPPORT */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: tif_packbits.c,v 1.8 2004-06-06 10:20:12 dron Exp $ */
|
||||
/* $Id: tif_packbits.c,v 1.9 2004-09-14 06:32:19 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -31,20 +31,29 @@
|
||||
*
|
||||
* PackBits Compression Algorithm Support
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
PackBitsPreEncode(TIFF* tif, tsample_t s)
|
||||
{
|
||||
(void) s;
|
||||
|
||||
tif->tif_data = _TIFFmalloc(sizeof(tsize_t));
|
||||
/*
|
||||
* Calculate the scanline/tile-width size in bytes.
|
||||
*/
|
||||
if (isTiled(tif))
|
||||
tif->tif_data = (tidata_t) TIFFTileRowSize(tif);
|
||||
*(tsize_t*)tif->tif_data = TIFFTileRowSize(tif);
|
||||
else
|
||||
tif->tif_data = (tidata_t) TIFFScanlineSize(tif);
|
||||
*(tsize_t*)tif->tif_data = TIFFScanlineSize(tif);
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
PackBitsPostEncode(TIFF* tif)
|
||||
{
|
||||
if (tif->tif_data)
|
||||
_TIFFfree(tif->tif_data);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -61,7 +70,7 @@ typedef unsigned char tidata;
|
||||
static int
|
||||
PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
||||
{
|
||||
u_char* bp = (u_char*) buf;
|
||||
unsigned char* bp = (unsigned char*) buf;
|
||||
tidata_t op, ep, lastliteral;
|
||||
long n, slop;
|
||||
int b;
|
||||
@ -188,16 +197,7 @@ PackBitsEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
|
||||
static int
|
||||
PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s)
|
||||
{
|
||||
tsize_t rowsize = (tsize_t)(uint32) tif->tif_data;
|
||||
|
||||
/*
|
||||
* YCBCR data isn't really separable into rows, so we
|
||||
* might as well encode the whole tile/strip as one chunk.
|
||||
*
|
||||
* XXX: This code does nothing: why those lines here?
|
||||
*/
|
||||
/*if( tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR )
|
||||
rowsize = (tsize_t)(uint32) tif->tif_data;*/
|
||||
tsize_t rowsize = *(tsize_t*)tif->tif_data;
|
||||
|
||||
while ((long)cc > 0) {
|
||||
int chunk = rowsize;
|
||||
@ -281,9 +281,12 @@ TIFFInitPackBits(TIFF* tif, int scheme)
|
||||
tif->tif_decodestrip = PackBitsDecode;
|
||||
tif->tif_decodetile = PackBitsDecode;
|
||||
tif->tif_preencode = PackBitsPreEncode;
|
||||
tif->tif_postencode = PackBitsPostEncode;
|
||||
tif->tif_encoderow = PackBitsEncode;
|
||||
tif->tif_encodestrip = PackBitsEncodeChunk;
|
||||
tif->tif_encodetile = PackBitsEncodeChunk;
|
||||
return (1);
|
||||
}
|
||||
#endif /* PACKBITS_SUPPORT */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
|
Loading…
Reference in New Issue
Block a user