From 78c0815c4118fe24ab78cce2dc48a6232dcd824a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Jun 2012 20:55:18 +0000 Subject: - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FreeImage/Source/LibTIFF/tif_color.c | 6 +-- plugins/FreeImage/Source/LibTIFF/tif_dir.c | 12 +++--- plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c | 2 +- plugins/FreeImage/Source/LibTIFF/tif_dirread.c | 30 ++++++------- plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c | 22 +++++----- plugins/FreeImage/Source/LibTIFF/tif_extension.c | 6 +-- plugins/FreeImage/Source/LibTIFF/tif_fax3.c | 6 +-- plugins/FreeImage/Source/LibTIFF/tif_fax3.h | 2 +- plugins/FreeImage/Source/LibTIFF/tif_getimage.c | 40 +++++++++--------- plugins/FreeImage/Source/LibTIFF/tif_jpeg.c | 54 ++++++++++++------------ plugins/FreeImage/Source/LibTIFF/tif_luv.c | 4 +- plugins/FreeImage/Source/LibTIFF/tif_lzw.c | 6 +-- plugins/FreeImage/Source/LibTIFF/tif_packbits.c | 4 +- plugins/FreeImage/Source/LibTIFF/tif_predict.c | 10 ++--- plugins/FreeImage/Source/LibTIFF/tif_read.c | 4 +- plugins/FreeImage/Source/LibTIFF/tif_thunder.c | 2 +- plugins/FreeImage/Source/LibTIFF/tif_unix.c | 4 +- plugins/FreeImage/Source/LibTIFF/tif_win32.c | 4 +- plugins/FreeImage/Source/LibTIFF/tif_write.c | 8 ++-- plugins/FreeImage/Source/LibTIFF/tif_zip.c | 6 +-- 20 files changed, 116 insertions(+), 116 deletions(-) (limited to 'plugins/FreeImage/Source/LibTIFF') diff --git a/plugins/FreeImage/Source/LibTIFF/tif_color.c b/plugins/FreeImage/Source/LibTIFF/tif_color.c index 06cc431a0a..f0302e4bf2 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_color.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_color.c @@ -49,7 +49,7 @@ TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, float L = (float)l * 100.0F / 255.0F; float cby, tmp; - if( L < 8.856F ) { + if ( L < 8.856F ) { *Y = (L * cielab->Y0) / 903.292F; cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F; } else { @@ -58,13 +58,13 @@ TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, } tmp = (float)a / 500.0F + cby; - if( tmp < 0.2069F ) + if ( tmp < 0.2069F ) *X = cielab->X0 * (tmp - 0.13793F) / 7.787F; else *X = cielab->X0 * tmp * tmp * tmp; tmp = cby - (float)b / 200.0F; - if( tmp < 0.2069F ) + if ( tmp < 0.2069F ) *Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F; else *Z = cielab->Z0 * tmp * tmp * tmp; diff --git a/plugins/FreeImage/Source/LibTIFF/tif_dir.c b/plugins/FreeImage/Source/LibTIFF/tif_dir.c index 7815857f21..081bb43c06 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_dir.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_dir.c @@ -193,7 +193,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap) /* * Setup new compression routine state. */ - if( (status = TIFFSetCompressionScheme(tif, v)) != 0 ) + if ( (status = TIFFSetCompressionScheme(tif, v)) != 0 ) td->td_compression = (uint16) v; else status = 0; @@ -341,11 +341,11 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap) td->td_sampleformat = (uint16) v; /* Try to fix up the SWAB function for complex data. */ - if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT + if ( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT && td->td_bitspersample == 32 && tif->tif_postdecode == _TIFFSwab32BitData ) tif->tif_postdecode = _TIFFSwab16BitData; - else if( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT + else if ( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT || td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP) && td->td_bitspersample == 64 && tif->tif_postdecode == _TIFFSwab64BitData ) @@ -388,7 +388,7 @@ _TIFFVSetField(TIFF* tif, ttag_t tag, va_list ap) s = va_arg(ap, char*); v = checkInkNamesString(tif, v, s); status = v > 0; - if( v > 0 ) { + if ( v > 0 ) { _TIFFsetNString(&td->td_inknames, s, v); td->td_inknameslen = v; } @@ -839,7 +839,7 @@ _TIFFVGetField(TIFF* tif, ttag_t tag, va_list ap) * the other. If the client tries to get a tag that is not valid * for the image's codec then we'll arrive here. */ - if( fip == NULL || fip->field_bit != FIELD_CUSTOM ) + if ( fip == NULL || fip->field_bit != FIELD_CUSTOM ) { TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField", "%s: Invalid %stag \"%s\" " @@ -1008,7 +1008,7 @@ TIFFFreeDirectory(TIFF* tif) TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING); /* Cleanup custom tag values */ - for( i = 0; i < td->td_customValueCount; i++ ) { + for ( i = 0; i < td->td_customValueCount; i++ ) { if (td->td_customValues[i].value) _TIFFfree(td->td_customValues[i].value); } diff --git a/plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c b/plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c index a2055f44a5..7b7507a8cb 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c @@ -831,7 +831,7 @@ _TIFFFindOrRegisterFieldInfo( TIFF *tif, ttag_t tag, TIFFDataType dt ) const TIFFFieldInfo *fld; fld = _TIFFFindFieldInfo( tif, tag, dt ); - if( fld == NULL ) + if ( fld == NULL ) { fld = _TIFFCreateAnonFieldInfo( tif, tag, dt ); if (!_TIFFMergeFieldInfo(tif, fld, 1)) diff --git a/plugins/FreeImage/Source/LibTIFF/tif_dirread.c b/plugins/FreeImage/Source/LibTIFF/tif_dirread.c index 86d2fa87a9..3567b2ae51 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_dirread.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_dirread.c @@ -991,7 +991,7 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) td->td_stripbytecount = (uint32*) _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint32), "for \"StripByteCounts\" array"); - if( td->td_stripbytecount == NULL ) + if ( td->td_stripbytecount == NULL ) return -1; if (td->td_compression != COMPRESSION_NONE) { @@ -1689,7 +1689,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp) */ cp = (char *)_TIFFCheckMalloc(tif, dp->tdir_count + 1, 1, mesg); - if( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 ) + if ( (ok = (cp && TIFFFetchString(tif, dp, cp))) != 0 ) cp[dp->tdir_count] = '\0'; /* XXX */ break; } @@ -1762,7 +1762,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp) case TIFF_ASCII: case TIFF_UNDEFINED: /* bit of a cheat... */ { char c[2]; - if( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ) { + if ( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ) { c[1] = '\0'; /* XXX paranoid */ ok = (fip->field_passcount ? TIFFSetField(tif, dp->tdir_tag, 1, c) @@ -1797,7 +1797,7 @@ TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, uint16* pl) if (v && TIFFFetchShortArray(tif, dir, v)) { uint16 i; int check_count = dir->tdir_count; - if( samples < check_count ) + if ( samples < check_count ) check_count = samples; for (i = 1; i < check_count; i++) @@ -1839,7 +1839,7 @@ TIFFFetchPerSampleLongs(TIFF* tif, TIFFDirEntry* dir, uint32* pl) uint16 i; int check_count = dir->tdir_count; - if( samples < check_count ) + if ( samples < check_count ) check_count = samples; for (i = 1; i < check_count; i++) if (v[i] != v[0]) { @@ -1878,7 +1878,7 @@ TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* minv, double* maxv) if (v && TIFFFetchAnyArray(tif, dir, v)) { uint16 i; int check_count = dir->tdir_count; - if( samples < check_count ) + if ( samples < check_count ) check_count = samples; *minv = *maxv = v[0]; @@ -1928,17 +1928,17 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp) dir->tdir_count, sizeof (uint16), "to fetch strip tag"); if (dp == NULL) return (0); - if( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) { + if ( (status = TIFFFetchShortArray(tif, dir, dp)) != 0 ) { int i; - for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) + for ( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) { lp[i] = dp[i]; } } _TIFFfree((char*) dp); - } else if( nstrips != (int) dir->tdir_count ) { + } else if ( nstrips != (int) dir->tdir_count ) { /* Special case to correct length */ uint32* dp = (uint32*) _TIFFCheckMalloc(tif, @@ -1947,10 +1947,10 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp) return (0); status = TIFFFetchLongArray(tif, dir, dp); - if( status != 0 ) { + if ( status != 0 ) { int i; - for( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) + for ( i = 0; i < nstrips && i < (int) dir->tdir_count; i++ ) { lp[i] = dp[i]; } @@ -1980,10 +1980,10 @@ TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir) */ cp = (char *)_TIFFCheckMalloc(tif, dir->tdir_count, sizeof (uint32), mesg); - if( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) { + if ( (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) != 0) { float* fp = (float*) _TIFFCheckMalloc(tif, dir->tdir_count, sizeof (float), mesg); - if( (ok = (fp != NULL)) != 0 ) { + if ( (ok = (fp != NULL)) != 0 ) { uint32 i; for (i = 0; i < dir->tdir_count; i++) fp[i] = (float)((uint32*) cp)[i]; @@ -2006,7 +2006,7 @@ TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir) float v; int ok = 0; - if( dir->tdir_count != 1 || dir->tdir_type != TIFF_RATIONAL ) + if ( dir->tdir_count != 1 || dir->tdir_type != TIFF_RATIONAL ) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "incorrect count or type for SubjectDistance, tag ignored" ); @@ -2064,7 +2064,7 @@ ChopUpSingleUncompressedStrip(TIFF* tif) if (rowsperstrip >= td->td_rowsperstrip) return; nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes); - if( nstrips == 0 ) /* something is wonky, do nothing. */ + if ( nstrips == 0 ) /* something is wonky, do nothing. */ return; newcounts = (uint32*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint32), diff --git a/plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c b/plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c index 17b8002af4..962937298e 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c @@ -185,14 +185,14 @@ _TIFFWriteDirectory(TIFF* tif, int done) * is set or not. For normal fields, we just use the * FieldSet test. */ - if( fip->field_bit == FIELD_CUSTOM ) + if ( fip->field_bit == FIELD_CUSTOM ) { int ci, is_set = FALSE; - for( ci = 0; ci < td->td_customValueCount; ci++ ) + for ( ci = 0; ci < td->td_customValueCount; ci++ ) is_set |= (td->td_customValues[ci].info == fip); - if( !is_set ) + if ( !is_set ) continue; } else if (!FieldSet(fields, fip->field_bit)) @@ -352,7 +352,7 @@ _TIFFWriteDirectory(TIFF* tif, int done) } dir++; - if( fip->field_bit != FIELD_CUSTOM ) + if ( fip->field_bit != FIELD_CUSTOM ) ResetFieldBit(fields, fip->field_bit); } @@ -496,20 +496,20 @@ _TIFFWriteCustomDirectory(TIFF* tif, toff_t *pdiroff) * is set or not. For normal fields, we just use the * FieldSet test. */ - if( fip->field_bit == FIELD_CUSTOM ) + if ( fip->field_bit == FIELD_CUSTOM ) { int ci, is_set = FALSE; - for( ci = 0; ci < td->td_customValueCount; ci++ ) + for ( ci = 0; ci < td->td_customValueCount; ci++ ) is_set |= (td->td_customValues[ci].info == fip); - if( !is_set ) + if ( !is_set ) continue; } else if (!FieldSet(fields, fip->field_bit)) continue; - if( fip->field_bit != FIELD_CUSTOM ) + if ( fip->field_bit != FIELD_CUSTOM ) ResetFieldBit(fields, fip->field_bit); } @@ -718,7 +718,7 @@ TIFFWriteNormalTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip) char* cp; if (fip->field_passcount) { - if( wc == (uint16) TIFF_VARIABLE2 ) + if ( wc == (uint16) TIFF_VARIABLE2 ) TIFFGetField(tif, fip->field_tag, &wc2, &cp); else TIFFGetField(tif, fip->field_tag, &wc, &cp); @@ -1163,7 +1163,7 @@ TIFFWriteAnyArray(TIFF* tif, break; case TIFF_DOUBLE: { - if( !TIFFWriteDoubleArray(tif, dir, v)) + if ( !TIFFWriteDoubleArray(tif, dir, v)) goto out; } break; @@ -1270,7 +1270,7 @@ TIFFRewriteDirectory( TIFF *tif ) static const char module[] = "TIFFRewriteDirectory"; /* We don't need to do anything special if it hasn't been written. */ - if( tif->tif_diroff == 0 ) + if ( tif->tif_diroff == 0 ) return TIFFWriteDirectory( tif ); /* diff --git a/plugins/FreeImage/Source/LibTIFF/tif_extension.c b/plugins/FreeImage/Source/LibTIFF/tif_extension.c index b00d9ac2aa..e8fb4a2cac 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_extension.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_extension.c @@ -46,7 +46,7 @@ ttag_t TIFFGetTagListEntry( TIFF *tif, int tag_index ) { TIFFDirectory* td = &tif->tif_dir; - if( tag_index < 0 || tag_index >= td->td_customValueCount ) + if ( tag_index < 0 || tag_index >= td->td_customValueCount ) return (ttag_t) -1; else return td->td_customValues[tag_index].info->field_tag; @@ -71,7 +71,7 @@ void *TIFFGetClientInfo( TIFF *tif, const char *name ) while( link != NULL && strcmp(link->name,name) != 0 ) link = link->next; - if( link != NULL ) + if ( link != NULL ) return link->data; else return NULL; @@ -89,7 +89,7 @@ void TIFFSetClientInfo( TIFF *tif, void *data, const char *name ) while( link != NULL && strcmp(link->name,name) != 0 ) link = link->next; - if( link != NULL ) + if ( link != NULL ) { link->data = data; return; diff --git a/plugins/FreeImage/Source/LibTIFF/tif_fax3.c b/plugins/FreeImage/Source/LibTIFF/tif_fax3.c index 047ba5d5aa..2e74a37c69 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_fax3.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_fax3.c @@ -387,7 +387,7 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx) *cp++ &= 0xff << (8-bx); run -= 8-bx; } - if( (n = run >> 3) != 0 ) { /* multiple bytes to fill */ + if ( (n = run >> 3) != 0 ) { /* multiple bytes to fill */ if ((n/sizeof (long)) > 1) { /* * Align to longword boundary and fill. @@ -422,7 +422,7 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx) *cp++ |= 0xff >> bx; run -= 8-bx; } - if( (n = run>>3) != 0 ) { /* multiple bytes to fill */ + if ( (n = run>>3) != 0 ) { /* multiple bytes to fill */ if ((n/sizeof (long)) > 1) { /* * Align to longword boundary and fill. @@ -1454,7 +1454,7 @@ Fax4Decode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) NeedBits16( 13, BADG4 ); BADG4: #ifdef FAX3_DEBUG - if( GetBits(13) != 0x1001 ) + if ( GetBits(13) != 0x1001 ) fputs( "Bad EOFB\n", stderr ); #endif ClrBits( 13 ); diff --git a/plugins/FreeImage/Source/LibTIFF/tif_fax3.h b/plugins/FreeImage/Source/LibTIFF/tif_fax3.h index c4e16c52d8..ec2811f660 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_fax3.h +++ b/plugins/FreeImage/Source/LibTIFF/tif_fax3.h @@ -360,7 +360,7 @@ static const char* StateNames[] = { doneBlack1d: \ if (a0 >= lastx) \ goto done1d; \ - if( *(pa-1) == 0 && *(pa-2) == 0 ) \ + if ( *(pa-1) == 0 && *(pa-2) == 0 ) \ pa -= 2; \ } \ eof1d: \ diff --git a/plugins/FreeImage/Source/LibTIFF/tif_getimage.c b/plugins/FreeImage/Source/LibTIFF/tif_getimage.c index 714d7e85e2..041e540cba 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_getimage.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_getimage.c @@ -202,7 +202,7 @@ TIFFRGBAImageEnd(TIFFRGBAImage* img) _TIFFfree(img->ycbcr), img->ycbcr = NULL; if (img->cielab) _TIFFfree(img->cielab), img->cielab = NULL; - if( img->redcmap ) { + if ( img->redcmap ) { _TIFFfree( img->redcmap ); _TIFFfree( img->greencmap ); _TIFFfree( img->bluecmap ); @@ -273,10 +273,10 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) } #ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA - if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) + if ( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) img->photometric = PHOTOMETRIC_MINISWHITE; - if( extrasamples == 0 + if ( extrasamples == 0 && img->samplesperpixel == 4 && img->photometric == PHOTOMETRIC_RGB ) { @@ -317,7 +317,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024]) img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color); - if( !img->redcmap || !img->greencmap || !img->bluecmap ) { + if ( !img->redcmap || !img->greencmap || !img->bluecmap ) { sprintf(emsg, "Out of memory for colormap copy"); return (0); } @@ -1575,7 +1575,7 @@ static void putcontig8bitYCbCrGenericTile( (void) y; fromskew = (fromskew * group_size) / h_group; - for( yy = 0; yy < h; yy++ ) + for ( yy = 0; yy < h; yy++ ) { unsigned char *pp_line; int y_line_group = yy / v_group; @@ -1584,7 +1584,7 @@ static void putcontig8bitYCbCrGenericTile( pp_line = pp + v_line_group * - for( xx = 0; xx < w; xx++ ) + for ( xx = 0; xx < w; xx++ ) { Cb = pp } @@ -1818,7 +1818,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile) pp += 6; } while (--x); - if( (w&3) != 0 ) + if ( (w&3) != 0 ) { int32 Cb = pp[4]; int32 Cr = pp[5]; @@ -1918,7 +1918,7 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile) pp += 4; } while (--x); - if( (w&1) != 0 ) + if ( (w&1) != 0 ) { int32 Cb = pp[2]; int32 Cr = pp[3]; @@ -2093,7 +2093,7 @@ makebwmap(TIFFRGBAImage* img) int i; uint32* p; - if( nsamples == 0 ) + if ( nsamples == 0 ) nsamples = 1; img->BWmap = (uint32**) _TIFFmalloc( @@ -2151,7 +2151,7 @@ setupMap(TIFFRGBAImage* img) range = (int32)((1L<bitspersample)-1); /* treat 16 bit the same as eight bit */ - if( img->bitspersample == 16 ) + if ( img->bitspersample == 16 ) range = (int32) 255; img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue)); @@ -2528,7 +2528,7 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster ) int ok; uint32 rowsperstrip, rows_to_read; - if( TIFFIsTiled( tif ) ) + if ( TIFFIsTiled( tif ) ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Can't use TIFFReadRGBAStrip() with tiled file."); @@ -2536,7 +2536,7 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster ) } TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); - if( (row % rowsperstrip) != 0 ) + if ( (row % rowsperstrip) != 0 ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Row passed to TIFFReadRGBAStrip() must be first in a strip."); @@ -2548,7 +2548,7 @@ TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster ) img.row_offset = row; img.col_offset = 0; - if( row + rowsperstrip > img.height ) + if ( row + rowsperstrip > img.height ) rows_to_read = img.height - row; else rows_to_read = rowsperstrip; @@ -2586,7 +2586,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) * tile boundary. */ - if( !TIFFIsTiled( tif ) ) + if ( !TIFFIsTiled( tif ) ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Can't use TIFFReadRGBATile() with stripped file."); @@ -2595,7 +2595,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) TIFFGetFieldDefaulted(tif, TIFFTAG_TILEWIDTH, &tile_xsize); TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize); - if( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 ) + if ( (col % tile_xsize) != 0 || (row % tile_ysize) != 0 ) { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Row/col passed to TIFFReadRGBATile() must be top" @@ -2620,12 +2620,12 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) * a full tile configuration afterwards. */ - if( row + tile_ysize > img.height ) + if ( row + tile_ysize > img.height ) read_ysize = img.height - row; else read_ysize = tile_ysize; - if( col + tile_xsize > img.width ) + if ( col + tile_xsize > img.width ) read_xsize = img.width - col; else read_xsize = tile_xsize; @@ -2649,10 +2649,10 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) * bottom to top format. */ - if( read_xsize == tile_xsize && read_ysize == tile_ysize ) + if ( read_xsize == tile_xsize && read_ysize == tile_ysize ) return( ok ); - for( i_row = 0; i_row < read_ysize; i_row++ ) { + for ( i_row = 0; i_row < read_ysize; i_row++ ) { memmove( raster + (tile_ysize - i_row - 1) * tile_xsize, raster + (read_ysize - i_row - 1) * read_xsize, read_xsize * sizeof(uint32) ); @@ -2660,7 +2660,7 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster) 0, sizeof(uint32) * (tile_xsize - read_xsize) ); } - for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) { + for ( i_row = read_ysize; i_row < tile_ysize; i_row++ ) { _TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize, 0, sizeof(uint32) * tile_xsize ); } diff --git a/plugins/FreeImage/Source/LibTIFF/tif_jpeg.c b/plugins/FreeImage/Source/LibTIFF/tif_jpeg.c index 06062b3376..ee7d886fa8 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_jpeg.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_jpeg.c @@ -888,7 +888,7 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) if (cc % sp->bytesperline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read"); - if( nrows > (int) sp->cinfo.d.image_height ) + if ( nrows > (int) sp->cinfo.d.image_height ) nrows = sp->cinfo.d.image_height; /* data is expected to be read in multiples of a scanline */ @@ -901,7 +901,7 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) ** For Mk1 always use it. */ #if !defined(JPEG_LIB_MK1) - if( sp->cinfo.d.data_precision == 12 ) + if ( sp->cinfo.d.data_precision == 12 ) #endif { line_work_buf = (JSAMPROW) @@ -910,7 +910,7 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) } do { - if( line_work_buf != NULL ) + if ( line_work_buf != NULL ) { /* ** In the MK1 case, we aways read into a 16bit buffer, and then @@ -920,13 +920,13 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1) return (0); - if( sp->cinfo.d.data_precision == 12 ) + if ( sp->cinfo.d.data_precision == 12 ) { int value_pairs = (sp->cinfo.d.output_width * sp->cinfo.d.num_components) / 2; int iPair; - for( iPair = 0; iPair < value_pairs; iPair++ ) + for ( iPair = 0; iPair < value_pairs; iPair++ ) { unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3; @@ -938,13 +938,13 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) out_ptr[2] = ((in_ptr[1] & 0xff) >> 0); } } - else if( sp->cinfo.d.data_precision == 8 ) + else if ( sp->cinfo.d.data_precision == 8 ) { int value_count = (sp->cinfo.d.output_width * sp->cinfo.d.num_components); int iValue; - for( iValue = 0; iValue < value_count; iValue++ ) + for ( iValue = 0; iValue < value_count; iValue++ ) { ((unsigned char *) buf)[iValue] = line_work_buf[iValue] & 0xff; @@ -968,7 +968,7 @@ JPEGDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) cc -= sp->bytesperline; } while (--nrows > 0); - if( line_work_buf != NULL ) + if ( line_work_buf != NULL ) _TIFFfree( line_work_buf ); } @@ -992,7 +992,7 @@ JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) if (cc % sp->bytesperline) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline not read"); - if( nrows > (int) sp->cinfo.d.image_height ) + if ( nrows > (int) sp->cinfo.d.image_height ) nrows = sp->cinfo.d.image_height; /* data is expected to be read in multiples of a scanline */ @@ -1075,7 +1075,7 @@ JPEGDecodeRaw(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) int value_pairs = (sp->cinfo.d.output_width * sp->cinfo.d.num_components) / 2; int iPair; - for( iPair = 0; iPair < value_pairs; iPair++ ) + for ( iPair = 0; iPair < value_pairs; iPair++ ) { unsigned char *out_ptr = ((unsigned char *) buf) + iPair * 3; JSAMPLE *in_ptr = tmpbuf + iPair * 2; @@ -1275,7 +1275,7 @@ JPEGSetupEncode(TIFF* tif) /* Create a JPEGTables field if appropriate */ if (sp->jpegtablesmode & (JPEGTABLESMODE_QUANT|JPEGTABLESMODE_HUFF)) { - if( sp->jpegtables == NULL + if ( sp->jpegtables == NULL || memcmp(sp->jpegtables,"\0\0\0\0\0\0\0\0\0",8) == 0 ) { if (!prepare_JPEGTables(tif)) @@ -1443,7 +1443,7 @@ JPEGEncode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s) TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "fractional scanline discarded"); /* The last strip will be limited to image size */ - if( !isTiled(tif) && tif->tif_row+nrows > tif->tif_dir.td_imagelength ) + if ( !isTiled(tif) && tif->tif_row+nrows > tif->tif_dir.td_imagelength ) nrows = tif->tif_dir.td_imagelength - tif->tif_row; while (nrows-- > 0) { @@ -1591,7 +1591,7 @@ JPEGCleanup(TIFF* tif) tif->tif_tagmethods.vsetfield = sp->vsetparent; tif->tif_tagmethods.printdir = sp->printdir; - if( sp->cinfo_initialized ) + if ( sp->cinfo_initialized ) TIFFjpeg_destroy(sp); /* release libjpeg resources */ if (sp->jpegtables) /* tag value */ _TIFFfree(sp->jpegtables); @@ -1630,7 +1630,7 @@ JPEGResetUpsampled( TIFF* tif ) * Must recalculate cached tile size in case sampling state changed. * Should we really be doing this now if image size isn't set? */ - if( tif->tif_tilesize > 0 ) + if ( tif->tif_tilesize > 0 ) tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tsize_t) -1; if(tif->tif_scanlinesize > 0 ) @@ -1750,20 +1750,20 @@ JPEGFixupTestSubsampling( TIFF * tif ) * this we actually have to scan the header of a strip or tile of * jpeg data to get the sampling. */ - if( !sp->cinfo.comm.is_decompressor + if ( !sp->cinfo.comm.is_decompressor || sp->ycbcrsampling_fetched || td->td_photometric != PHOTOMETRIC_YCBCR ) return; sp->ycbcrsampling_fetched = 1; - if( TIFFIsTiled( tif ) ) + if ( TIFFIsTiled( tif ) ) { - if( !TIFFFillTile( tif, 0 ) ) + if ( !TIFFFillTile( tif, 0 ) ) return; } else { - if( !TIFFFillStrip( tif, 0 ) ) + if ( !TIFFFillStrip( tif, 0 ) ) return; } @@ -1900,9 +1900,9 @@ static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode if(sp->cinfo_initialized) { - if( force_encode && sp->cinfo.comm.is_decompressor ) + if ( force_encode && sp->cinfo.comm.is_decompressor ) TIFFjpeg_destroy( sp ); - else if( force_decode && !sp->cinfo.comm.is_decompressor ) + else if ( force_decode && !sp->cinfo.comm.is_decompressor ) TIFFjpeg_destroy( sp ); else return 1; @@ -1915,26 +1915,26 @@ static int JPEGInitializeLibJPEG( TIFF * tif, int force_encode, int force_decode * the state in decompressor mode if we have tile data, even if we * are not in read-only file access mode. */ - if( TIFFIsTiled( tif ) + if ( TIFFIsTiled( tif ) && TIFFGetField( tif, TIFFTAG_TILEBYTECOUNTS, &byte_counts ) && byte_counts != NULL ) { data_is_empty = byte_counts[0] == 0; } - if( !TIFFIsTiled( tif ) + if ( !TIFFIsTiled( tif ) && TIFFGetField( tif, TIFFTAG_STRIPBYTECOUNTS, &byte_counts) && byte_counts != NULL ) { data_is_empty = byte_counts[0] == 0; } - if( force_decode ) + if ( force_decode ) decompress = 1; - else if( force_encode ) + else if ( force_encode ) decompress = 0; - else if( tif->tif_mode == O_RDONLY ) + else if ( tif->tif_mode == O_RDONLY ) decompress = 1; - else if( data_is_empty ) + else if ( data_is_empty ) decompress = 0; else decompress = 1; @@ -2040,7 +2040,7 @@ TIFFInitJPEG(TIFF* tif, int scheme) ** the JPEGTables field. It will be properly created the right ** size later. */ - if( tif->tif_diroff == 0 ) + if ( tif->tif_diroff == 0 ) { #define SIZE_OF_JPEGTABLES 2000 /* diff --git a/plugins/FreeImage/Source/LibTIFF/tif_luv.c b/plugins/FreeImage/Source/LibTIFF/tif_luv.c index 153900701e..5e72ca63ba 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_luv.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_luv.c @@ -1200,7 +1200,7 @@ LogL16InitState(TIFF* tif) "No support for converting user data format to LogL"); return (0); } - if( isTiled(tif) ) + if ( isTiled(tif) ) sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); else sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); @@ -1301,7 +1301,7 @@ LogLuvInitState(TIFF* tif) "No support for converting user data format to LogLuv"); return (0); } - if( isTiled(tif) ) + if ( isTiled(tif) ) sp->tbuflen = multiply(td->td_tilewidth, td->td_tilelength); else sp->tbuflen = multiply(td->td_imagewidth, td->td_rowsperstrip); diff --git a/plugins/FreeImage/Source/LibTIFF/tif_lzw.c b/plugins/FreeImage/Source/LibTIFF/tif_lzw.c index 97105be1eb..16fcd7f9a7 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_lzw.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_lzw.c @@ -195,7 +195,7 @@ LZWSetupDecode(TIFF* tif) static const char module[] = " LZWSetupDecode"; int code; - if( sp == NULL ) + if ( sp == NULL ) { /* * Allocate state block so tag methods have storage to record @@ -257,7 +257,7 @@ LZWPreDecode(TIFF* tif, tsample_t s) (void) s; assert(sp != NULL); - if( sp->dec_codetab == NULL ) + if ( sp->dec_codetab == NULL ) { tif->tif_setupdecode( tif ); } @@ -764,7 +764,7 @@ LZWPreEncode(TIFF* tif, tsample_t s) (void) s; assert(sp != NULL); - if( sp->enc_hashtab == NULL ) + if ( sp->enc_hashtab == NULL ) { tif->tif_setupencode( tif ); } diff --git a/plugins/FreeImage/Source/LibTIFF/tif_packbits.c b/plugins/FreeImage/Source/LibTIFF/tif_packbits.c index 52206ee322..1fc96d13a2 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_packbits.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_packbits.c @@ -203,7 +203,7 @@ PackBitsEncodeChunk(TIFF* tif, tidata_t bp, tsize_t cc, tsample_t s) while ((long)cc > 0) { int chunk = rowsize; - if( cc < chunk ) + if ( cc < chunk ) chunk = cc; if (PackBitsEncode(tif, bp, chunk, s) < 0) @@ -237,7 +237,7 @@ PackBitsDecode(TIFF* tif, tidata_t op, tsize_t occ, tsample_t s) if (n == -128) /* nop */ continue; n = -n + 1; - if( occ < n ) + if ( occ < n ) { TIFFWarningExt(tif->tif_clientdata, tif->tif_name, "PackBitsDecode: discarding %ld bytes " diff --git a/plugins/FreeImage/Source/LibTIFF/tif_predict.c b/plugins/FreeImage/Source/LibTIFF/tif_predict.c index 4f477ab7ea..7f7dc636be 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_predict.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_predict.c @@ -117,7 +117,7 @@ PredictorSetupDecode(TIFF* tif) * Override default decoding method with one that does the * predictor stuff. */ - if( tif->tif_decoderow != PredictorDecodeRow ) + if ( tif->tif_decoderow != PredictorDecodeRow ) { sp->decoderow = tif->tif_decoderow; tif->tif_decoderow = PredictorDecodeRow; @@ -150,7 +150,7 @@ PredictorSetupDecode(TIFF* tif) * Override default decoding method with one that does the * predictor stuff. */ - if( tif->tif_decoderow != PredictorDecodeRow ) + if ( tif->tif_decoderow != PredictorDecodeRow ) { sp->decoderow = tif->tif_decoderow; tif->tif_decoderow = PredictorDecodeRow; @@ -195,7 +195,7 @@ PredictorSetupEncode(TIFF* tif) * Override default encoding method with one that does the * predictor stuff. */ - if( tif->tif_encoderow != PredictorEncodeRow ) + if ( tif->tif_encoderow != PredictorEncodeRow ) { sp->encoderow = tif->tif_encoderow; tif->tif_encoderow = PredictorEncodeRow; @@ -212,7 +212,7 @@ PredictorSetupEncode(TIFF* tif) * Override default encoding method with one that does the * predictor stuff. */ - if( tif->tif_encoderow != PredictorEncodeRow ) + if ( tif->tif_encoderow != PredictorEncodeRow ) { sp->encoderow = tif->tif_encoderow; tif->tif_encoderow = PredictorEncodeRow; @@ -580,7 +580,7 @@ PredictorEncodeTile(TIFF* tif, tidata_t bp0, tsize_t cc0, tsample_t s) * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965 */ working_copy = (uint8*) _TIFFmalloc(cc0); - if( working_copy == NULL ) + if ( working_copy == NULL ) { TIFFErrorExt(tif->tif_clientdata, module, "Out of memory allocating %d byte temp buffer.", diff --git a/plugins/FreeImage/Source/LibTIFF/tif_read.c b/plugins/FreeImage/Source/LibTIFF/tif_read.c index 5618e63e6e..351a1b058d 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_read.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_read.c @@ -99,7 +99,7 @@ TIFFReadScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample) if (!TIFFCheckRead(tif, 0)) return (-1); - if( (e = TIFFSeek(tif, row, sample)) != 0) { + if ( (e = TIFFSeek(tif, row, sample)) != 0) { /* * Decompress desired row into user buffer. */ @@ -141,7 +141,7 @@ TIFFReadEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t buf, tsize_t size) * rows in the strip (check for truncated last strip on any * of the separations). */ - if( td->td_rowsperstrip >= td->td_imagelength ) + if ( td->td_rowsperstrip >= td->td_imagelength ) strips_per_sep = 1; else strips_per_sep = (td->td_imagelength+td->td_rowsperstrip-1) diff --git a/plugins/FreeImage/Source/LibTIFF/tif_thunder.c b/plugins/FreeImage/Source/LibTIFF/tif_thunder.c index 6439c54e42..b8c6cc93cc 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_thunder.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_thunder.c @@ -72,7 +72,7 @@ ThunderSetupDecode(TIFF* tif) { static const char module[] = "ThunderSetupDecode"; - if( tif->tif_dir.td_bitspersample != 4 ) + if ( tif->tif_dir.td_bitspersample != 4 ) { TIFFErrorExt(tif->tif_clientdata, module, "Wrong bitspersample value (%d), Thunder decoder only supports 4bits per sample.", diff --git a/plugins/FreeImage/Source/LibTIFF/tif_unix.c b/plugins/FreeImage/Source/LibTIFF/tif_unix.c index f693df7653..7e294cb78b 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_unix.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_unix.c @@ -176,7 +176,7 @@ TIFFOpen(const char* name, const char* mode) } tif = TIFFFdOpen((int)fd, name, mode); - if(!tif) + if (!tif) close(fd); return tif; } @@ -229,7 +229,7 @@ TIFFOpenW(const wchar_t* name, const char* mode) _TIFFfree(mbname); - if(!tif) + if (!tif) close(fd); return tif; } diff --git a/plugins/FreeImage/Source/LibTIFF/tif_win32.c b/plugins/FreeImage/Source/LibTIFF/tif_win32.c index ddfd778ead..5b3875901d 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_win32.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_win32.c @@ -210,7 +210,7 @@ TIFFOpen(const char* name, const char* mode) } tif = TIFFFdOpen((int)fd, name, mode); - if(!tif) + if (!tif) CloseHandle(fd); return tif; } @@ -266,7 +266,7 @@ TIFFOpenW(const wchar_t* name, const char* mode) tif = TIFFFdOpen((int)fd, (mbname != NULL) ? mbname : "", mode); - if(!tif) + if (!tif) CloseHandle(fd); _TIFFfree(mbname); diff --git a/plugins/FreeImage/Source/LibTIFF/tif_write.c b/plugins/FreeImage/Source/LibTIFF/tif_write.c index 067d3f76fe..043e645b87 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_write.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_write.c @@ -124,7 +124,7 @@ TIFFWriteScanline(TIFF* tif, tdata_t buf, uint32 row, tsample_t sample) tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; - if( td->td_stripbytecount[strip] > 0 ) + if ( td->td_stripbytecount[strip] > 0 ) { /* if we are writing over existing tiles, zero length */ td->td_stripbytecount[strip] = 0; @@ -225,7 +225,7 @@ TIFFWriteEncodedStrip(TIFF* tif, tstrip_t strip, tdata_t data, tsize_t cc) tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; - if( td->td_stripbytecount[strip] > 0 ) + if ( td->td_stripbytecount[strip] > 0 ) { /* Force TIFFAppendToStrip() to consider placing data at end of file. */ @@ -359,7 +359,7 @@ TIFFWriteEncodedTile(TIFF* tif, ttile_t tile, tdata_t data, tsize_t cc) tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; - if( td->td_stripbytecount[tile] > 0 ) + if ( td->td_stripbytecount[tile] > 0 ) { /* Force TIFFAppendToStrip() to consider placing data at end of file. */ @@ -628,7 +628,7 @@ TIFFAppendToStrip(TIFF* tif, tstrip_t strip, tidata_t data, tsize_t cc) if (td->td_stripoffset[strip] == 0 || tif->tif_curoff == 0) { assert(td->td_nstrips > 0); - if( td->td_stripbytecount[strip] != 0 + if ( td->td_stripbytecount[strip] != 0 && td->td_stripoffset[strip] != 0 && td->td_stripbytecount[strip] >= cc ) { diff --git a/plugins/FreeImage/Source/LibTIFF/tif_zip.c b/plugins/FreeImage/Source/LibTIFF/tif_zip.c index 818b9dde09..74ee9c4b5a 100644 --- a/plugins/FreeImage/Source/LibTIFF/tif_zip.c +++ b/plugins/FreeImage/Source/LibTIFF/tif_zip.c @@ -118,7 +118,7 @@ ZIPPreDecode(TIFF* tif, tsample_t s) (void) s; assert(sp != NULL); - if( (sp->state & ZSTATE_INIT_DECODE) == 0 ) + if ( (sp->state & ZSTATE_INIT_DECODE) == 0 ) tif->tif_setupdecode( tif ); sp->stream.next_in = tif->tif_rawdata; @@ -196,7 +196,7 @@ ZIPPreEncode(TIFF* tif, tsample_t s) (void) s; assert(sp != NULL); - if( sp->state != ZSTATE_INIT_ENCODE ) + if ( sp->state != ZSTATE_INIT_ENCODE ) tif->tif_setupencode( tif ); sp->stream.next_out = tif->tif_rawdata; @@ -285,7 +285,7 @@ ZIPCleanup(TIFF* tif) if (sp->state & ZSTATE_INIT_ENCODE) { deflateEnd(&sp->stream); sp->state = 0; - } else if( sp->state & ZSTATE_INIT_DECODE) { + } else if ( sp->state & ZSTATE_INIT_DECODE) { inflateEnd(&sp->stream); sp->state = 0; } -- cgit v1.2.3