34#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
35#define TIFFCvtNativeToIEEEDouble(tif, n, dp)
212 static const char module[] =
"TIFFDeferStrileArrayWriting";
216 "File opened in read-only mode");
222 "Directory has already been written");
263 static const char module[] =
"TIFFRewriteDirectory";
285 "Error updating TIFF header");
297 if (!
SeekOK(tif, nextdir) ||
298 !
ReadOK(tif, &dircount, 2)) {
300 "Error fetching directory count");
307 if (!
ReadOK(tif, &nextnextdir, 4)) {
309 "Error fetching directory link");
322 "Error writing directory link");
343 "Error updating TIFF header");
356 if (!
SeekOK(tif, nextdir) ||
357 !
ReadOK(tif, &dircount64, 8)) {
359 "Error fetching directory count");
364 if (dircount64>0xFFFF)
367 "Sanity check on tag count failed, likely corrupt TIFF");
370 dircount=(
uint16)dircount64;
373 if (!
ReadOK(tif, &nextnextdir, 8)) {
375 "Error fetching directory link");
388 "Error writing directory link");
409 static const char module[] =
"TIFFWriteDirectorySec";
433 "Error post-encoding before directory write");
451 "Error flushing data before directory write");
744 "Cannot write tag %d (%s)",
868 for (na=0, nb=
dir; ; na++, nb++)
873 "Cannot find SubIFD tag");
902 for (
m=0;
m<ndir;
m++)
938 for (
m=0;
m<ndir;
m++)
1014 if(
val > 0x7FFFFFFF )
1017 return -0x7FFFFFFF-1;
1051 static const char module[] =
"TIFFWriteDirectoryTagSampleformatArray";
1132 return(TIFFWriteDirectoryTagFloatPerSample(tif,ndir,
dir,
tag,(
float)
value));
1134 return(TIFFWriteDirectoryTagDoublePerSample(tif,ndir,
dir,
tag,
value));
1137 return(TIFFWriteDirectoryTagSbytePerSample(tif,ndir,
dir,
tag,(
int8)
value));
1139 return(TIFFWriteDirectoryTagSshortPerSample(tif,ndir,
dir,
tag,(
int16)
value));
1141 return(TIFFWriteDirectoryTagSlongPerSample(tif,ndir,
dir,
tag,(
int32)
value));
1186 return(TIFFWriteDirectoryTagCheckedByte(tif,ndir,
dir,
tag,
value));
1205 static const char module[] =
"TIFFWriteDirectoryTagBytePerSample";
1238 return(TIFFWriteDirectoryTagCheckedSbyte(tif,ndir,
dir,
tag,
value));
1257 static const char module[] =
"TIFFWriteDirectoryTagSbytePerSample";
1306 static const char module[] =
"TIFFWriteDirectoryTagShortPerSample";
1338 return(TIFFWriteDirectoryTagCheckedSshort(tif,ndir,
dir,
tag,
value));
1357 static const char module[] =
"TIFFWriteDirectoryTagSshortPerSample";
1407 static const char module[] =
"TIFFWriteDirectoryTagLongPerSample";
1440 return(TIFFWriteDirectoryTagCheckedSlong(tif,ndir,
dir,
tag,
value));
1459 static const char module[] =
"TIFFWriteDirectoryTagSlongPerSample";
1492 return(TIFFWriteDirectoryTagCheckedLong8(tif,ndir,
dir,
tag,
value));
1516 return(TIFFWriteDirectoryTagCheckedSlong8(tif,ndir,
dir,
tag,
value));
1572 return(TIFFWriteDirectoryTagCheckedFloat(tif,ndir,
dir,
tag,
value));
1589 static const char module[] =
"TIFFWriteDirectoryTagFloatPerSample";
1621 return(TIFFWriteDirectoryTagCheckedDouble(tif,ndir,
dir,
tag,
value));
1638 static const char module[] =
"TIFFWriteDirectoryTagDoublePerSample";
1705 return strile_size > uncompressed_threshold;
1718 return strile_size >= uncompressed_threshold / 10;
1743 static const char module[] =
"TIFFWriteDirectoryTagLongLong8Array";
1761 int write_aslong8 = 1;
1814 "Attempt to write value larger than 0xFFFFFFFF in LONG array.");
1843 "Attempt to write value larger than 0xFFFF in SHORT array.");
1866 static const char module[] =
"TIFFWriteDirectoryTagIfdIfd8Array";
1902 "Attempt to write value larger than 0xFFFFFFFF in Classic TIFF file.");
1919 static const char module[] =
"TIFFWriteDirectoryTagShortLongLong8Array";
1932 if ((
n==0)&&(*ma>0xFFFF))
1934 if ((
n==1)&&(*ma>0xFFFFFFFF))
1981 static const char module[] =
"TIFFWriteDirectoryTagColormap";
2008 static const char module[] =
"TIFFWriteDirectoryTagTransferfunction";
2061 static const char module[] =
"TIFFWriteDirectoryTagSubifd";
2091 if( *
pa > 0xFFFFFFFFUL)
2322 static const char module[] =
"TIFFWriteDirectoryTagCheckedRational";
2335 else if (
value==0.0)
2366 static const char module[] =
"TIFFWriteDirectoryTagCheckedRationalArray";
2379 for (na=
value, nb=
m, nc=0; nc<
count; na++, nb+=2, nc++)
2381 if (*na<=0.0 || *na != *na)
2386 else if (*na >= 0 && *na <= (
float)0xFFFFFFFFU &&
2387 *na==(
float)(
uint32)(*na))
2394 nb[0]=(
uint32)((
double)(*na)*0xFFFFFFFF);
2400 nb[1]=(
uint32)((
double)0xFFFFFFFF/(*na));
2413 static const char module[] =
"TIFFWriteDirectoryTagCheckedSrationalArray";
2426 for (na=
value, nb=
m, nc=0; nc<
count; na++, nb+=2, nc++)
2430 if (*na==(
int32)(*na))
2437 nb[0]=-(
int32)((
double)(-*na)*0x7FFFFFFF);
2443 nb[1]=(
int32)((
double)0x7FFFFFFF/(-*na));
2448 if (*na==(
int32)(*na))
2455 nb[0]=(
int32)((
double)(*na)*0x7FFFFFFF);
2461 nb[1]=(
int32)((
double)0x7FFFFFFF/(*na));
2477 assert(
sizeof(
float)==4);
2490 assert(
sizeof(
float)==4);
2502 assert(
sizeof(
double)==8);
2515 assert(
sizeof(
double)==8);
2546 static const char module[] =
"TIFFWriteDirectoryTagData";
2559 for (
n=*ndir;
n>
m;
n--)
2563 dir[
m].tdir_type=datatype;
2565 dir[
m].tdir_offset.toff_long8 = 0;
2568 if(
data && datalength )
2580 if ((nb<na)||(nb<datalength))
2590 assert(datalength<0x80000000UL);
2609 dir[
m].tdir_offset.toff_long8 = na;
2624 static const char module[] =
"TIFFLinkDirectory";
2642 "Error writing SubIFD directory link");
2665 "Error writing SubIFD directory link");
2696 "Error writing TIFF header");
2709 if (!
SeekOK(tif, nextdir) ||
2710 !
ReadOK(tif, &dircount, 2)) {
2712 "Error fetching directory count");
2719 if (!
ReadOK(tif, &nextnextdir, 4)) {
2721 "Error fetching directory link");
2732 "Error writing directory link");
2737 nextdir=nextnextdir;
2755 "Error writing TIFF header");
2769 if (!
SeekOK(tif, nextdir) ||
2770 !
ReadOK(tif, &dircount64, 8)) {
2772 "Error fetching directory count");
2777 if (dircount64>0xFFFF)
2780 "Sanity check on tag count failed, likely corrupt TIFF");
2783 dircount=(
uint16)dircount64;
2786 if (!
ReadOK(tif, &nextnextdir, 8)) {
2788 "Error fetching directory link");
2799 "Error writing directory link");
2804 nextdir=nextnextdir;
2827 static const char module[] =
"TIFFResetField";
2831 uint8 direntry_raw[20];
2836 int value_in_entry = 0;
2852 "Memory mapped files not currently supported for this operation." );
2859 "Attempt to reset field on directory not already on disk." );
2868 "%s: Seek error accessing TIFF directory",
2879 "%s: Can not read TIFF directory count",
2891 "%s: Can not read TIFF directory count",
2897 dircount = (
uint16)dircount64;
2905 while( dircount > 0 )
2907 if (!
ReadOK(tif, direntry_raw, dirsize)) {
2909 "%s: Can not read TIFF directory entry.",
2914 memcpy( &entry_tag, direntry_raw + 0,
sizeof(
uint16) );
2918 if( entry_tag ==
tag )
2921 read_offset += dirsize;
2924 if( entry_tag !=
tag )
2927 "%s: Could not find tag %d.",
2935 memcpy( &entry_type, direntry_raw + 2,
sizeof(
uint16) );
2946 entry_count =
value;
2951 entry_offset =
value;
2955 memcpy( &entry_count, direntry_raw + 4,
sizeof(
uint64) );
2959 memcpy( &entry_offset, direntry_raw + 12,
sizeof(
uint64) );
2967 if( entry_offset == 0 && entry_count == 0 && entry_type == 0 )
2975 int write_aslong8 = 1;
2990 int write_aslong4 = 1;
3023 datatype = in_datatype;
3030 datatype = entry_type;
3033 datatype = entry_type;
3036 datatype = entry_type;
3038 datatype = in_datatype;
3047 "for field buffer.");
3051 if( datatype == in_datatype )
3059 ((
int32 *) buf_to_write)[
i] =
3065 "Value exceeds 32bit range of output type." );
3077 ((
uint32 *) buf_to_write)[
i] =
3083 "Value exceeds 32bit range of output type." );
3094 ((
uint16 *) buf_to_write)[
i] =
3100 "Value exceeds 16bit range of output type." );
3108 "Unhandled type conversion." );
3129 entry_offset = read_offset + 8;
3137 entry_offset = read_offset + 12;
3166 if (!
SeekOK(tif, entry_offset)) {
3169 "%s: Seek error accessing TIFF directory",
3176 "Error writing directory link");
3187 if( !value_in_entry )
3194 "Error writing directory link");
3209 entry_type = datatype;
3211 memcpy( direntry_raw + 2, &entry_type,
sizeof(
uint16) );
3231 memcpy( direntry_raw + 4, &entry_count,
sizeof(
uint64) );
3235 memcpy( direntry_raw + 12, &entry_offset,
sizeof(
uint64) );
3243 if (!
SeekOK(tif, read_offset )) {
3245 "%s: Seek error accessing TIFF directory",
3250 if (!
WriteOK(tif, direntry_raw,dirsize))
3253 "%s: Can not write TIFF directory entry.",
ACPI_SIZE strlen(const char *String)
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble GLdouble q
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
union TIFFDirEntry::@3463 tdir_offset
uint64 * td_stripbytecount_p
uint16 td_samplesperpixel
double * td_sminsamplevalue
TIFFDirEntry td_stripoffset_entry
uint16 * td_transferfunction[3]
uint16 td_ycbcrpositioning
TIFFTagValue * td_customValues
double * td_smaxsamplevalue
unsigned char td_deferstrilearraywriting
uint64 * td_stripoffset_p
uint16 td_halftonehints[2]
TIFFDirEntry td_stripbytecount_entry
uint16 td_ycbcrsubsampling[2]
unsigned char field_passcount
TIFFSetGetFieldType get_field_type
TIFFHeaderClassic classic
tmsize_t tif_rawdataloaded
TIFFBoolMethod tif_postencode
union tiff::@3465 tif_header
TIFFVoidMethod tif_cleanup
int TIFFGetFieldDefaulted(TIFF *tif, uint32 tag,...)
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
float _TIFFClampDoubleToFloat(double val)
void TIFFFreeDirectory(TIFF *tif)
int TIFFCreateDirectory(TIFF *tif)
int TIFFGetField(TIFF *tif, uint32 tag,...)
#define FIELD_SUBFILETYPE
#define FIELD_STRIPOFFSETS
#define FIELD_TRANSFERFUNCTION
#define FIELD_HALFTONEHINTS
#define FIELD_ORIENTATION
#define FIELD_MINSAMPLEVALUE
#define FIELD_SMAXSAMPLEVALUE
#define FIELD_IMAGEDIMENSIONS
#define FIELD_YCBCRSUBSAMPLING
#define FIELD_EXTRASAMPLES
#define FIELD_SMINSAMPLEVALUE
#define TIFFFieldSet(tif, field)
#define FIELD_MAXSAMPLEVALUE
#define FIELD_TILEDIMENSIONS
#define FIELD_ROWSPERSTRIP
#define FIELD_COMPRESSION
#define FIELD_STRIPBYTECOUNTS
#define FIELD_YCBCRPOSITIONING
#define FIELD_REFBLACKWHITE
#define FIELD_SAMPLEFORMAT
#define FIELD_BITSPERSAMPLE
#define FIELD_RESOLUTIONUNIT
#define FIELD_PLANARCONFIG
#define FIELD_SAMPLESPERPIXEL
#define FIELD_PHOTOMETRIC
#define FIELD_THRESHHOLDING
int TIFFDataWidth(TIFFDataType type)
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
uint32 TIFFFieldTag(const TIFFField *fip)
int _TIFFFillStriles(TIFF *tif)
static uint32 TIFFClampDoubleToUInt32(double val)
static int WriteAsLong4(TIFF *tif, uint64 strile_size)
int TIFFCheckpointDirectory(TIFF *tif)
static int TIFFWriteDirectoryTagSshortArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int16 *value)
static int TIFFLinkDirectory(TIFF *)
static int32 TIFFClampDoubleToInt32(double val)
static int TIFFWriteDirectoryTagLong(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 value)
static int _WriteAsType(TIFF *tif, uint64 strile_size, uint64 uncompressed_threshold)
static int TIFFWriteDirectoryTagIfdIfd8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint64 *value)
static int TIFFWriteDirectoryTagSampleformatArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, double *value)
static int TIFFWriteDirectoryTagShortArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint16 *value)
static int TIFFWriteDirectoryTagCheckedLongArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint32 *value)
static int TIFFWriteDirectoryTagCheckedSbyteArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int8 *value)
int _TIFFRewriteField(TIFF *tif, uint16 tag, TIFFDataType in_datatype, tmsize_t count, void *data)
static int WriteAsLong8(TIFF *tif, uint64 strile_size)
static int TIFFWriteDirectorySec(TIFF *tif, int isimage, int imagedone, uint64 *pdiroff)
static int TIFFWriteDirectoryTagLong8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint64 *value)
static int TIFFWriteDirectoryTagCheckedLong8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint64 *value)
static int TIFFWriteDirectoryTagCheckedShortArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint16 *value)
static int TIFFWriteDirectoryTagSrationalArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
void TIFFCvtNativeToIEEEDouble(TIFF *tif, uint32 n, double *dp)
static int TIFFWriteDirectoryTagCheckedLong(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 value)
static int TIFFWriteDirectoryTagCheckedSlong8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int64 *value)
static int TIFFWriteDirectoryTagFloatArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
static int TIFFWriteDirectoryTagCheckedRationalArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
static int TIFFWriteDirectoryTagRational(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, double value)
static int TIFFWriteDirectoryTagAscii(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, char *value)
void TIFFCvtNativeToIEEEFloat(TIFF *tif, uint32 n, float *fp)
static uint8 TIFFClampDoubleToUInt8(double val)
int TIFFWriteCustomDirectory(TIFF *tif, uint64 *pdiroff)
static int TIFFWriteDirectoryTagCheckedIfdArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint32 *value)
static int TIFFWriteDirectoryTagCheckedSrationalArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
static int TIFFWriteDirectoryTagSlongArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int32 *value)
static int8 TIFFClampDoubleToInt8(double val)
int TIFFRewriteDirectory(TIFF *tif)
static int TIFFWriteDirectoryTagData(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void *data)
static int TIFFWriteDirectoryTagIfdArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint32 *value)
static uint16 TIFFClampDoubleToUInt16(double val)
static int TIFFWriteDirectoryTagTransferfunction(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir)
int TIFFDeferStrileArrayWriting(TIFF *tif)
static int TIFFWriteDirectoryTagShortLong(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 value)
static int TIFFWriteDirectoryTagCheckedRational(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, double value)
static int TIFFWriteDirectoryTagCheckedByteArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint8 *value)
static int TIFFWriteDirectoryTagSbyteArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int8 *value)
static int TIFFWriteDirectoryTagCheckedFloatArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
static int TIFFWriteDirectoryTagRationalArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, float *value)
static int16 TIFFClampDoubleToInt16(double val)
static int TIFFWriteDirectoryTagSubifd(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir)
static int TIFFWriteDirectoryTagCheckedIfd8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint64 *value)
static int TIFFWriteDirectoryTagCheckedSshortArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int16 *value)
static int TIFFWriteDirectoryTagCheckedDoubleArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, double *value)
int TIFFWriteDirectory(TIFF *tif)
static int TIFFWriteDirectoryTagLongArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint32 *value)
static int TIFFWriteDirectoryTagCheckedUndefinedArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint8 *value)
static int TIFFWriteDirectoryTagByteArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint8 *value)
static int TIFFWriteDirectoryTagSlong8Array(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, int64 *value)
static int TIFFWriteDirectoryTagColormap(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir)
static int TIFFWriteDirectoryTagDoubleArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, double *value)
static int TIFFWriteDirectoryTagUndefinedArray(TIFF *tif, uint32 *ndir, TIFFDirEntry *dir, uint16 tag, uint32 count, uint8 *value)