summaryrefslogtreecommitdiff
path: root/plugins/FreeImage
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FreeImage')
-rw-r--r--plugins/FreeImage/Miranda/main.cpp24
-rw-r--r--plugins/FreeImage/Source/FreeImage/BitmapAccess.cpp32
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion16_555.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion16_565.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion24.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion32.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion4.cpp6
-rw-r--r--plugins/FreeImage/Source/FreeImage/Conversion8.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/ConversionFloat.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/ConversionRGB16.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/ConversionRGBF.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/ConversionType.cpp10
-rw-r--r--plugins/FreeImage/Source/FreeImage/ConversionUINT16.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/FreeImageIO.cpp18
-rw-r--r--plugins/FreeImage/Source/FreeImage/Halftoning.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/J2KHelper.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/MultiPage.cpp10
-rw-r--r--plugins/FreeImage/Source/FreeImage/NNQuantizer.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/PSDParser.cpp24
-rw-r--r--plugins/FreeImage/Source/FreeImage/PixelAccess.cpp24
-rw-r--r--plugins/FreeImage/Source/FreeImage/Plugin.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginBMP.cpp24
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginCUT.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginDDS.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginEXR.cpp44
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginG3.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginGIF.cpp304
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginHDR.cpp42
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginICO.cpp26
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginIFF.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginJ2K.cpp10
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginJP2.cpp10
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginJPEG.cpp36
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPCD.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPCX.cpp16
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPFM.cpp20
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPICT.cpp2
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPNG.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginPNM.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginRAS.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginRAW.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginSGI.cpp6
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginTARGA.cpp8
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginTIFF.cpp68
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginXBM.cpp32
-rw-r--r--plugins/FreeImage/Source/FreeImage/PluginXPM.cpp64
-rw-r--r--plugins/FreeImage/Source/FreeImage/ToneMapping.cpp6
-rw-r--r--plugins/FreeImage/Source/FreeImage/WuQuantizer.cpp6
-rw-r--r--plugins/FreeImage/Source/FreeImage/tmoColorConvert.cpp6
-rw-r--r--plugins/FreeImage/Source/FreeImage/tmoDrago03.cpp4
-rw-r--r--plugins/FreeImage/Source/FreeImage/tmoFattal02.cpp44
-rw-r--r--plugins/FreeImage/Source/FreeImage/tmoReinhard05.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp20
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/Channels.cpp42
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp36
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/Colors.cpp16
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp44
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/Display.cpp10
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp14
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp22
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/Rescale.cpp24
-rw-r--r--plugins/FreeImage/Source/FreeImageToolkit/Resize.cpp10
-rw-r--r--plugins/FreeImage/Source/LibPNG/pngrutil.c2
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_color.c6
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_dir.c12
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_dirinfo.c2
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_dirread.c30
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_dirwrite.c22
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_extension.c6
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_fax3.c6
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_fax3.h2
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_getimage.c40
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_jpeg.c54
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_luv.c4
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_lzw.c6
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_packbits.c4
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_predict.c10
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_read.c4
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_thunder.c2
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_unix.c4
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_win32.c4
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_write.c8
-rw-r--r--plugins/FreeImage/Source/LibTIFF/tif_zip.c6
-rw-r--r--plugins/FreeImage/Source/Metadata/Exif.cpp26
-rw-r--r--plugins/FreeImage/Source/Metadata/FreeImageTag.cpp14
-rw-r--r--plugins/FreeImage/Source/Metadata/IPTC.cpp6
-rw-r--r--plugins/FreeImage/Source/Metadata/TagConversion.cpp6
-rw-r--r--plugins/FreeImage/Source/Metadata/TagLib.cpp6
-rw-r--r--plugins/FreeImage/Source/Metadata/XTIFF.cpp16
-rw-r--r--plugins/FreeImage/Source/Utilities.h2
-rw-r--r--plugins/FreeImage/Source/Zlib/zutil.h2
92 files changed, 820 insertions, 820 deletions
diff --git a/plugins/FreeImage/Miranda/main.cpp b/plugins/FreeImage/Miranda/main.cpp
index 804e349d7e..8a3d538d4b 100644
--- a/plugins/FreeImage/Miranda/main.cpp
+++ b/plugins/FreeImage/Miranda/main.cpp
@@ -406,9 +406,9 @@ SetMemIO(FreeImageIO *io) {
unsigned __stdcall fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
unsigned x;
- for( x=0; x<count; x++ ) {
+ for ( x=0; x<count; x++ ) {
//if there isnt size bytes left to read, set pos to eof and return a short count
- if( FIIOMEM(filelen)-FIIOMEM(curpos) < (long)size ) {
+ if ( FIIOMEM(filelen)-FIIOMEM(curpos) < (long)size ) {
FIIOMEM(curpos) = FIIOMEM(filelen);
break;
}
@@ -426,13 +426,13 @@ unsigned __stdcall fiio_mem_WriteProc(void *buffer, unsigned size, unsigned coun
//double the data block size if we need to
while( FIIOMEM(curpos)+(long)(size*count) >= FIIOMEM(datalen) ) {
//if we are at or above 1G, we cant double without going negative
- if( FIIOMEM(datalen) & 0x40000000 ) {
+ if ( FIIOMEM(datalen) & 0x40000000 ) {
//max 2G
- if( FIIOMEM(datalen) == 0x7FFFFFFF ) {
+ if ( FIIOMEM(datalen) == 0x7FFFFFFF ) {
return 0;
}
newdatalen = 0x7FFFFFFF;
- } else if( FIIOMEM(datalen) == 0 ) {
+ } else if ( FIIOMEM(datalen) == 0 ) {
//default to 4K if nothing yet
newdatalen = 4096;
} else {
@@ -440,7 +440,7 @@ unsigned __stdcall fiio_mem_WriteProc(void *buffer, unsigned size, unsigned coun
newdatalen = FIIOMEM(datalen) << 1;
}
newdata = realloc( FIIOMEM(data), newdatalen );
- if( !newdata ) {
+ if ( !newdata ) {
return 0;
}
FIIOMEM(data) = newdata;
@@ -448,7 +448,7 @@ unsigned __stdcall fiio_mem_WriteProc(void *buffer, unsigned size, unsigned coun
}
memcpy( (char *)FIIOMEM(data) + FIIOMEM(curpos), buffer, size*count );
FIIOMEM(curpos) += size*count;
- if( FIIOMEM(curpos) > FIIOMEM(filelen) ) {
+ if ( FIIOMEM(curpos) > FIIOMEM(filelen) ) {
FIIOMEM(filelen) = FIIOMEM(curpos);
}
return count;
@@ -458,21 +458,21 @@ int __stdcall fiio_mem_SeekProc(fi_handle handle, long offset, int origin) {
switch(origin) { //0 to filelen-1 are 'inside' the file
default:
case SEEK_SET: //can fseek() to 0-7FFFFFFF always
- if( offset >= 0 ) {
+ if ( offset >= 0 ) {
FIIOMEM(curpos) = offset;
return 0;
}
break;
case SEEK_CUR:
- if( FIIOMEM(curpos)+offset >= 0 ) {
+ if ( FIIOMEM(curpos)+offset >= 0 ) {
FIIOMEM(curpos) += offset;
return 0;
}
break;
case SEEK_END:
- if( FIIOMEM(filelen)+offset >= 0 ) {
+ if ( FIIOMEM(filelen)+offset >= 0 ) {
FIIOMEM(curpos) = FIIOMEM(filelen)+offset;
return 0;
}
@@ -847,7 +847,7 @@ static INT_PTR serviceGetInterface(WPARAM wParam, LPARAM lParam)
{
FI_INTERFACE **ppfe = (FI_INTERFACE **)lParam;
- if((DWORD)wParam != FI_IF_VERSION)
+ if ((DWORD)wParam != FI_IF_VERSION)
return CALLSERVICE_NOTFOUND;
if(ppfe) {
@@ -877,7 +877,7 @@ static INT_PTR serviceLoad(WPARAM wParam, LPARAM lParam)
}
// check that the plugin has reading capabilities ...
- if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
+ if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
// ok, let's load the file
FIBITMAP *dib;
diff --git a/plugins/FreeImage/Source/FreeImage/BitmapAccess.cpp b/plugins/FreeImage/Source/FreeImage/BitmapAccess.cpp
index 6355c3c293..d87658c24f 100644
--- a/plugins/FreeImage/Source/FreeImage/BitmapAccess.cpp
+++ b/plugins/FreeImage/Source/FreeImage/BitmapAccess.cpp
@@ -130,7 +130,7 @@ void* FreeImage_Aligned_Malloc(size_t amount, size_t alignment) {
That's why the code below allocates *two* alignments instead of one.
*/
void* mem_real = malloc(amount + 2 * alignment);
- if(!mem_real) return NULL;
+ if (!mem_real) return NULL;
char* mem_align = (char*)((unsigned long)(2 * alignment - (unsigned long)mem_real % (unsigned long)alignment) + (unsigned long)mem_real);
*((long*)mem_align - 1) = (long)mem_real;
return mem_align;
@@ -165,7 +165,7 @@ FreeImage_GetImageSizeHeader(BOOL header_only, unsigned width, unsigned height,
// palette is aligned on a 16 bytes boundary
dib_size += sizeof(RGBQUAD) * CalculateUsedPaletteEntries(bpp);
dib_size += (dib_size % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - dib_size % FIBITMAP_ALIGNMENT : 0);
- if(!header_only) {
+ if (!header_only) {
const size_t header_size = dib_size;
// pixels are aligned on a 16 bytes boundary
@@ -396,7 +396,7 @@ FreeImage_Unload(FIBITMAP *dib) {
FIBITMAP * DLL_CALLCONV
FreeImage_Clone(FIBITMAP *dib) {
- if(!dib) return NULL;
+ if (!dib) return NULL;
unsigned width = FreeImage_GetWidth(dib);
unsigned height = FreeImage_GetHeight(dib);
@@ -915,7 +915,7 @@ FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res) {
BITMAPINFOHEADER * DLL_CALLCONV
FreeImage_GetInfoHeader(FIBITMAP *dib) {
- if(!dib) return NULL;
+ if (!dib) return NULL;
size_t lp = (size_t)dib->data + sizeof(FREEIMAGEHEADER);
lp += (lp % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - lp % FIBITMAP_ALIGNMENT : 0);
lp += FIBITMAP_ALIGNMENT - sizeof(BITMAPINFOHEADER) % FIBITMAP_ALIGNMENT;
@@ -933,13 +933,13 @@ FreeImage_GetInfo(FIBITMAP *dib) {
FIMETADATA * DLL_CALLCONV
FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag) {
- if(!dib)
+ if (!dib)
return NULL;
// get the metadata model
METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
TAGMAP *tagmap = NULL;
- if( (*metadata).find(model) != (*metadata).end() ) {
+ if ( (*metadata).find(model) != (*metadata).end() ) {
tagmap = (*metadata)[model];
}
if(tagmap) {
@@ -976,7 +976,7 @@ FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag
BOOL DLL_CALLCONV
FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag) {
- if(!mdhandle)
+ if (!mdhandle)
return FALSE;
METADATAHEADER *mdh = (METADATAHEADER *)mdhandle->data;
@@ -1019,7 +1019,7 @@ FreeImage_FindCloseMetadata(FIMETADATA *mdhandle) {
BOOL DLL_CALLCONV
FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src) {
- if(!src || !dst) return FALSE;
+ if (!src || !dst) return FALSE;
// get metadata links
METADATAMAP *src_metadata = ((FREEIMAGEHEADER *)src->data)->metadata;
@@ -1034,7 +1034,7 @@ FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src) {
TAGMAP *src_tagmap = (*i).second;
if(src_tagmap) {
- if( dst_metadata->find(model) != dst_metadata->end() ) {
+ if ( dst_metadata->find(model) != dst_metadata->end() ) {
// destroy dst model
FreeImage_SetMetadata((FREE_IMAGE_MDMODEL)model, dst, NULL, NULL);
}
@@ -1069,7 +1069,7 @@ FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src) {
BOOL DLL_CALLCONV
FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag) {
- if(!dib)
+ if (!dib)
return FALSE;
TAGMAP *tagmap = NULL;
@@ -1083,7 +1083,7 @@ FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key,
if(key != NULL) {
- if(!tagmap) {
+ if (!tagmap) {
// this model, doesn't exist: create it
tagmap = new(std::nothrow) TAGMAP();
(*metadata)[model] = tagmap;
@@ -1158,7 +1158,7 @@ FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key,
BOOL DLL_CALLCONV
FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag) {
- if(!dib || !key || !tag)
+ if (!dib || !key || !tag)
return FALSE;
TAGMAP *tagmap = NULL;
@@ -1166,7 +1166,7 @@ FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key,
// get the metadata model
METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
- if(!(*metadata).empty()) {
+ if (!(*metadata).empty()) {
METADATAMAP::iterator model_iterator = metadata->find(model);
if (model_iterator != metadata->end() ) {
// this model exists : try to get the requested tag
@@ -1186,17 +1186,17 @@ FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key,
unsigned DLL_CALLCONV
FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib) {
- if(!dib)
+ if (!dib)
return FALSE;
TAGMAP *tagmap = NULL;
// get the metadata model
METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
- if( (*metadata).find(model) != (*metadata).end() ) {
+ if ( (*metadata).find(model) != (*metadata).end() ) {
tagmap = (*metadata)[model];
}
- if(!tagmap) {
+ if (!tagmap) {
// this model, doesn't exist: return
return 0;
}
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion.cpp b/plugins/FreeImage/Source/FreeImage/Conversion.cpp
index 04cec65ab5..3c14bab9dd 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion.cpp
@@ -145,7 +145,7 @@ _convertCMYKtoRGBA(unsigned width, unsigned height, BYTE* line_start, unsigned p
BOOL
ConvertCMYKtoRGBA(FIBITMAP* dib) {
- if(!FreeImage_HasPixels(dib)) {
+ if (!FreeImage_HasPixels(dib)) {
return FALSE;
}
@@ -294,7 +294,7 @@ _convertLABtoRGB(unsigned width, unsigned height, BYTE* line_start, unsigned pit
BOOL
ConvertLABtoRGB(FIBITMAP* dib) {
- if(!FreeImage_HasPixels(dib)) {
+ if (!FreeImage_HasPixels(dib)) {
return FALSE;
}
@@ -330,7 +330,7 @@ ConvertLABtoRGB(FIBITMAP* dib) {
FIBITMAP*
RemoveAlphaChannel(FIBITMAP* src) {
- if(!FreeImage_HasPixels(src)) {
+ if (!FreeImage_HasPixels(src)) {
return NULL;
}
@@ -367,10 +367,10 @@ FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize) {
FIBITMAP * DLL_CALLCONV
FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) {
- if( PaletteSize < 2 ) PaletteSize = 2;
- if( PaletteSize > 256 ) PaletteSize = 256;
- if( ReserveSize < 0 ) ReserveSize = 0;
- if( ReserveSize > PaletteSize ) ReserveSize = PaletteSize;
+ if ( PaletteSize < 2 ) PaletteSize = 2;
+ if ( PaletteSize > 256 ) PaletteSize = 256;
+ if ( ReserveSize < 0 ) ReserveSize = 0;
+ if ( ReserveSize > PaletteSize ) ReserveSize = PaletteSize;
if (FreeImage_HasPixels(dib)) {
if (FreeImage_GetBPP(dib) == 24) {
switch(quantize) {
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion16_555.cpp b/plugins/FreeImage/Source/FreeImage/Conversion16_555.cpp
index abaf2f1824..c0c4785704 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion16_555.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion16_555.cpp
@@ -115,7 +115,7 @@ FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels)
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo16Bits555(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
const int width = FreeImage_GetWidth(dib);
const int height = FreeImage_GetHeight(dib);
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion16_565.cpp b/plugins/FreeImage/Source/FreeImage/Conversion16_565.cpp
index eb3dd9de3f..28e8255b4e 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion16_565.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion16_565.cpp
@@ -111,7 +111,7 @@ FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels)
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo16Bits565(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
const int width = FreeImage_GetWidth(dib);
const int height = FreeImage_GetHeight(dib);
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion24.cpp b/plugins/FreeImage/Source/FreeImage/Conversion24.cpp
index e99eb5d4df..f04b946ef0 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion24.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion24.cpp
@@ -121,12 +121,12 @@ FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels) {
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo24Bits(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const unsigned bpp = FreeImage_GetBPP(dib);
const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
- if((image_type != FIT_BITMAP) && (image_type != FIT_RGB16)) {
+ if ((image_type != FIT_BITMAP) && (image_type != FIT_RGB16)) {
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion32.cpp b/plugins/FreeImage/Source/FreeImage/Conversion32.cpp
index b8bd518471..fad74671cd 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion32.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion32.cpp
@@ -186,12 +186,12 @@ FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo32Bits(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const int bpp = FreeImage_GetBPP(dib);
const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
- if((image_type != FIT_BITMAP) && (image_type != FIT_RGB16) && (image_type != FIT_RGBA16)) {
+ if ((image_type != FIT_BITMAP) && (image_type != FIT_RGB16) && (image_type != FIT_RGBA16)) {
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion4.cpp b/plugins/FreeImage/Source/FreeImage/Conversion4.cpp
index 13048b6d3f..7c09ac824a 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion4.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion4.cpp
@@ -29,7 +29,7 @@
void DLL_CALLCONV
FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) {
BOOL hinibble = TRUE;
- for (int cols = 0; cols < width_in_pixels; cols++){
+ for (int cols = 0; cols < width_in_pixels; cols++) {
if (hinibble == TRUE){
target[cols >> 1] = ((source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 15 : 0) << 4;
}
@@ -46,7 +46,7 @@ FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQU
BOOL hinibble = TRUE;
BYTE index;
- for (int cols = 0; cols < width_in_pixels; cols++){
+ for (int cols = 0; cols < width_in_pixels; cols++) {
index = GREY(palette[source[cols]].rgbRed, palette[source[cols]].rgbGreen, palette[source[cols]].rgbBlue);
if (hinibble) {
target[cols >> 1] = (index & 0xF0);
@@ -140,7 +140,7 @@ FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels) {
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo4Bits(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const int bpp = FreeImage_GetBPP(dib);
diff --git a/plugins/FreeImage/Source/FreeImage/Conversion8.cpp b/plugins/FreeImage/Source/FreeImage/Conversion8.cpp
index 05e3944394..2eaeb94671 100644
--- a/plugins/FreeImage/Source/FreeImage/Conversion8.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Conversion8.cpp
@@ -101,12 +101,12 @@ FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels) {
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertTo8Bits(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const int bpp = FreeImage_GetBPP(dib);
const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
- if((image_type != FIT_BITMAP) && (image_type != FIT_UINT16)) {
+ if ((image_type != FIT_BITMAP) && (image_type != FIT_UINT16)) {
return NULL;
}
@@ -250,12 +250,12 @@ FreeImage_ConvertTo8Bits(FIBITMAP *dib) {
FIBITMAP * DLL_CALLCONV
FreeImage_ConvertToGreyscale(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
const int bpp = FreeImage_GetBPP(dib);
- if((color_type == FIC_PALETTE) || (color_type == FIC_MINISWHITE)) {
+ if ((color_type == FIC_PALETTE) || (color_type == FIC_MINISWHITE)) {
const int width = FreeImage_GetWidth(dib);
const int height = FreeImage_GetHeight(dib);
FIBITMAP *new_dib = FreeImage_Allocate(width, height, 8);
diff --git a/plugins/FreeImage/Source/FreeImage/ConversionFloat.cpp b/plugins/FreeImage/Source/FreeImage/ConversionFloat.cpp
index e72d14cb83..181ff396e1 100644
--- a/plugins/FreeImage/Source/FreeImage/ConversionFloat.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ConversionFloat.cpp
@@ -31,7 +31,7 @@ FreeImage_ConvertToFloat(FIBITMAP *dib) {
FIBITMAP *src = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib);
@@ -40,11 +40,11 @@ FreeImage_ConvertToFloat(FIBITMAP *dib) {
case FIT_BITMAP:
{
// allow conversion from 8-bit
- if((FreeImage_GetBPP(dib) == 8) && (FreeImage_GetColorType(dib) == FIC_MINISBLACK)) {
+ if ((FreeImage_GetBPP(dib) == 8) && (FreeImage_GetColorType(dib) == FIC_MINISBLACK)) {
src = dib;
} else {
src = FreeImage_ConvertToGreyscale(dib);
- if(!src) return NULL;
+ if (!src) return NULL;
}
break;
}
@@ -68,7 +68,7 @@ FreeImage_ConvertToFloat(FIBITMAP *dib) {
const unsigned height = FreeImage_GetHeight(src);
dst = FreeImage_AllocateT(FIT_FLOAT, width, height);
- if(!dst) {
+ if (!dst) {
if(src != dib) {
FreeImage_Unload(src);
}
diff --git a/plugins/FreeImage/Source/FreeImage/ConversionRGB16.cpp b/plugins/FreeImage/Source/FreeImage/ConversionRGB16.cpp
index bd38504a1e..6b9d17fbed 100644
--- a/plugins/FreeImage/Source/FreeImage/ConversionRGB16.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ConversionRGB16.cpp
@@ -31,7 +31,7 @@ FreeImage_ConvertToRGB16(FIBITMAP *dib) {
FIBITMAP *src = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib);
@@ -40,11 +40,11 @@ FreeImage_ConvertToRGB16(FIBITMAP *dib) {
case FIT_BITMAP:
{
// convert to 24-bit if needed
- if((FreeImage_GetBPP(dib) == 24) || (FreeImage_GetBPP(dib) == 32)) {
+ if ((FreeImage_GetBPP(dib) == 24) || (FreeImage_GetBPP(dib) == 32)) {
src = dib;
} else {
src = FreeImage_ConvertTo24Bits(dib);
- if(!src) return NULL;
+ if (!src) return NULL;
}
break;
}
@@ -70,7 +70,7 @@ FreeImage_ConvertToRGB16(FIBITMAP *dib) {
const unsigned height = FreeImage_GetHeight(src);
dst = FreeImage_AllocateT(FIT_RGB16, width, height);
- if(!dst) {
+ if (!dst) {
if(src != dib) {
FreeImage_Unload(src);
}
diff --git a/plugins/FreeImage/Source/FreeImage/ConversionRGBF.cpp b/plugins/FreeImage/Source/FreeImage/ConversionRGBF.cpp
index b5161d566d..6b8739532f 100644
--- a/plugins/FreeImage/Source/FreeImage/ConversionRGBF.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ConversionRGBF.cpp
@@ -31,7 +31,7 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) {
FIBITMAP *src = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib);
@@ -41,9 +41,9 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) {
{
// allow conversion from 24- and 32-bit
const FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
- if((color_type != FIC_RGB) && (color_type != FIC_RGBALPHA)) {
+ if ((color_type != FIC_RGB) && (color_type != FIC_RGBALPHA)) {
src = FreeImage_ConvertTo24Bits(dib);
- if(!src) return NULL;
+ if (!src) return NULL;
} else {
src = dib;
}
@@ -83,7 +83,7 @@ FreeImage_ConvertToRGBF(FIBITMAP *dib) {
const unsigned height = FreeImage_GetHeight(src);
dst = FreeImage_AllocateT(FIT_RGBF, width, height);
- if(!dst) {
+ if (!dst) {
if(src != dib) {
FreeImage_Unload(src);
}
diff --git a/plugins/FreeImage/Source/FreeImage/ConversionType.cpp b/plugins/FreeImage/Source/FreeImage/ConversionType.cpp
index b537f72814..23528b60fe 100644
--- a/plugins/FreeImage/Source/FreeImage/ConversionType.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ConversionType.cpp
@@ -47,7 +47,7 @@ CONVERT_TYPE<Tdst, Tsrc>::convert(FIBITMAP *src, FREE_IMAGE_TYPE dst_type) {
dst = FreeImage_AllocateT(dst_type, width, height, bpp,
FreeImage_GetRedMask(src), FreeImage_GetGreenMask(src), FreeImage_GetBlueMask(src));
- if(!dst) return NULL;
+ if (!dst) return NULL;
// convert from src_type to dst_type
@@ -86,7 +86,7 @@ CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) {
// allocate a 8-bit dib
dst = FreeImage_AllocateT(FIT_BITMAP, width, height, 8, 0, 0, 0);
- if(!dst) return NULL;
+ if (!dst) return NULL;
// build a greyscale palette
RGBQUAD *pal = FreeImage_GetPalette(dst);
@@ -160,7 +160,7 @@ CONVERT_TO_COMPLEX<Tsrc>::convert(FIBITMAP *src) {
// allocate dst image
dst = FreeImage_AllocateT(FIT_COMPLEX, width, height);
- if(!dst) return NULL;
+ if (!dst) return NULL;
// convert from src_type to FIT_COMPLEX
@@ -236,7 +236,7 @@ FIBITMAP* DLL_CALLCONV
FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear) {
FIBITMAP *dst = NULL;
- if(!src) return NULL;
+ if (!src) return NULL;
// convert from src_type to FIT_BITMAP
@@ -306,7 +306,7 @@ FIBITMAP* DLL_CALLCONV
FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear) {
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(src)) return NULL;
+ if (!FreeImage_HasPixels(src)) return NULL;
// convert from src_type to dst_type
diff --git a/plugins/FreeImage/Source/FreeImage/ConversionUINT16.cpp b/plugins/FreeImage/Source/FreeImage/ConversionUINT16.cpp
index ed4691f3a2..3744cfe3b4 100644
--- a/plugins/FreeImage/Source/FreeImage/ConversionUINT16.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ConversionUINT16.cpp
@@ -31,7 +31,7 @@ FreeImage_ConvertToUINT16(FIBITMAP *dib) {
FIBITMAP *src = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib);
@@ -40,11 +40,11 @@ FreeImage_ConvertToUINT16(FIBITMAP *dib) {
case FIT_BITMAP:
{
// convert to greyscale if needed
- if((FreeImage_GetBPP(dib) == 8) && (FreeImage_GetColorType(dib) == FIC_MINISBLACK)) {
+ if ((FreeImage_GetBPP(dib) == 8) && (FreeImage_GetColorType(dib) == FIC_MINISBLACK)) {
src = dib;
} else {
src = FreeImage_ConvertToGreyscale(dib);
- if(!src) return NULL;
+ if (!src) return NULL;
}
break;
}
@@ -70,7 +70,7 @@ FreeImage_ConvertToUINT16(FIBITMAP *dib) {
const unsigned height = FreeImage_GetHeight(src);
dst = FreeImage_AllocateT(FIT_UINT16, width, height);
- if(!dst) {
+ if (!dst) {
if(src != dib) {
FreeImage_Unload(src);
}
diff --git a/plugins/FreeImage/Source/FreeImage/FreeImageIO.cpp b/plugins/FreeImage/Source/FreeImage/FreeImageIO.cpp
index f8cf7604eb..b289530be7 100644
--- a/plugins/FreeImage/Source/FreeImage/FreeImageIO.cpp
+++ b/plugins/FreeImage/Source/FreeImage/FreeImageIO.cpp
@@ -69,7 +69,7 @@ _MemoryReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
for(x = 0; x < count; x++) {
//if there isnt size bytes left to read, set pos to eof and return a short count
- if( (mem_header->filelen - mem_header->curpos) < (long)size ) {
+ if ( (mem_header->filelen - mem_header->curpos) < (long)size ) {
mem_header->curpos = mem_header->filelen;
break;
}
@@ -91,13 +91,13 @@ _MemoryWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle)
//double the data block size if we need to
while( (mem_header->curpos + (long)(size*count)) >= mem_header->datalen ) {
//if we are at or above 1G, we cant double without going negative
- if( mem_header->datalen & 0x40000000 ) {
+ if ( mem_header->datalen & 0x40000000 ) {
//max 2G
- if( mem_header->datalen == 0x7FFFFFFF ) {
+ if ( mem_header->datalen == 0x7FFFFFFF ) {
return 0;
}
newdatalen = 0x7FFFFFFF;
- } else if( mem_header->datalen == 0 ) {
+ } else if ( mem_header->datalen == 0 ) {
//default to 4K if nothing yet
newdatalen = 4096;
} else {
@@ -105,7 +105,7 @@ _MemoryWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle)
newdatalen = mem_header->datalen << 1;
}
newdata = realloc( mem_header->data, newdatalen );
- if( !newdata ) {
+ if ( !newdata ) {
return 0;
}
mem_header->data = newdata;
@@ -113,7 +113,7 @@ _MemoryWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle)
}
memcpy( (char *)mem_header->data + mem_header->curpos, buffer, size*count );
mem_header->curpos += size*count;
- if( mem_header->curpos > mem_header->filelen ) {
+ if ( mem_header->curpos > mem_header->filelen ) {
mem_header->filelen = mem_header->curpos;
}
return count;
@@ -126,21 +126,21 @@ _MemorySeekProc(fi_handle handle, long offset, int origin) {
switch(origin) { //0 to filelen-1 are 'inside' the file
default:
case SEEK_SET: //can fseek() to 0-7FFFFFFF always
- if( offset >= 0 ) {
+ if ( offset >= 0 ) {
mem_header->curpos = offset;
return 0;
}
break;
case SEEK_CUR:
- if( mem_header->curpos + offset >= 0 ) {
+ if ( mem_header->curpos + offset >= 0 ) {
mem_header->curpos += offset;
return 0;
}
break;
case SEEK_END:
- if( mem_header->filelen + offset >= 0 ) {
+ if ( mem_header->filelen + offset >= 0 ) {
mem_header->curpos = mem_header->filelen + offset;
return 0;
}
diff --git a/plugins/FreeImage/Source/FreeImage/Halftoning.cpp b/plugins/FreeImage/Source/FreeImage/Halftoning.cpp
index 313cc26e15..82df9b607b 100644
--- a/plugins/FreeImage/Source/FreeImage/Halftoning.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Halftoning.cpp
@@ -312,7 +312,7 @@ FIBITMAP * DLL_CALLCONV
FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) {
FIBITMAP *input = NULL, *dib8 = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const unsigned bpp = FreeImage_GetBPP(dib);
@@ -401,7 +401,7 @@ FIBITMAP * DLL_CALLCONV
FreeImage_Threshold(FIBITMAP *dib, BYTE T) {
FIBITMAP *dib8 = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
const unsigned bpp = FreeImage_GetBPP(dib);
diff --git a/plugins/FreeImage/Source/FreeImage/J2KHelper.cpp b/plugins/FreeImage/Source/FreeImage/J2KHelper.cpp
index d0abd793eb..44b210aca0 100644
--- a/plugins/FreeImage/Source/FreeImage/J2KHelper.cpp
+++ b/plugins/FreeImage/Source/FreeImage/J2KHelper.cpp
@@ -57,7 +57,7 @@ FIBITMAP* J2KImageToFIBITMAP(int format_id, const opj_image_t *image) {
BOOL bIsValid = TRUE;
for(int c = 0; c < numcomps - 1; c++) {
- if( (image->comps[c].dx == image->comps[c+1].dx) &&
+ if ( (image->comps[c].dx == image->comps[c+1].dx) &&
(image->comps[c].dy == image->comps[c+1].dy) &&
(image->comps[c].prec == image->comps[c+1].prec) ) {
continue;
@@ -67,7 +67,7 @@ FIBITMAP* J2KImageToFIBITMAP(int format_id, const opj_image_t *image) {
}
}
bIsValid &= ((numcomps == 1) || (numcomps == 3) || (numcomps == 4));
- if(!bIsValid) {
+ if (!bIsValid) {
if(numcomps) {
FreeImage_OutputMessageProc(format_id, "Warning: image contains %d greyscale components. Only the first will be loaded.\n", numcomps);
numcomps = 1;
@@ -106,7 +106,7 @@ FIBITMAP* J2KImageToFIBITMAP(int format_id, const opj_image_t *image) {
} else {
throw FI_MSG_ERROR_UNSUPPORTED_FORMAT;
}
- if(!dib) {
+ if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
@@ -398,7 +398,7 @@ opj_image_t* FIBITMAPToJ2KImage(int format_id, FIBITMAP *dib, const opj_cparamet
}
// create the image
image = opj_image_create(numcomps, &cmptparm[0], color_space);
- if(!image) {
+ if (!image) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
diff --git a/plugins/FreeImage/Source/FreeImage/MultiPage.cpp b/plugins/FreeImage/Source/FreeImage/MultiPage.cpp
index 8eaa0aa1f4..e5bcee3ded 100644
--- a/plugins/FreeImage/Source/FreeImage/MultiPage.cpp
+++ b/plugins/FreeImage/Source/FreeImage/MultiPage.cpp
@@ -328,7 +328,7 @@ FreeImage_OpenMultiBitmapU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, BOOL
// convert to single character - no national chars in extensions
char *extension = (char *)malloc(wcslen(filename)+1);
unsigned int i=0;
- for(; i < wcslen(filename); i++) // convert 16-bit to 8-bit
+ for (; i < wcslen(filename); i++) // convert 16-bit to 8-bit
extension[i] = (char)(filename[i] & 0x00FF);
// set terminating 0
extension[i]=0;
@@ -400,7 +400,7 @@ FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_h
BOOL DLL_CALLCONV
FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FreeImageIO *io, fi_handle handle, int flags) {
- if(!bitmap || !bitmap->data || !io || !handle) {
+ if (!bitmap || !bitmap->data || !io || !handle) {
return FALSE;
}
@@ -546,7 +546,7 @@ FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags) {
if (success) {
remove(header->m_filename);
success = (rename(spool_name.c_str(), header->m_filename) == 0) ? TRUE:FALSE;
- if(!success) {
+ if (!success) {
FreeImage_OutputMessageProc(header->fif, "Failed to rename %s to %s", spool_name.c_str(), header->m_filename);
}
} else {
@@ -647,12 +647,12 @@ FreeImage_SavePageToBlock(MULTIBITMAPHEADER *header, FIBITMAP *data) {
FIMEMORY *hmem = FreeImage_OpenMemory();
if(hmem==NULL) return NULL;
// save the file to memory
- if(!FreeImage_SaveToMemory(header->cache_fif, data, hmem, 0)) {
+ if (!FreeImage_SaveToMemory(header->cache_fif, data, hmem, 0)) {
FreeImage_CloseMemory(hmem);
return NULL;
}
// get the buffer from the memory stream
- if(!FreeImage_AcquireMemory(hmem, &compressed_data, &compressed_size)) {
+ if (!FreeImage_AcquireMemory(hmem, &compressed_data, &compressed_size)) {
FreeImage_CloseMemory(hmem);
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImage/NNQuantizer.cpp b/plugins/FreeImage/Source/FreeImage/NNQuantizer.cpp
index f907c41d55..6eb9aeaf48 100644
--- a/plugins/FreeImage/Source/FreeImage/NNQuantizer.cpp
+++ b/plugins/FreeImage/Source/FreeImage/NNQuantizer.cpp
@@ -60,7 +60,7 @@ NNQuantizer::NNQuantizer(int PaletteSize)
freq = (int *)malloc(netsize * sizeof(int));
radpower = (int *)malloc(initrad * sizeof(int));
- if( !network || !bias || !freq || !radpower ) {
+ if ( !network || !bias || !freq || !radpower ) {
if(network) free(network);
if(bias) free(bias);
if(freq) free(freq);
@@ -455,7 +455,7 @@ FIBITMAP* NNQuantizer::Quantize(FIBITMAP *dib, int ReserveSize, RGBQUAD *Reserve
// 3) Initialize the network and apply the learning algorithm
- if( netsize > ReserveSize ) {
+ if ( netsize > ReserveSize ) {
netsize -= ReserveSize;
initnet();
learn(sampling);
diff --git a/plugins/FreeImage/Source/FreeImage/PSDParser.cpp b/plugins/FreeImage/Source/FreeImage/PSDParser.cpp
index 57c703a06f..93573d01c0 100644
--- a/plugins/FreeImage/Source/FreeImage/PSDParser.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PSDParser.cpp
@@ -72,7 +72,7 @@ bool psdHeaderInfo::Read(FreeImageIO *io, fi_handle handle) {
psdHeader header;
const int n = (int)io->read_proc(&header, sizeof(header), 1, handle);
- if(!n) {
+ if (!n) {
return false;
}
@@ -282,7 +282,7 @@ int psdDisplayInfo::Read(FreeImageIO *io, fi_handle handle) {
n = (int)io->read_proc(&ShortValue, sizeof(ShortValue), 1, handle);
nBytes += n * sizeof(ShortValue);
_Opacity = (short)psdGetValue(ShortValue, sizeof(_Opacity) );
- if((_Opacity < 0) || (_Opacity > 100)) {
+ if ((_Opacity < 0) || (_Opacity > 100)) {
throw "Invalid DisplayInfo::Opacity value";
}
@@ -418,7 +418,7 @@ BOOL invertColor(FIBITMAP* dib) {
FREE_IMAGE_TYPE type = FreeImage_GetImageType(dib);
const unsigned Bpp = FreeImage_GetBPP(dib)/8;
- if((type == FIT_BITMAP && Bpp == 4) || type == FIT_RGBA16) {
+ if ((type == FIT_BITMAP && Bpp == 4) || type == FIT_RGBA16) {
const unsigned width = FreeImage_GetWidth(dib);
const unsigned height = FreeImage_GetHeight(dib);
BYTE *line_start = FreeImage_GetScanLine(dib, 0);
@@ -508,7 +508,7 @@ bool psdParser::ReadImageResources(FreeImageIO *io, fi_handle handle, LONG lengt
n = (int)io->read_proc(&oResource._OSType, sizeof(oResource._OSType), 1, handle);
nBytes += n * sizeof(oResource._OSType);
- if( (nBytes % 2) != 0 ) {
+ if ( (nBytes % 2) != 0 ) {
return false;
}
@@ -653,7 +653,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
SwapShort(&nCompression);
#endif
- if((nCompression != PSDP_COMPRESSION_NONE && nCompression != PSDP_COMPRESSION_RLE)) {
+ if ((nCompression != PSDP_COMPRESSION_NONE && nCompression != PSDP_COMPRESSION_RLE)) {
FreeImage_OutputMessageProc(_fi_format_id, "Unsupported compression %d", nCompression);
return NULL;
}
@@ -730,7 +730,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
throw "Unsupported color mode";
break;
}
- if(!bitmap) {
+ if (!bitmap) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
@@ -797,7 +797,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
// later use this array as WORD rleLineSizeList[nChannels][nHeight];
WORD *rleLineSizeList = new (std::nothrow) WORD[nChannels*nHeight];
- if(!rleLineSizeList) {
+ if (!rleLineSizeList) {
FreeImage_Unload(bitmap);
SAFE_DELETE_ARRAY(line_start);
throw std::bad_alloc();
@@ -820,7 +820,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
}
BYTE* rle_line_start = new (std::nothrow) BYTE[largestRLELine];
- if(!rle_line_start) {
+ if (!rle_line_start) {
FreeImage_Unload(bitmap);
SAFE_DELETE_ARRAY(line_start);
SAFE_DELETE_ARRAY(rleLineSizeList);
@@ -924,7 +924,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
// --- Further process the bitmap ---
- if((mode == PSDP_CMYK || mode == PSDP_MULTICHANNEL)) {
+ if ((mode == PSDP_CMYK || mode == PSDP_MULTICHANNEL)) {
// CMYK values are "inverted", invert them back
if(mode == PSDP_MULTICHANNEL) {
@@ -933,7 +933,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
FreeImage_Invert(bitmap);
}
- if((_fi_flags & PSD_CMYK) == PSD_CMYK) {
+ if ((_fi_flags & PSD_CMYK) == PSD_CMYK) {
// keep as CMYK
if(mode == PSDP_MULTICHANNEL) {
@@ -971,7 +971,7 @@ FIBITMAP* psdParser::ReadImageData(FreeImageIO *io, fi_handle handle) {
CREATE_GREYSCALE_PALETTE_REVERSE(FreeImage_GetPalette(bitmap), 2);
}
else if(mode == PSDP_INDEXED) {
- if(!_colourModeData._plColourData || _colourModeData._Length != 768 || _ColourCount < 0) {
+ if (!_colourModeData._plColourData || _colourModeData._Length != 768 || _ColourCount < 0) {
FreeImage_OutputMessageProc(_fi_format_id, "Indexed image has no palette. Using the default grayscale one.");
} else {
_colourModeData.FillPalette(bitmap);
@@ -1037,7 +1037,7 @@ FIBITMAP* psdParser::Load(FreeImageIO *io, fi_handle handle, int s_format_id, in
FreeImage_CreateICCProfile(Bitmap, _iccProfile._ProfileData, _iccProfile._ProfileSize);
if ((flags & PSD_CMYK) == PSD_CMYK) {
short mode = _headerInfo._ColourMode;
- if((mode == PSDP_CMYK) || (mode == PSDP_MULTICHANNEL)) {
+ if ((mode == PSDP_CMYK) || (mode == PSDP_MULTICHANNEL)) {
FreeImage_GetICCProfile(Bitmap)->flags |= FIICC_COLOR_IS_CMYK;
}
}
diff --git a/plugins/FreeImage/Source/FreeImage/PixelAccess.cpp b/plugins/FreeImage/Source/FreeImage/PixelAccess.cpp
index edee36584a..158f9997b2 100644
--- a/plugins/FreeImage/Source/FreeImage/PixelAccess.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PixelAccess.cpp
@@ -29,7 +29,7 @@
BYTE * DLL_CALLCONV
FreeImage_GetBits(FIBITMAP *dib) {
- if(!FreeImage_HasPixels(dib)) {
+ if (!FreeImage_HasPixels(dib)) {
return NULL;
}
// returns the pixels aligned on a FIBITMAP_ALIGNMENT bytes alignment boundary
@@ -41,7 +41,7 @@ FreeImage_GetBits(FIBITMAP *dib) {
BYTE * DLL_CALLCONV
FreeImage_GetScanLine(FIBITMAP *dib, int scanline) {
- if(!FreeImage_HasPixels(dib)) {
+ if (!FreeImage_HasPixels(dib)) {
return NULL;
}
return CalculateScanLine(FreeImage_GetBits(dib), FreeImage_GetPitch(dib), scanline);
@@ -51,10 +51,10 @@ BOOL DLL_CALLCONV
FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) {
BYTE shift;
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
return FALSE;
- if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
+ if ((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
switch(FreeImage_GetBPP(dib)) {
@@ -80,10 +80,10 @@ FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) {
BOOL DLL_CALLCONV
FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) {
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
return FALSE;
- if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
+ if ((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
switch(FreeImage_GetBPP(dib)) {
@@ -91,7 +91,7 @@ FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) {
{
bits += 2*x;
WORD *pixel = (WORD *)bits;
- if((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+ if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
value->rgbBlue = (BYTE)((((*pixel & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F);
value->rgbGreen = (BYTE)((((*pixel & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F);
value->rgbRed = (BYTE)((((*pixel & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F);
@@ -132,10 +132,10 @@ BOOL DLL_CALLCONV
FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) {
BYTE shift;
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
return FALSE;
- if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
+ if ((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
switch(FreeImage_GetBPP(dib)) {
@@ -162,10 +162,10 @@ FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value) {
BOOL DLL_CALLCONV
FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) {
- if(!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
+ if (!FreeImage_HasPixels(dib) || (FreeImage_GetImageType(dib) != FIT_BITMAP))
return FALSE;
- if((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
+ if ((x < FreeImage_GetWidth(dib)) && (y < FreeImage_GetHeight(dib))) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
switch(FreeImage_GetBPP(dib)) {
@@ -173,7 +173,7 @@ FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value) {
{
bits += 2*x;
WORD *pixel = (WORD *)bits;
- if((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+ if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
*pixel = ((value->rgbBlue >> 3) << FI16_565_BLUE_SHIFT) |
((value->rgbGreen >> 2) << FI16_565_GREEN_SHIFT) |
((value->rgbRed >> 3) << FI16_565_RED_SHIFT);
diff --git a/plugins/FreeImage/Source/FreeImage/Plugin.cpp b/plugins/FreeImage/Source/FreeImage/Plugin.cpp
index bdc0e0f8a2..ce2863a72e 100644
--- a/plugins/FreeImage/Source/FreeImage/Plugin.cpp
+++ b/plugins/FreeImage/Source/FreeImage/Plugin.cpp
@@ -712,7 +712,7 @@ FreeImage_GetFIFFromFilenameU(const wchar_t *filename) {
// convert to single character - no national chars in extensions
char *extension = (char *)malloc(wcslen(place)+1);
unsigned int i=0;
- for(; i < wcslen(place); i++) // convert 16-bit to 8-bit
+ for (; i < wcslen(place); i++) // convert 16-bit to 8-bit
extension[i] = (char)(place[i] & 0x00FF);
// set terminating 0
extension[i]=0;
diff --git a/plugins/FreeImage/Source/FreeImage/PluginBMP.cpp b/plugins/FreeImage/Source/FreeImage/PluginBMP.cpp
index 4041d859fa..2d8d6e0b4a 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginBMP.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginBMP.cpp
@@ -213,7 +213,7 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI
height = abs(height);
pixels = (BYTE*)malloc(width * height * sizeof(BYTE));
- if(!pixels) throw(1);
+ if (!pixels) throw(1);
memset(pixels, 0, width * height * sizeof(BYTE));
BYTE *q = pixels;
@@ -313,7 +313,7 @@ LoadPixelDataRLE4(FreeImageIO *io, fi_handle handle, int width, int height, FIBI
BOOL hinibble = TRUE;
- for (int cols = 0; cols < width; cols++){
+ for (int cols = 0; cols < width; cols++) {
if (hinibble) {
dst[cols >> 1] = (src[cols] << 4);
} else {
@@ -352,7 +352,7 @@ LoadPixelDataRLE8(FreeImageIO *io, fi_handle handle, int width, int height, FIBI
int bits = 0;
for (;;) {
- if( io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) {
+ if ( io->read_proc(&status_byte, sizeof(BYTE), 1, handle) != 1) {
return FALSE;
}
@@ -520,7 +520,7 @@ LoadWindowsBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bit
switch (compression) {
case BI_RGB :
- if( LoadPixelData(io, handle, dib, height, pitch, bit_count) ) {
+ if ( LoadPixelData(io, handle, dib, height, pitch, bit_count) ) {
return dib;
} else {
throw "Error encountered while decoding BMP data";
@@ -528,7 +528,7 @@ LoadWindowsBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bit
break;
case BI_RLE4 :
- if( LoadPixelDataRLE4(io, handle, width, height, dib) ) {
+ if ( LoadPixelDataRLE4(io, handle, width, height, dib) ) {
return dib;
} else {
throw "Error encountered while decoding RLE4 BMP data";
@@ -536,7 +536,7 @@ LoadWindowsBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bit
break;
case BI_RLE8 :
- if( LoadPixelDataRLE8(io, handle, width, height, dib) ) {
+ if ( LoadPixelDataRLE8(io, handle, width, height, dib) ) {
return dib;
} else {
throw "Error encountered while decoding RLE8 BMP data";
@@ -597,7 +597,7 @@ LoadWindowsBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bit
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, bitfields[0], bitfields[1], bitfields[2]);
} else {
- if( bit_count == 32 ) {
+ if ( bit_count == 32 ) {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
@@ -747,7 +747,7 @@ LoadOS22XBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bits_
return dib;
case BI_RLE4 :
- if( LoadPixelDataRLE4(io, handle, width, height, dib) ) {
+ if ( LoadPixelDataRLE4(io, handle, width, height, dib) ) {
return dib;
} else {
throw "Error encountered while decoding RLE4 BMP data";
@@ -755,7 +755,7 @@ LoadOS22XBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bits_
break;
case BI_RLE8 :
- if( LoadPixelDataRLE8(io, handle, width, height, dib) ) {
+ if ( LoadPixelDataRLE8(io, handle, width, height, dib) ) {
return dib;
} else {
throw "Error encountered while decoding RLE8 BMP data";
@@ -805,7 +805,7 @@ LoadOS22XBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bits_
case 24 :
case 32 :
{
- if( bit_count == 32 ) {
+ if ( bit_count == 32 ) {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
@@ -951,7 +951,7 @@ LoadOS21XBMP(FreeImageIO *io, fi_handle handle, int flags, unsigned bitmap_bits_
case 24 :
case 32 :
{
- if( bit_count == 32 ) {
+ if ( bit_count == 32 ) {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
dib = FreeImage_AllocateHeader(header_only, width, height, bit_count, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
@@ -1082,7 +1082,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// check the signature
- if((bitmapfileheader.bfType != 0x4D42) && (bitmapfileheader.bfType != 0x4142)) {
+ if ((bitmapfileheader.bfType != 0x4D42) && (bitmapfileheader.bfType != 0x4142)) {
FreeImage_OutputMessageProc(s_format_id, FI_MSG_ERROR_MAGIC_NUMBER);
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginCUT.cpp b/plugins/FreeImage/Source/FreeImage/PluginCUT.cpp
index 5dcd16b84f..746fa034a6 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginCUT.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginCUT.cpp
@@ -105,7 +105,7 @@ static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FIBITMAP *dib = NULL;
- if(!handle) {
+ if (!handle) {
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginDDS.cpp b/plugins/FreeImage/Source/FreeImage/PluginDDS.cpp
index 4e2d1d8fa2..0a1667d7f1 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginDDS.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginDDS.cpp
@@ -444,7 +444,7 @@ LoadDXT_Helper (FreeImageIO *io, fi_handle handle, int page, int flags, void *da
typedef typename INFO::Block Block;
Block *input_buffer = new(std::nothrow) Block[(width + 3) / 4];
- if(!input_buffer) return;
+ if (!input_buffer) return;
int widthRest = (int) width & 3;
int heightRest = (int) height & 3;
diff --git a/plugins/FreeImage/Source/FreeImage/PluginEXR.cpp b/plugins/FreeImage/Source/FreeImage/PluginEXR.cpp
index 4a19b8b56f..b9963a11b2 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginEXR.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginEXR.cpp
@@ -96,7 +96,7 @@ C_IStream::seekg (Imf::Int64 pos) {
void
C_OStream::write (const char c[/*n*/], int n) {
- if((unsigned)n != _io->write_proc((void*)&c[0], 1, n, _handle)) {
+ if ((unsigned)n != _io->write_proc((void*)&c[0], 1, n, _handle)) {
Iex::throwErrnoExc();
}
}
@@ -178,7 +178,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
bool bUseRgbaInterface = false;
FIBITMAP *dib = NULL;
- if(!handle) {
+ if (!handle) {
return NULL;
}
@@ -242,7 +242,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
bHandled = true;
}
}
- if(!bHandled) {
+ if (!bHandled) {
THROW (Iex::InputExc, "Unable to handle mixed component types (color model = " << exr_color_model << ")");
}
}
@@ -260,9 +260,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// check for supported image color models
// --------------------------------------------------------------
- if((components == 1) || (components == 2)) {
+ if ((components == 1) || (components == 2)) {
// if the image is gray-alpha (YA), ignore the alpha channel
- if((components == 1) && channels.findChannel("Y")) {
+ if ((components == 1) && channels.findChannel("Y")) {
image_type = FIT_FLOAT;
components = 1;
} else {
@@ -307,7 +307,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// allocate a new dib
dib = FreeImage_AllocateHeaderT(header_only, image_type, width, height, 0);
- if(!dib) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
+ if (!dib) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
// try to load the preview image
// --------------------------------------------------------------
@@ -410,7 +410,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
pitch, // yStride
1, 1, // x/y sampling
0.0)); // fillValue
- } else if((components == 3) || (components == 4)) {
+ } else if ((components == 3) || (components == 4)) {
const char *channel_name[4] = { "R", "G", "B", "A" };
for(int c = 0; c < components; c++) {
@@ -450,12 +450,12 @@ Set the preview image using the dib embedded thumbnail
*/
static BOOL
SetPreviewImage(FIBITMAP *dib, Imf::Header& header) {
- if(!FreeImage_GetThumbnail(dib)) {
+ if (!FreeImage_GetThumbnail(dib)) {
return FALSE;
}
FIBITMAP* thumbnail = FreeImage_GetThumbnail(dib);
- if((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 32)) {
+ if ((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 32)) {
// invalid thumbnail - ignore it
FreeImage_OutputMessageProc(s_format_id, FI_MSG_WARNING_INVALID_THUMBNAIL);
} else {
@@ -560,16 +560,16 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
BOOL bIsFlipped = FALSE;
half *halfData = NULL;
- if(!dib || !handle) return FALSE;
+ if (!dib || !handle) return FALSE;
try {
// check for EXR_LC compression and verify that the format is RGB
- if((flags & EXR_LC) == EXR_LC) {
+ if ((flags & EXR_LC) == EXR_LC) {
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
- if(((image_type != FIT_RGBF) && (image_type != FIT_RGBAF)) || ((flags & EXR_FLOAT) == EXR_FLOAT)) {
+ if (((image_type != FIT_RGBF) && (image_type != FIT_RGBAF)) || ((flags & EXR_FLOAT) == EXR_FLOAT)) {
THROW (Iex::IoExc, "EXR_LC compression is only available with RGB[A]F images");
}
- if((FreeImage_GetWidth(dib) % 2) || (FreeImage_GetHeight(dib) % 2)) {
+ if ((FreeImage_GetWidth(dib) % 2) || (FreeImage_GetHeight(dib) % 2)) {
THROW (Iex::IoExc, "EXR_LC compression only works when the width and height are a multiple of 2");
}
}
@@ -579,19 +579,19 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
// compression
Imf::Compression compress;
- if((flags & EXR_NONE) == EXR_NONE) {
+ if ((flags & EXR_NONE) == EXR_NONE) {
// no compression
compress = Imf::NO_COMPRESSION;
- } else if((flags & EXR_ZIP) == EXR_ZIP) {
+ } else if ((flags & EXR_ZIP) == EXR_ZIP) {
// zlib compression, in blocks of 16 scan lines
compress = Imf::ZIP_COMPRESSION;
- } else if((flags & EXR_PIZ) == EXR_PIZ) {
+ } else if ((flags & EXR_PIZ) == EXR_PIZ) {
// piz-based wavelet compression
compress = Imf::PIZ_COMPRESSION;
- } else if((flags & EXR_PXR24) == EXR_PXR24) {
+ } else if ((flags & EXR_PXR24) == EXR_PXR24) {
// lossy 24-bit float compression
compress = Imf::PXR24_COMPRESSION;
- } else if((flags & EXR_B44) == EXR_B44) {
+ } else if ((flags & EXR_B44) == EXR_B44) {
// lossy 44% float compression
compress = Imf::B44_COMPRESSION;
} else {
@@ -615,13 +615,13 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
SetPreviewImage(dib, header);
// check for EXR_LC compression
- if((flags & EXR_LC) == EXR_LC) {
+ if ((flags & EXR_LC) == EXR_LC) {
return SaveAsEXR_LC(ostream, dib, header, width, height);
}
// output pixel type
Imf::PixelType pixelType;
- if((flags & EXR_FLOAT) == EXR_FLOAT) {
+ if ((flags & EXR_FLOAT) == EXR_FLOAT) {
pixelType = Imf::FLOAT; // save as float data type
} else {
// default value
@@ -667,7 +667,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
if(pixelType == Imf::HALF) {
// convert from float to half
halfData = new(std::nothrow) half[width * height * components];
- if(!halfData) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
+ if (!halfData) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
for(int y = 0; y < height; y++) {
float *src_bits = (float*)FreeImage_GetScanLine(dib, height - 1 - y);
@@ -700,7 +700,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
(char*)(bits), // base
bytespp, // xStride
pitch)); // yStride
- } else if((image_type == FIT_RGBF) || (image_type == FIT_RGBAF)) {
+ } else if ((image_type == FIT_RGBF) || (image_type == FIT_RGBAF)) {
for(int c = 0; c < components; c++) {
char *channel_base = (char*)(bits) + c*bytespc;
frameBuffer.insert (channel_name[c],// name
diff --git a/plugins/FreeImage/Source/FreeImage/PluginG3.cpp b/plugins/FreeImage/Source/FreeImage/PluginG3.cpp
index d5c08b36e6..c383a455b7 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginG3.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginG3.cpp
@@ -124,7 +124,7 @@ copyFaxFile(FreeImageIO *io, fi_handle handle, TIFF* tifin, uint32 xsize, int st
throw FI_MSG_ERROR_MEMORY;
}
- if(!G3ReadFile(io, handle, tifin->tif_rawdata, tifin->tif_rawdatasize)) {
+ if (!G3ReadFile(io, handle, tifin->tif_rawdata, tifin->tif_rawdatasize)) {
throw "Read error at scanline 0";
}
tifin->tif_rawcp = tifin->tif_rawdata;
@@ -319,7 +319,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// open a temporary memory buffer to save decoded scanlines
memory = FreeImage_OpenMemory();
- if(!memory) throw FI_MSG_ERROR_MEMORY;
+ if (!memory) throw FI_MSG_ERROR_MEMORY;
// wrap the raw fax file
faxTIFF = TIFFClientOpen("(FakeInput)", "w",
diff --git a/plugins/FreeImage/Source/FreeImage/PluginGIF.cpp b/plugins/FreeImage/Source/FreeImage/PluginGIF.cpp
index e8d84afac4..bf7c2550ae 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginGIF.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginGIF.cpp
@@ -167,8 +167,8 @@ FreeImage_SetMetadataEx(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key
static BOOL
FreeImage_GetMetadataEx(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FREE_IMAGE_MDTYPE type, FITAG **tag)
{
- if( FreeImage_GetMetadata(model, dib, key, tag) ) {
- if( FreeImage_GetTagType(*tag) == type ) {
+ if ( FreeImage_GetMetadata(model, dib, key, tag) ) {
+ if ( FreeImage_GetTagType(*tag) == type ) {
return TRUE;
}
}
@@ -187,10 +187,10 @@ StringTable::StringTable()
StringTable::~StringTable()
{
- if( m_buffer != NULL ) {
+ if ( m_buffer != NULL ) {
delete [] m_buffer;
}
- if( m_strmap != NULL ) {
+ if ( m_strmap != NULL ) {
delete [] m_strmap;
m_strmap = NULL;
}
@@ -218,10 +218,10 @@ void StringTable::Initialize(int minCodeSize)
BYTE *StringTable::FillInputBuffer(int len)
{
- if( m_buffer == NULL ) {
+ if ( m_buffer == NULL ) {
m_buffer = new(std::nothrow) BYTE[len];
m_bufferRealSize = len;
- } else if( len > m_bufferRealSize ) {
+ } else if ( len > m_bufferRealSize ) {
delete [] m_buffer;
m_buffer = new(std::nothrow) BYTE[len];
m_bufferRealSize = len;
@@ -273,7 +273,7 @@ int StringTable::CompressEnd(BYTE *buf)
bool StringTable::Compress(BYTE *buf, int *len)
{
- if( m_bufferSize == 0 || m_done ) {
+ if ( m_bufferSize == 0 || m_done ) {
return false;
}
@@ -288,7 +288,7 @@ bool StringTable::Compress(BYTE *buf, int *len)
int nextprefix = (((m_prefix)<<8)&0xFFF00) + (ch & 0x000FF);
if(firstPixelPassed) {
- if( m_strmap[nextprefix] > 0) {
+ if ( m_strmap[nextprefix] > 0) {
m_prefix = m_strmap[nextprefix];
} else {
m_partial |= m_prefix << m_partialSize;
@@ -304,13 +304,13 @@ bool StringTable::Compress(BYTE *buf, int *len)
m_strmap[nextprefix] = m_nextCode;
//increment the next highest valid code, increase the code size
- if( m_nextCode == (1 << m_codeSize) ) {
+ if ( m_nextCode == (1 << m_codeSize) ) {
m_codeSize++;
}
m_nextCode++;
//if we're out of codes, restart the string table
- if( m_nextCode == MAX_LZW_CODE ) {
+ if ( m_nextCode == MAX_LZW_CODE ) {
m_partial |= m_clearCode << m_partialSize;
m_partialSize += m_codeSize;
ClearCompressorTable();
@@ -321,7 +321,7 @@ bool StringTable::Compress(BYTE *buf, int *len)
}
//increment to the next pixel
- if( m_bufferShift > 0 && !(m_bufferPos + 1 == m_bufferSize && m_bufferShift <= m_slack) ) {
+ if ( m_bufferShift > 0 && !(m_bufferPos + 1 == m_bufferSize && m_bufferShift <= m_slack) ) {
m_bufferShift -= m_bpp;
} else {
m_bufferPos++;
@@ -329,7 +329,7 @@ bool StringTable::Compress(BYTE *buf, int *len)
}
//jump out here if the output buffer is full
- if( bufpos - buf == *len ) {
+ if ( bufpos - buf == *len ) {
return true;
}
@@ -341,7 +341,7 @@ bool StringTable::Compress(BYTE *buf, int *len)
m_prefix = ch & 0x000FF;
//increment to the next pixel
- if( m_bufferShift > 0 && !(m_bufferPos + 1 == m_bufferSize && m_bufferShift <= m_slack) ) {
+ if ( m_bufferShift > 0 && !(m_bufferPos + 1 == m_bufferSize && m_bufferShift <= m_slack) ) {
m_bufferShift -= m_bpp;
} else {
m_bufferPos++;
@@ -349,7 +349,7 @@ bool StringTable::Compress(BYTE *buf, int *len)
}
//jump out here if the output buffer is full
- if( bufpos - buf == *len ) {
+ if ( bufpos - buf == *len ) {
return true;
}
}
@@ -363,12 +363,12 @@ bool StringTable::Compress(BYTE *buf, int *len)
bool StringTable::Decompress(BYTE *buf, int *len)
{
- if( m_bufferSize == 0 || m_done ) {
+ if ( m_bufferSize == 0 || m_done ) {
return false;
}
BYTE *bufpos = buf;
- for( ; m_bufferPos < m_bufferSize; m_bufferPos++ ) {
+ for ( ; m_bufferPos < m_bufferSize; m_bufferPos++ ) {
m_partial |= (int)m_buffer[m_bufferPos] << m_partialSize;
m_partialSize += 8;
while( m_partialSize >= m_codeSize ) {
@@ -376,22 +376,22 @@ bool StringTable::Decompress(BYTE *buf, int *len)
m_partial >>= m_codeSize;
m_partialSize -= m_codeSize;
- if( code > m_nextCode || (m_nextCode == MAX_LZW_CODE && code != m_clearCode) || code == m_endCode ) {
+ if ( code > m_nextCode || (m_nextCode == MAX_LZW_CODE && code != m_clearCode) || code == m_endCode ) {
m_done = true;
*len = (int)(bufpos - buf);
return true;
}
- if( code == m_clearCode ) {
+ if ( code == m_clearCode ) {
ClearDecompressorTable();
continue;
}
//add new string to string table, if not the first pass since a clear code
- if( m_oldCode != MAX_LZW_CODE ) {
+ if ( m_oldCode != MAX_LZW_CODE ) {
m_strings[m_nextCode] = m_strings[m_oldCode] + m_strings[code == m_nextCode ? m_oldCode : code][0];
}
- if( (int)m_strings[code].size() > *len - (bufpos - buf) ) {
+ if ( (int)m_strings[code].size() > *len - (bufpos - buf) ) {
//out of space, stuff the code back in for next time
m_partial <<= m_codeSize;
m_partialSize += m_codeSize;
@@ -406,9 +406,9 @@ bool StringTable::Decompress(BYTE *buf, int *len)
bufpos += m_strings[code].size();
//increment the next highest valid code, add a bit to the mask if we need to increase the code size
- if( m_oldCode != MAX_LZW_CODE && m_nextCode < MAX_LZW_CODE ) {
- if( ++m_nextCode < MAX_LZW_CODE ) {
- if( (m_nextCode & m_codeMask) == 0 ) {
+ if ( m_oldCode != MAX_LZW_CODE && m_nextCode < MAX_LZW_CODE ) {
+ if ( ++m_nextCode < MAX_LZW_CODE ) {
+ if ( (m_nextCode & m_codeMask) == 0 ) {
m_codeSize++;
m_codeMask |= m_nextCode;
}
@@ -443,7 +443,7 @@ void StringTable::ClearCompressorTable(void)
void StringTable::ClearDecompressorTable(void)
{
- for( int i = 0; i < m_clearCode; i++ ) {
+ for ( int i = 0; i < m_clearCode; i++ ) {
m_strings[i].resize(1);
m_strings[i][0] = (char)i;
}
@@ -492,13 +492,13 @@ MimeType() {
static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
char buf[6];
- if( io->read_proc(buf, 6, 1, handle) < 1 ) {
+ if ( io->read_proc(buf, 6, 1, handle) < 1 ) {
return FALSE;
}
BOOL bResult = FALSE;
- if( !strncmp(buf, "GIF", 3) ) {
- if( buf[3] >= '0' && buf[3] <= '9' && buf[4] >= '0' && buf[4] <= '9' && buf[5] >= 'a' && buf[5] <= 'z' ) {
+ if ( !strncmp(buf, "GIF", 3) ) {
+ if ( buf[3] >= '0' && buf[3] <= '9' && buf[4] >= '0' && buf[4] <= '9' && buf[5] >= 'a' && buf[5] <= 'z' ) {
bResult = TRUE;
}
}
@@ -525,7 +525,7 @@ SupportsExportType(FREE_IMAGE_TYPE type) {
static void *DLL_CALLCONV
Open(FreeImageIO *io, fi_handle handle, BOOL read) {
GIFinfo *info = new(std::nothrow) GIFinfo;
- if( info == NULL ) {
+ if ( info == NULL ) {
return NULL;
}
@@ -534,10 +534,10 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
// memset(info, 0, sizeof(GIFinfo));
info->read = read;
- if( read ) {
+ if ( read ) {
try {
//Header
- if( !Validate(io, handle) ) {
+ if ( !Validate(io, handle) ) {
throw FI_MSG_ERROR_MAGIC_NUMBER;
}
io->seek_proc(handle, 6, SEEK_CUR);
@@ -545,16 +545,16 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
//Logical Screen Descriptor
io->seek_proc(handle, 4, SEEK_CUR);
BYTE packed;
- if( io->read_proc(&packed, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&packed, 1, 1, handle) < 1 ) {
throw "EOF reading Logical Screen Descriptor";
}
- if( io->read_proc(&info->background_color, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&info->background_color, 1, 1, handle) < 1 ) {
throw "EOF reading Logical Screen Descriptor";
}
io->seek_proc(handle, 1, SEEK_CUR);
//Global Color Table
- if( packed & GIF_PACKED_LSD_HAVEGCT ) {
+ if ( packed & GIF_PACKED_LSD_HAVEGCT ) {
info->global_color_table_offset = io->tell_proc(handle);
info->global_color_table_size = 2 << (packed & GIF_PACKED_LSD_GCTSIZE);
io->seek_proc(handle, 3 * info->global_color_table_size, SEEK_CUR);
@@ -564,42 +564,42 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
size_t gce_offset = 0;
BYTE block = 0;
while( block != GIF_BLOCK_TRAILER ) {
- if( io->read_proc(&block, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&block, 1, 1, handle) < 1 ) {
throw "EOF reading blocks";
}
- if( block == GIF_BLOCK_IMAGE_DESCRIPTOR ) {
+ if ( block == GIF_BLOCK_IMAGE_DESCRIPTOR ) {
info->image_descriptor_offsets.push_back(io->tell_proc(handle));
//GCE may be 0, meaning no GCE preceded this ID
info->graphic_control_extension_offsets.push_back(gce_offset);
gce_offset = 0;
io->seek_proc(handle, 8, SEEK_CUR);
- if( io->read_proc(&packed, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&packed, 1, 1, handle) < 1 ) {
throw "EOF reading Image Descriptor";
}
//Local Color Table
- if( packed & GIF_PACKED_ID_HAVELCT ) {
+ if ( packed & GIF_PACKED_ID_HAVELCT ) {
io->seek_proc(handle, 3 * (2 << (packed & GIF_PACKED_ID_LCTSIZE)), SEEK_CUR);
}
//LZW Minimum Code Size
io->seek_proc(handle, 1, SEEK_CUR);
- } else if( block == GIF_BLOCK_EXTENSION ) {
+ } else if ( block == GIF_BLOCK_EXTENSION ) {
BYTE ext;
- if( io->read_proc(&ext, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&ext, 1, 1, handle) < 1 ) {
throw "EOF reading extension";
}
- if( ext == GIF_EXT_GRAPHIC_CONTROL ) {
+ if ( ext == GIF_EXT_GRAPHIC_CONTROL ) {
//overwrite previous offset if more than one GCE found before an ID
gce_offset = io->tell_proc(handle);
- } else if( ext == GIF_EXT_COMMENT ) {
+ } else if ( ext == GIF_EXT_COMMENT ) {
info->comment_extension_offsets.push_back(io->tell_proc(handle));
- } else if( ext == GIF_EXT_APPLICATION ) {
+ } else if ( ext == GIF_EXT_APPLICATION ) {
info->application_extension_offsets.push_back(io->tell_proc(handle));
}
- } else if( block == GIF_BLOCK_TRAILER ) {
+ } else if ( block == GIF_BLOCK_TRAILER ) {
continue;
} else {
throw "Invalid GIF block found";
@@ -607,12 +607,12 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
//Data Sub-blocks
BYTE len;
- if( io->read_proc(&len, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&len, 1, 1, handle) < 1 ) {
throw "EOF reading sub-block";
}
while( len != 0 ) {
io->seek_proc(handle, len, SEEK_CUR);
- if( io->read_proc(&len, 1, 1, handle) < 1 ) {
+ if ( io->read_proc(&len, 1, 1, handle) < 1 ) {
throw "EOF reading sub-block";
}
}
@@ -632,12 +632,12 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
static void DLL_CALLCONV
Close(FreeImageIO *io, fi_handle handle, void *data) {
- if( data == NULL ) {
+ if ( data == NULL ) {
return;
}
GIFinfo *info = (GIFinfo *)data;
- if( !info->read ) {
+ if ( !info->read ) {
//Trailer
BYTE b = GIF_BLOCK_TRAILER;
io->write_proc(&b, 1, 1, handle);
@@ -648,7 +648,7 @@ Close(FreeImageIO *io, fi_handle handle, void *data) {
static int DLL_CALLCONV
PageCount(FreeImageIO *io, fi_handle handle, void *data) {
- if( data == NULL ) {
+ if ( data == NULL ) {
return 0;
}
GIFinfo *info = (GIFinfo *)data;
@@ -658,15 +658,15 @@ PageCount(FreeImageIO *io, fi_handle handle, void *data) {
static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
- if( data == NULL ) {
+ if ( data == NULL ) {
return NULL;
}
GIFinfo *info = (GIFinfo *)data;
- if( page == -1 ) {
+ if ( page == -1 ) {
page = 0;
}
- if( page < 0 || page >= (int)info->image_descriptor_offsets.size() ) {
+ if ( page < 0 || page >= (int)info->image_descriptor_offsets.size() ) {
return NULL;
}
@@ -679,7 +679,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
WORD w;
//playback pages to generate what the user would see for this frame
- if( (flags & GIF_PLAYBACK) == GIF_PLAYBACK ) {
+ if ( (flags & GIF_PLAYBACK) == GIF_PLAYBACK ) {
//Logical Screen Descriptor
io->seek_proc(handle, 6, SEEK_SET);
WORD logicalwidth, logicalheight;
@@ -691,7 +691,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
#endif
//set the background color with 0 alpha
RGBQUAD background;
- if( info->global_color_table_offset != 0 && info->background_color < info->global_color_table_size ) {
+ if ( info->global_color_table_offset != 0 && info->background_color < info->global_color_table_size ) {
io->seek_proc(handle, (long)(info->global_color_table_offset + (info->background_color * 3)), SEEK_SET);
io->read_proc(&background.rgbRed, 1, 1, handle);
io->read_proc(&background.rgbGreen, 1, 1, handle);
@@ -705,16 +705,16 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
//allocate entire logical area
dib = FreeImage_Allocate(logicalwidth, logicalheight, 32);
- if( dib == NULL ) {
+ if ( dib == NULL ) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
//fill with background color to start
int x, y;
RGBQUAD *scanline;
- for( y = 0; y < logicalheight; y++ ) {
+ for ( y = 0; y < logicalheight; y++ ) {
scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, y);
- for( x = 0; x < logicalwidth; x++ ) {
+ for ( x = 0; x < logicalwidth; x++ ) {
*scanline++ = background;
}
}
@@ -743,14 +743,14 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
pageinfo.push_back(PageInfo(disposal_method, left, top, width, height));
- if( start != end ) {
- if( left == 0 && top == 0 && width == logicalwidth && height == logicalheight ) {
- if( disposal_method == GIF_DISPOSAL_BACKGROUND ) {
+ if ( start != end ) {
+ if ( left == 0 && top == 0 && width == logicalwidth && height == logicalheight ) {
+ if ( disposal_method == GIF_DISPOSAL_BACKGROUND ) {
pageinfo.pop_back();
start++;
break;
- } else if( disposal_method != GIF_DISPOSAL_PREVIOUS ) {
- if( !have_transparent ) {
+ } else if ( disposal_method != GIF_DISPOSAL_PREVIOUS ) {
+ if ( !have_transparent ) {
break;
}
}
@@ -758,23 +758,23 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
start--;
}
- if( start < 0 ) {
+ if ( start < 0 ) {
start = 0;
}
//draw each page into the logical area
delay_time = 0;
- for( page = start; page <= end; page++ ) {
+ for ( page = start; page <= end; page++ ) {
PageInfo &info = pageinfo[end - page];
//things we can skip having to decode
- if( page != end ) {
- if( info.disposal_method == GIF_DISPOSAL_PREVIOUS ) {
+ if ( page != end ) {
+ if ( info.disposal_method == GIF_DISPOSAL_PREVIOUS ) {
continue;
}
- if( info.disposal_method == GIF_DISPOSAL_BACKGROUND ) {
- for( y = 0; y < info.height; y++ ) {
+ if ( info.disposal_method == GIF_DISPOSAL_BACKGROUND ) {
+ for ( y = 0; y < info.height; y++ ) {
scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, logicalheight - (y + info.top) - 1) + info.left;
- for( x = 0; x < info.width; x++ ) {
+ for ( x = 0; x < info.width; x++ ) {
*scanline++ = background;
}
}
@@ -784,14 +784,14 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
//decode page
FIBITMAP *pagedib = Load(io, handle, page, GIF_LOAD256, data);
- if( pagedib != NULL ) {
+ if ( pagedib != NULL ) {
RGBQUAD *pal = FreeImage_GetPalette(pagedib);
have_transparent = false;
- if( FreeImage_IsTransparent(pagedib) ) {
+ if ( FreeImage_IsTransparent(pagedib) ) {
int count = FreeImage_GetTransparencyCount(pagedib);
BYTE *table = FreeImage_GetTransparencyTable(pagedib);
- for( int i = 0; i < count; i++ ) {
- if( table[i] == 0 ) {
+ for ( int i = 0; i < count; i++ ) {
+ if ( table[i] == 0 ) {
have_transparent = true;
transparent_color = i;
break;
@@ -799,11 +799,11 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
}
//copy page data into logical buffer, with full alpha opaqueness
- for( y = 0; y < info.height; y++ ) {
+ for ( y = 0; y < info.height; y++ ) {
scanline = (RGBQUAD *)FreeImage_GetScanLine(dib, logicalheight - (y + info.top) - 1) + info.left;
BYTE *pageline = FreeImage_GetScanLine(pagedib, info.height - y - 1);
- for( x = 0; x < info.width; x++ ) {
- if( !have_transparent || *pageline != transparent_color ) {
+ for ( x = 0; x < info.width; x++ ) {
+ if ( !have_transparent || *pageline != transparent_color ) {
*scanline = pal[*pageline];
scanline->rgbReserved = 255;
}
@@ -812,9 +812,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
}
//copy frame time
- if( page == end ) {
+ if ( page == end ) {
FITAG *tag;
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, pagedib, "FrameTime", FIDT_LONG, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, pagedib, "FrameTime", FIDT_LONG, &tag) ) {
delay_time = *(LONG *)FreeImage_GetTagValue(tag);
}
}
@@ -846,18 +846,18 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
no_local_palette = (packed & GIF_PACKED_ID_HAVELCT) ? false : true;
int bpp = 8;
- if( (flags & GIF_LOAD256) == 0 ) {
- if( !no_local_palette ) {
+ if ( (flags & GIF_LOAD256) == 0 ) {
+ if ( !no_local_palette ) {
int size = 2 << (packed & GIF_PACKED_ID_LCTSIZE);
- if( size <= 2 ) bpp = 1;
- else if( size <= 16 ) bpp = 4;
- } else if( info->global_color_table_offset != 0 ) {
- if( info->global_color_table_size <= 2 ) bpp = 1;
- else if( info->global_color_table_size <= 16 ) bpp = 4;
+ if ( size <= 2 ) bpp = 1;
+ else if ( size <= 16 ) bpp = 4;
+ } else if ( info->global_color_table_offset != 0 ) {
+ if ( info->global_color_table_size <= 2 ) bpp = 1;
+ else if ( info->global_color_table_size <= 16 ) bpp = 4;
}
}
dib = FreeImage_Allocate(width, height, bpp);
- if( dib == NULL ) {
+ if ( dib == NULL ) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
@@ -870,7 +870,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
//Palette
RGBQUAD *pal = FreeImage_GetPalette(dib);
- if( !no_local_palette ) {
+ if ( !no_local_palette ) {
int size = 2 << (packed & GIF_PACKED_ID_LCTSIZE);
int i = 0;
@@ -880,7 +880,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->read_proc(&pal[i].rgbBlue, 1, 1, handle);
i++;
}
- } else if( info->global_color_table_offset != 0 ) {
+ } else if ( info->global_color_table_offset != 0 ) {
long pos = io->tell_proc(handle);
io->seek_proc(handle, (long)info->global_color_table_offset, SEEK_SET);
@@ -895,7 +895,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->seek_proc(handle, pos, SEEK_SET);
} else {
//its legal to have no palette, but we're going to generate *something*
- for( int i = 0; i < 256; i++ ) {
+ for ( int i = 0; i < 256; i++ ) {
pal[i].rgbRed = (BYTE)i;
pal[i].rgbGreen = (BYTE)i;
pal[i].rgbBlue = (BYTE)i;
@@ -916,24 +916,24 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->read_proc(stringtable->FillInputBuffer(b), b, 1, handle);
int size = sizeof(buf);
while( stringtable->Decompress(buf, &size) ) {
- for( int i = 0; i < size; i++ ) {
+ for ( int i = 0; i < size; i++ ) {
scanline[xpos] |= (buf[i] & mask) << shift;
- if( shift > 0 ) {
+ if ( shift > 0 ) {
shift -= bpp;
} else {
xpos++;
shift = 8 - bpp;
}
- if( ++x >= width ) {
- if( interlaced ) {
+ if ( ++x >= width ) {
+ if ( interlaced ) {
y += g_GifInterlaceIncrement[interlacepass];
- if( y >= height && ++interlacepass < GIF_INTERLACE_PASSES ) {
+ if ( y >= height && ++interlacepass < GIF_INTERLACE_PASSES ) {
y = g_GifInterlaceOffset[interlacepass];
}
} else {
y++;
}
- if( y >= height ) {
+ if ( y >= height ) {
stringtable->Done();
break;
}
@@ -947,7 +947,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->read_proc(&b, 1, 1, handle);
}
- if( page == 0 ) {
+ if ( page == 0 ) {
size_t idx;
//Logical Screen Descriptor
@@ -963,7 +963,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "LogicalHeight", ANIMTAG_LOGICALHEIGHT, FIDT_SHORT, 1, 2, &logicalheight);
//Global Color Table
- if( info->global_color_table_offset != 0 ) {
+ if ( info->global_color_table_offset != 0 ) {
RGBQUAD globalpalette[256];
io->seek_proc(handle, (long)info->global_color_table_offset, SEEK_SET);
int i = 0;
@@ -976,29 +976,29 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "GlobalPalette", ANIMTAG_GLOBALPALETTE, FIDT_PALETTE, info->global_color_table_size, info->global_color_table_size * 4, globalpalette);
//background color
- if( info->background_color < info->global_color_table_size ) {
+ if ( info->background_color < info->global_color_table_size ) {
FreeImage_SetBackgroundColor(dib, &globalpalette[info->background_color]);
}
}
//Application Extension
LONG loop = 1; //If no AE with a loop count is found, the default must be 1
- for( idx = 0; idx < info->application_extension_offsets.size(); idx++ ) {
+ for ( idx = 0; idx < info->application_extension_offsets.size(); idx++ ) {
io->seek_proc(handle, (long)info->application_extension_offsets[idx], SEEK_SET);
io->read_proc(&b, 1, 1, handle);
- if( b == 11 ) { //All AEs start with an 11 byte sub-block to determine what type of AE it is
+ if ( b == 11 ) { //All AEs start with an 11 byte sub-block to determine what type of AE it is
char buf[11];
io->read_proc(buf, 11, 1, handle);
- if( !memcmp(buf, "NETSCAPE2.0", 11) || !memcmp(buf, "ANIMEXTS1.0", 11) ) { //Not everybody recognizes ANIMEXTS1.0 but it is valid
+ if ( !memcmp(buf, "NETSCAPE2.0", 11) || !memcmp(buf, "ANIMEXTS1.0", 11) ) { //Not everybody recognizes ANIMEXTS1.0 but it is valid
io->read_proc(&b, 1, 1, handle);
- if( b == 3 ) { //we're supposed to have a 3 byte sub-block now
+ if ( b == 3 ) { //we're supposed to have a 3 byte sub-block now
io->read_proc(&b, 1, 1, handle); //this should be 0x01 but isn't really important
io->read_proc(&w, 2, 1, handle);
#ifdef FREEIMAGE_BIGENDIAN
SwapShort(&w);
#endif
loop = w;
- if( loop > 0 ) loop++;
+ if ( loop > 0 ) loop++;
break;
}
}
@@ -1007,7 +1007,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "Loop", ANIMTAG_LOOP, FIDT_LONG, 1, 4, &loop);
//Comment Extension
- for( idx = 0; idx < info->comment_extension_offsets.size(); idx++ ) {
+ for ( idx = 0; idx < info->comment_extension_offsets.size(); idx++ ) {
io->seek_proc(handle, (long)info->comment_extension_offsets[idx], SEEK_SET);
std::string comment;
char buf[255];
@@ -1025,7 +1025,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
//Graphic Control Extension
- if( info->graphic_control_extension_offsets[page] != 0 ) {
+ if ( info->graphic_control_extension_offsets[page] != 0 ) {
io->seek_proc(handle, (long)(info->graphic_control_extension_offsets[page] + 1), SEEK_SET);
io->read_proc(&packed, 1, 1, handle);
io->read_proc(&w, 2, 1, handle);
@@ -1037,9 +1037,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
disposal_method = (packed & GIF_PACKED_GCE_DISPOSAL) >> 2;
delay_time = w * 10; //convert cs to ms
transparent_color = b;
- if( have_transparent ) {
+ if ( have_transparent ) {
int size = 1 << bpp;
- if( transparent_color <= size ) {
+ if ( transparent_color <= size ) {
BYTE table[256];
memset(table, 0xFF, size);
table[transparent_color] = 0;
@@ -1054,7 +1054,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
delete stringtable;
} catch (const char *msg) {
- if( dib != NULL ) {
+ if ( dib != NULL ) {
FreeImage_Unload(dib);
}
FreeImage_OutputMessageProc(s_format_id, msg);
@@ -1066,12 +1066,12 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
static BOOL DLL_CALLCONV
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
- if( data == NULL ) {
+ if ( data == NULL ) {
return FALSE;
}
//GIFinfo *info = (GIFinfo *)data;
- if( page == -1 ) {
+ if ( page == -1 ) {
page = 0;
}
@@ -1081,7 +1081,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
FITAG *tag;
int bpp = FreeImage_GetBPP(dib);
- if( bpp != 1 && bpp != 4 && bpp != 8 ) {
+ if ( bpp != 1 && bpp != 4 && bpp != 8 ) {
throw "Only 1, 4, or 8 bpp images supported";
}
@@ -1089,22 +1089,22 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
int disposal_method = GIF_DISPOSAL_BACKGROUND, delay_time = 100, transparent_color = 0;
WORD left = 0, top = 0, width = (WORD)FreeImage_GetWidth(dib), height = (WORD)FreeImage_GetHeight(dib);
WORD output_height = height;
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameLeft", FIDT_SHORT, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameLeft", FIDT_SHORT, &tag) ) {
left = *(WORD *)FreeImage_GetTagValue(tag);
}
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTop", FIDT_SHORT, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTop", FIDT_SHORT, &tag) ) {
top = *(WORD *)FreeImage_GetTagValue(tag);
}
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "NoLocalPalette", FIDT_BYTE, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "NoLocalPalette", FIDT_BYTE, &tag) ) {
no_local_palette = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false;
}
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Interlaced", FIDT_BYTE, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Interlaced", FIDT_BYTE, &tag) ) {
interlaced = *(BYTE *)FreeImage_GetTagValue(tag) ? true : false;
}
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", FIDT_LONG, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "FrameTime", FIDT_LONG, &tag) ) {
delay_time = *(LONG *)FreeImage_GetTagValue(tag);
}
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", FIDT_BYTE, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "DisposalMethod", FIDT_BYTE, &tag) ) {
disposal_method = *(BYTE *)FreeImage_GetTagValue(tag);
}
@@ -1116,17 +1116,17 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
SwapShort(&height);
#endif
- if( page == 0 ) {
+ if ( page == 0 ) {
//gather some info
WORD logicalwidth = width; // width has already been swapped...
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "LogicalWidth", FIDT_SHORT, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "LogicalWidth", FIDT_SHORT, &tag) ) {
logicalwidth = *(WORD *)FreeImage_GetTagValue(tag);
#ifdef FREEIMAGE_BIGENDIAN
SwapShort(&logicalwidth);
#endif
}
WORD logicalheight = height; // height has already been swapped...
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "LogicalHeight", FIDT_SHORT, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "LogicalHeight", FIDT_SHORT, &tag) ) {
logicalheight = *(WORD *)FreeImage_GetTagValue(tag);
#ifdef FREEIMAGE_BIGENDIAN
SwapShort(&logicalheight);
@@ -1134,9 +1134,9 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
}
RGBQUAD *globalpalette = NULL;
int globalpalette_size = 0;
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "GlobalPalette", FIDT_PALETTE, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "GlobalPalette", FIDT_PALETTE, &tag) ) {
globalpalette_size = FreeImage_GetTagCount(tag);
- if( globalpalette_size >= 2 ) {
+ if ( globalpalette_size >= 2 ) {
globalpalette = (RGBQUAD *)FreeImage_GetTagValue(tag);
}
}
@@ -1147,36 +1147,36 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
packed = GIF_PACKED_LSD_COLORRES;
b = 0;
RGBQUAD background_color;
- if( globalpalette != NULL ) {
+ if ( globalpalette != NULL ) {
packed |= GIF_PACKED_LSD_HAVEGCT;
- if( globalpalette_size < 4 ) {
+ if ( globalpalette_size < 4 ) {
globalpalette_size = 2;
packed |= 0 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 8 ) {
+ } else if ( globalpalette_size < 8 ) {
globalpalette_size = 4;
packed |= 1 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 16 ) {
+ } else if ( globalpalette_size < 16 ) {
globalpalette_size = 8;
packed |= 2 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 32 ) {
+ } else if ( globalpalette_size < 32 ) {
globalpalette_size = 16;
packed |= 3 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 64 ) {
+ } else if ( globalpalette_size < 64 ) {
globalpalette_size = 32;
packed |= 4 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 128 ) {
+ } else if ( globalpalette_size < 128 ) {
globalpalette_size = 64;
packed |= 5 & GIF_PACKED_LSD_GCTSIZE;
- } else if( globalpalette_size < 256 ) {
+ } else if ( globalpalette_size < 256 ) {
globalpalette_size = 128;
packed |= 6 & GIF_PACKED_LSD_GCTSIZE;
} else {
globalpalette_size = 256;
packed |= 7 & GIF_PACKED_LSD_GCTSIZE;
}
- if( FreeImage_GetBackgroundColor(dib, &background_color) ) {
- for( int i = 0; i < globalpalette_size; i++ ) {
- if( background_color.rgbRed == globalpalette[i].rgbRed &&
+ if ( FreeImage_GetBackgroundColor(dib, &background_color) ) {
+ for ( int i = 0; i < globalpalette_size; i++ ) {
+ if ( background_color.rgbRed == globalpalette[i].rgbRed &&
background_color.rgbGreen == globalpalette[i].rgbGreen &&
background_color.rgbBlue == globalpalette[i].rgbBlue ) {
@@ -1194,7 +1194,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
io->write_proc(&b, 1, 1, handle);
//Global Color Table
- if( globalpalette != NULL ) {
+ if ( globalpalette != NULL ) {
int i = 0;
while( i < globalpalette_size ) {
io->write_proc(&globalpalette[i].rgbRed, 1, 1, handle);
@@ -1206,13 +1206,13 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
//Application Extension
LONG loop = 0;
- if( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Loop", FIDT_LONG, &tag) ) {
+ if ( FreeImage_GetMetadataEx(FIMD_ANIMATION, dib, "Loop", FIDT_LONG, &tag) ) {
loop = *(LONG *)FreeImage_GetTagValue(tag);
}
- if( loop != 1 ) {
+ if ( loop != 1 ) {
//the Netscape extension is really "repeats" not "loops"
- if( loop > 1 ) loop--;
- if( loop > 0xFFFF ) loop = 0xFFFF;
+ if ( loop > 1 ) loop--;
+ if ( loop > 0xFFFF ) loop = 0xFFFF;
w = (WORD)loop;
#ifdef FREEIMAGE_BIGENDIAN
SwapShort(&w);
@@ -1227,9 +1227,9 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
FIMETADATA *mdhandle = NULL;
FITAG *tag = NULL;
mdhandle = FreeImage_FindFirstMetadata(FIMD_COMMENTS, dib, &tag);
- if( mdhandle ) {
+ if ( mdhandle ) {
do {
- if( FreeImage_GetTagType(tag) == FIDT_ASCII ) {
+ if ( FreeImage_GetTagType(tag) == FIDT_ASCII ) {
int length = FreeImage_GetTagLength(tag) - 1;
char *value = (char *)FreeImage_GetTagValue(tag);
io->write_proc((void *)"\x21\xFE", 2, 1, handle);
@@ -1250,11 +1250,11 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
}
//Graphic Control Extension
- if( FreeImage_IsTransparent(dib) ) {
+ if ( FreeImage_IsTransparent(dib) ) {
int count = FreeImage_GetTransparencyCount(dib);
BYTE *table = FreeImage_GetTransparencyTable(dib);
- for( int i = 0; i < count; i++ ) {
- if( table[i] == 0 ) {
+ for ( int i = 0; i < count; i++ ) {
+ if ( table[i] == 0 ) {
have_transparent = true;
transparent_color = i;
break;
@@ -1263,7 +1263,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
}
io->write_proc((void *)"\x21\xF9\x04", 3, 1, handle);
b = (BYTE)((disposal_method << 2) & GIF_PACKED_GCE_DISPOSAL);
- if( have_transparent ) b |= GIF_PACKED_GCE_HAVETRANS;
+ if ( have_transparent ) b |= GIF_PACKED_GCE_HAVETRANS;
io->write_proc(&b, 1, 1, handle);
//Notes about delay time for GIFs:
//IE5/IE6 have a minimum and default of 100ms
@@ -1287,14 +1287,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
io->write_proc(&width, 2, 1, handle);
io->write_proc(&height, 2, 1, handle);
packed = 0;
- if( !no_local_palette ) packed |= GIF_PACKED_ID_HAVELCT | ((bpp - 1) & GIF_PACKED_ID_LCTSIZE);
- if( interlaced ) packed |= GIF_PACKED_ID_INTERLACED;
+ if ( !no_local_palette ) packed |= GIF_PACKED_ID_HAVELCT | ((bpp - 1) & GIF_PACKED_ID_LCTSIZE);
+ if ( interlaced ) packed |= GIF_PACKED_ID_INTERLACED;
io->write_proc(&packed, 1, 1, handle);
//Local Color Table
- if( !no_local_palette ) {
+ if ( !no_local_palette ) {
int palsize = 1 << bpp;
- for( int i = 0; i < palsize; i++ ) {
+ for ( int i = 0; i < palsize; i++ ) {
io->write_proc(&pal[i].rgbRed, 1, 1, handle);
io->write_proc(&pal[i].rgbGreen, 1, 1, handle);
io->write_proc(&pal[i].rgbBlue, 1, 1, handle);
@@ -1318,7 +1318,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
memcpy(stringtable->FillInputBuffer(line), FreeImage_GetScanLine(dib, output_height - y - 1), line);
while( stringtable->Compress(bufptr, &size) ) {
bufptr += size;
- if( bufptr - buf == sizeof(buf) ) {
+ if ( bufptr - buf == sizeof(buf) ) {
io->write_proc(&b, 1, 1, handle);
io->write_proc(buf, sizeof(buf), 1, handle);
size = sizeof(buf);
@@ -1327,9 +1327,9 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
size = (int)(sizeof(buf) - (bufptr - buf));
}
}
- if( interlaced ) {
+ if ( interlaced ) {
y += g_GifInterlaceIncrement[interlacepass];
- if( y >= output_height && ++interlacepass < GIF_INTERLACE_PASSES ) {
+ if ( y >= output_height && ++interlacepass < GIF_INTERLACE_PASSES ) {
y = g_GifInterlaceOffset[interlacepass];
}
} else {
@@ -1339,14 +1339,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
size = (int)(bufptr - buf);
BYTE last[4];
w = (WORD)stringtable->CompressEnd(last);
- if( size + w >= sizeof(buf) ) {
+ if ( size + w >= sizeof(buf) ) {
//one last full size sub-block
io->write_proc(&b, 1, 1, handle);
io->write_proc(buf, size, 1, handle);
io->write_proc(last, sizeof(buf) - size, 1, handle);
//and possibly a tiny additional sub-block
b = (BYTE)(w - (sizeof(buf) - size));
- if( b > 0 ) {
+ if ( b > 0 ) {
io->write_proc(&b, 1, 1, handle);
io->write_proc(last + w - b, b, 1, handle);
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginHDR.cpp b/plugins/FreeImage/Source/FreeImage/PluginHDR.cpp
index 96a10d7d35..a0334e1143 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginHDR.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginHDR.cpp
@@ -127,7 +127,7 @@ rgbe_GetLine(FreeImageIO *io, fi_handle handle, char *buffer, int length) {
int i;
memset(buffer, 0, length);
for(i = 0; i < length; i++) {
- if(!io->read_proc(&buffer[i], 1, 1, handle))
+ if (!io->read_proc(&buffer[i], 1, 1, handle))
return FALSE;
if(buffer[i] == 0x0A)
break;
@@ -196,7 +196,7 @@ rgbe_ReadHeader(FreeImageIO *io, fi_handle handle, unsigned *width, unsigned *he
header_info->exposure = 1.0;
// get the first line
- if(!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
+ if (!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
return rgbe_Error(rgbe_read_error, NULL);
// check the signature
@@ -208,19 +208,19 @@ rgbe_ReadHeader(FreeImageIO *io, fi_handle handle, unsigned *width, unsigned *he
else {
header_info->valid |= RGBE_VALID_PROGRAMTYPE;
for(i = 0; i < sizeof(header_info->programtype) - 1; i++) {
- if((buf[i+2] == 0) || isspace(buf[i+2]))
+ if ((buf[i+2] == 0) || isspace(buf[i+2]))
break;
header_info->programtype[i] = buf[i+2];
}
header_info->programtype[i] = 0;
}
- for(;;) {
+ for (;;) {
// get next line
- if(!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
+ if (!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
return rgbe_Error(rgbe_read_error, NULL);
- if((buf[0] == 0) || (buf[0] == '\n')) {
+ if ((buf[0] == 0) || (buf[0] == '\n')) {
// end of header so break out of loop
bHeaderFound = TRUE;
break;
@@ -236,17 +236,17 @@ rgbe_ReadHeader(FreeImageIO *io, fi_handle handle, unsigned *width, unsigned *he
header_info->exposure = tempf;
header_info->valid |= RGBE_VALID_EXPOSURE;
}
- else if((buf[0] == '#') && (buf[1] == 0x20)) {
+ else if ((buf[0] == '#') && (buf[1] == 0x20)) {
header_info->valid |= RGBE_VALID_COMMENT;
strcpy(header_info->comment, buf);
}
}
- if(!bHeaderFound || !bFormatFound) {
+ if (!bHeaderFound || !bFormatFound) {
return rgbe_Error(rgbe_format_error, "invalid header");
}
// get next line
- if(!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
+ if (!rgbe_GetLine(io, handle, buf, HDR_MAXLINE))
return rgbe_Error(rgbe_read_error, NULL);
// get the image width & height
@@ -364,14 +364,14 @@ rgbe_ReadPixels_RLE(FreeImageIO *io, fi_handle handle, FIRGBF *data, int scanlin
free(scanline_buffer);
return rgbe_Error(rgbe_read_error,NULL);
}
- if((rgbe[0] != 2) || (rgbe[1] != 2) || (rgbe[2] & 0x80)) {
+ if ((rgbe[0] != 2) || (rgbe[1] != 2) || (rgbe[2] & 0x80)) {
// this file is not run length encoded
rgbe_RGBEToFloat(data, rgbe);
data ++;
free(scanline_buffer);
return rgbe_ReadPixels(io, handle, data, scanline_width * num_scanlines - 1);
}
- if((((int)rgbe[2]) << 8 | rgbe[3]) != scanline_width) {
+ if ((((int)rgbe[2]) << 8 | rgbe[3]) != scanline_width) {
free(scanline_buffer);
return rgbe_Error(rgbe_format_error,"wrong scanline width");
}
@@ -394,7 +394,7 @@ rgbe_ReadPixels_RLE(FreeImageIO *io, fi_handle handle, FIRGBF *data, int scanlin
if(buf[0] > 128) {
// a run of the same value
count = buf[0] - 128;
- if((count == 0) || (count > ptr_end - ptr)) {
+ if ((count == 0) || (count > ptr_end - ptr)) {
free(scanline_buffer);
return rgbe_Error(rgbe_format_error, "bad scanline data");
}
@@ -404,12 +404,12 @@ rgbe_ReadPixels_RLE(FreeImageIO *io, fi_handle handle, FIRGBF *data, int scanlin
else {
// a non-run
count = buf[0];
- if((count == 0) || (count > ptr_end - ptr)) {
+ if ((count == 0) || (count > ptr_end - ptr)) {
free(scanline_buffer);
return rgbe_Error(rgbe_format_error, "bad scanline data");
}
*ptr++ = buf[1];
- if(--count > 0) {
+ if (--count > 0) {
if(io->read_proc(ptr, 1, sizeof(BYTE) * count, handle) < 1) {
free(scanline_buffer);
return rgbe_Error(rgbe_read_error, NULL);
@@ -530,7 +530,7 @@ rgbe_WritePixels_RLE(FreeImageIO *io, fi_handle handle, FIRGBF *data, unsigned s
// first red, then green, then blue, then exponent
for(int i = 0; i < 4; i++) {
BOOL bOK = rgbe_WriteBytes_RLE(io, handle, &buffer[i*scanline_width], scanline_width);
- if(!bOK) {
+ if (!bOK) {
free(buffer);
return bOK;
}
@@ -606,7 +606,7 @@ static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FIBITMAP *dib = NULL;
- if(!handle) {
+ if (!handle) {
return NULL;
}
@@ -624,7 +624,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// allocate a RGBF image
dib = FreeImage_AllocateHeaderT(header_only, FIT_RGBF, width, height);
- if(!dib) {
+ if (!dib) {
throw FI_MSG_ERROR_MEMORY;
}
@@ -640,7 +640,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
for(unsigned y = 0; y < height; y++) {
FIRGBF *scanline = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y);
- if(!rgbe_ReadPixels_RLE(io, handle, scanline, width, 1)) {
+ if (!rgbe_ReadPixels_RLE(io, handle, scanline, width, 1)) {
FreeImage_Unload(dib);
return NULL;
}
@@ -659,7 +659,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
static BOOL DLL_CALLCONV
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
- if(!dib) return FALSE;
+ if (!dib) return FALSE;
if(FreeImage_GetImageType(dib) != FIT_RGBF) {
return FALSE;
@@ -676,7 +676,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
rgbe_WriteMetadata(dib, &header_info);
// fill a comment
sprintf(header_info.comment, "# Made with FreeImage %s", FreeImage_GetVersion());
- if(!rgbe_WriteHeader(io, handle, width, height, &header_info)) {
+ if (!rgbe_WriteHeader(io, handle, width, height, &header_info)) {
return FALSE;
}
@@ -684,7 +684,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
for(unsigned y = 0; y < height; y++) {
FIRGBF *scanline = (FIRGBF*)FreeImage_GetScanLine(dib, height - 1 - y);
- if(!rgbe_WritePixels_RLE(io, handle, scanline, width, 1)) {
+ if (!rgbe_WritePixels_RLE(io, handle, scanline, width, 1)) {
return FALSE;
}
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginICO.cpp b/plugins/FreeImage/Source/FreeImage/PluginICO.cpp
index 7f41a0d841..1107841d33 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginICO.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginICO.cpp
@@ -232,7 +232,7 @@ Open(FreeImageIO *io, fi_handle handle, BOOL read) {
SwapIconHeader(lpIH);
#endif
- if(!(lpIH->idReserved == 0) || !(lpIH->idType == 1)) {
+ if (!(lpIH->idReserved == 0) || !(lpIH->idType == 1)) {
// Not an ICO file
free(lpIH);
return NULL;
@@ -295,7 +295,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only)
return NULL;
}
- if( bmih.biBitCount <= 8 ) {
+ if ( bmih.biBitCount <= 8 ) {
// read the palette data
io->read_proc(FreeImage_GetPalette(dib), CalculateUsedPaletteEntries(bit_count) * sizeof(RGBQUAD), 1, handle);
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
@@ -339,7 +339,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only)
// bitmap has been loaded successfully!
// convert to 32bpp and generate an alpha channel
- if((flags & ICO_MAKEALPHA) == ICO_MAKEALPHA) {
+ if ((flags & ICO_MAKEALPHA) == ICO_MAKEALPHA) {
FIBITMAP *dib32 = FreeImage_ConvertTo32Bits(dib);
FreeImage_Unload(dib);
@@ -350,7 +350,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only)
int width_and = WidthBytes(width);
BYTE *line_and = (BYTE *)malloc(width_and);
- if( line_and == NULL ) {
+ if ( line_and == NULL ) {
FreeImage_Unload(dib32);
return NULL;
}
@@ -361,7 +361,7 @@ LoadStandardIcon(FreeImageIO *io, fi_handle handle, int flags, BOOL header_only)
io->read_proc(line_and, width_and, 1, handle);
for(int x = 0; x < width; x++) {
quad->rgbReserved = (line_and[x>>3] & (0x80 >> (x & 0x07))) != 0 ? 0 : 0xFF;
- if( quad->rgbReserved == 0 ) {
+ if ( quad->rgbReserved == 0 ) {
quad->rgbBlue ^= 0xFF;
quad->rgbGreen ^= 0xFF;
quad->rgbRed ^= 0xFF;
@@ -409,7 +409,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->seek_proc(handle, 0, SEEK_SET);
io->seek_proc(handle, icon_list[page].dwImageOffset, SEEK_CUR);
- if((icon_list[page].bWidth == 0) && (icon_list[page].bHeight == 0)) {
+ if ((icon_list[page].bWidth == 0) && (icon_list[page].bHeight == 0)) {
// Vista icon support
dib = FreeImage_LoadFromHandle(FIF_PNG, io, handle, header_only ? FIF_LOAD_NOPIXELS : PNG_DEFAULT);
}
@@ -530,7 +530,7 @@ SaveStandardIcon(FreeImageIO *io, FIBITMAP *dib, fi_handle handle) {
#endif
// AND mask
BYTE *and_mask = (BYTE*)malloc(size_and);
- if(!and_mask) {
+ if (!and_mask) {
return FALSE;
}
@@ -642,14 +642,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
std::vector<FIBITMAP*> vPages;
int k;
- if(!dib || !handle || !data) {
+ if (!dib || !handle || !data) {
return FALSE;
}
// check format limits
unsigned w = FreeImage_GetWidth(dib);
unsigned h = FreeImage_GetHeight(dib);
- if((w < 16) || (w > 256) || (h < 16) || (h > 256) || (w != h)) {
+ if ((w < 16) || (w > 256) || (h < 16) || (h > 256) || (w != h)) {
FreeImage_OutputMessageProc(s_format_id, "Unsupported icon size: width x height = %d x %d", w, h);
return FALSE;
}
@@ -667,7 +667,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
// load all icons
for(k = 0; k < icon_header->idCount; k++) {
icon_dib = Load(io, handle, k, flags, data);
- if(!icon_dib) {
+ if (!icon_dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
vPages.push_back(icon_dib);
@@ -694,7 +694,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
// save the icon descriptions
ICONDIRENTRY *icon_list = (ICONDIRENTRY *)malloc(icon_header->idCount * sizeof(ICONDIRENTRY));
- if(!icon_list) {
+ if (!icon_list) {
throw FI_MSG_ERROR_MEMORY;
}
memset(icon_list, 0, icon_header->idCount * sizeof(ICONDIRENTRY));
@@ -710,7 +710,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
icon_list[k].bReserved = 0;
icon_list[k].wPlanes = bmih->biPlanes;
icon_list[k].wBitCount = bmih->biBitCount;
- if( (icon_list[k].wPlanes * icon_list[k].wBitCount) >= 8 ) {
+ if ( (icon_list[k].wPlanes * icon_list[k].wBitCount) >= 8 ) {
icon_list[k].bColorCount = 0;
} else {
icon_list[k].bColorCount = (BYTE)(1 << (icon_list[k].wPlanes * icon_list[k].wBitCount));
@@ -731,7 +731,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
for(k = 0; k < icon_header->idCount; k++) {
icon_dib = (FIBITMAP*)vPages[k];
- if((icon_list[k].bWidth == 0) && (icon_list[k].bHeight == 0)) {
+ if ((icon_list[k].bWidth == 0) && (icon_list[k].bHeight == 0)) {
// Vista icon support
FreeImage_SaveToHandle(FIF_PNG, icon_dib, io, handle, PNG_DEFAULT);
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginIFF.cpp b/plugins/FreeImage/Source/FreeImage/PluginIFF.cpp
index ae1f903f82..b6cd45d6db 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginIFF.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginIFF.cpp
@@ -220,7 +220,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
SwapLong(&type);
#endif
- if((type != ID_ILBM) && (type != ID_PBM))
+ if ((type != ID_ILBM) && (type != ID_PBM))
return NULL;
size -= 4;
@@ -266,7 +266,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
depth = planes > 8 ? 24 : 8;
- if( depth == 24 ) {
+ if ( depth == 24 ) {
dib = FreeImage_Allocate(width, height, depth, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
dib = FreeImage_Allocate(width, height, depth);
@@ -358,7 +358,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// t = [0..127] => copy the next t+1 bytes literally
unsigned size_to_read = t + 1;
- if((size_to_read + x) > src_size) {
+ if ((size_to_read + x) > src_size) {
// sanity check for buffer overruns
size_to_read = src_size - x;
io->read_proc(src + x, size_to_read, 1, handle);
@@ -373,7 +373,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
io->read_proc(&b, 1, 1, handle);
unsigned size_to_copy = (unsigned)(-(int)t + 1);
- if((size_to_copy + x) > src_size) {
+ if ((size_to_copy + x) > src_size) {
// sanity check for buffer overruns
size_to_copy = src_size - x;
memset(src + x, b, size_to_copy);
diff --git a/plugins/FreeImage/Source/FreeImage/PluginJ2K.cpp b/plugins/FreeImage/Source/FreeImage/PluginJ2K.cpp
index c868ce253d..6e772afdaa 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginJ2K.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginJ2K.cpp
@@ -142,7 +142,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FIBITMAP *dib = NULL;
// check the file format
- if(!Validate(io, handle)) {
+ if (!Validate(io, handle)) {
return NULL;
}
@@ -163,7 +163,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
file_length = io->tell_proc(handle) - start_pos;
io->seek_proc(handle, start_pos, SEEK_SET);
src = (BYTE*)malloc(file_length * sizeof(BYTE));
- if(!src) {
+ if (!src) {
throw FI_MSG_ERROR_MEMORY;
}
if(io->read_proc(src, 1, file_length, handle) < 1) {
@@ -186,7 +186,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// decode the stream and fill the image structure
image = opj_decode(dinfo, cio);
- if(!image) {
+ if (!image) {
throw "Failed to decode image!\n";
}
@@ -203,7 +203,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// create output image
dib = J2KImageToFIBITMAP(s_format_id, image);
- if(!dib) throw "Failed to import JPEG2000 image";
+ if (!dib) throw "Failed to import JPEG2000 image";
// free image data structure
opj_image_destroy(image);
@@ -261,7 +261,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
try {
// convert the dib to a OpenJPEG image
image = FIBITMAPToJ2KImage(s_format_id, dib, &parameters);
- if(!image) return FALSE;
+ if (!image) return FALSE;
// decide if MCT should be used
parameters.tcp_mct = (image->numcomps == 3) ? 1 : 0;
diff --git a/plugins/FreeImage/Source/FreeImage/PluginJP2.cpp b/plugins/FreeImage/Source/FreeImage/PluginJP2.cpp
index df41218761..ed1cb267bb 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginJP2.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginJP2.cpp
@@ -142,7 +142,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FIBITMAP *dib = NULL;
// check the file format
- if(!Validate(io, handle)) {
+ if (!Validate(io, handle)) {
return NULL;
}
@@ -163,7 +163,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
file_length = io->tell_proc(handle) - start_pos;
io->seek_proc(handle, start_pos, SEEK_SET);
src = (BYTE*)malloc(file_length * sizeof(BYTE));
- if(!src) {
+ if (!src) {
throw FI_MSG_ERROR_MEMORY;
}
if(io->read_proc(src, 1, file_length, handle) < 1) {
@@ -186,7 +186,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// decode the stream and fill the image structure
image = opj_decode(dinfo, cio);
- if(!image) {
+ if (!image) {
throw "Failed to decode image!\n";
}
@@ -203,7 +203,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// create output image
dib = J2KImageToFIBITMAP(s_format_id, image);
- if(!dib) throw "Failed to import JPEG2000 image";
+ if (!dib) throw "Failed to import JPEG2000 image";
// free image data structure
opj_image_destroy(image);
@@ -261,7 +261,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
try {
// convert the dib to a OpenJPEG image
image = FIBITMAPToJ2KImage(s_format_id, dib, &parameters);
- if(!image) return FALSE;
+ if (!image) return FALSE;
// decide if MCT should be used
parameters.tcp_mct = (image->numcomps == 3) ? 1 : 0;
diff --git a/plugins/FreeImage/Source/FreeImage/PluginJPEG.cpp b/plugins/FreeImage/Source/FreeImage/PluginJPEG.cpp
index ed52bfdd0d..b6393de7aa 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginJPEG.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginJPEG.cpp
@@ -757,7 +757,7 @@ read_markers(j_decompress_ptr cinfo, FIBITMAP *dib) {
continue;
}
if(memcmp(marker->data, "JFXX" , 5) == 0) {
- if(!cinfo->saw_JFIF_marker || cinfo->JFIF_minor_version < 2) {
+ if (!cinfo->saw_JFIF_marker || cinfo->JFIF_minor_version < 2) {
FreeImage_OutputMessageProc(s_format_id, "Warning: non-standard JFXX segment");
}
jpeg_read_jfxx(dib, marker->data, marker->data_length);
@@ -785,7 +785,7 @@ read_markers(j_decompress_ptr cinfo, FIBITMAP *dib) {
BYTE *icc_profile = NULL;
unsigned icc_length = 0;
- if( jpeg_read_icc_profile(cinfo, &icc_profile, &icc_length) ) {
+ if ( jpeg_read_icc_profile(cinfo, &icc_profile, &icc_length) ) {
// copy ICC profile data
FreeImage_CreateICCProfile(dib, icc_profile, icc_length);
// clean up
@@ -995,11 +995,11 @@ static BOOL
jpeg_write_jfxx(j_compress_ptr cinfo, FIBITMAP *dib) {
// get the thumbnail to be stored
FIBITMAP* thumbnail = FreeImage_GetThumbnail(dib);
- if(!thumbnail) {
+ if (!thumbnail) {
return TRUE;
}
// check for a compatible output format
- if((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 8) && (FreeImage_GetBPP(thumbnail) != 24)) {
+ if ((FreeImage_GetImageType(thumbnail) != FIT_BITMAP) || (FreeImage_GetBPP(thumbnail) != 8) && (FreeImage_GetBPP(thumbnail) != 24)) {
FreeImage_OutputMessageProc(s_format_id, FI_MSG_WARNING_INVALID_THUMBNAIL);
return FALSE;
}
@@ -1325,22 +1325,22 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// step 5b: allocate dib and init header
- if((cinfo.num_components == 4) && (cinfo.out_color_space == JCS_CMYK)) {
+ if ((cinfo.num_components == 4) && (cinfo.out_color_space == JCS_CMYK)) {
// CMYK image
- if((flags & JPEG_CMYK) == JPEG_CMYK) {
+ if ((flags & JPEG_CMYK) == JPEG_CMYK) {
// load as CMYK
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
+ if (!dib) throw FI_MSG_ERROR_DIB_MEMORY;
FreeImage_GetICCProfile(dib)->flags |= FIICC_COLOR_IS_CMYK;
} else {
// load as CMYK and convert to RGB
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
+ if (!dib) throw FI_MSG_ERROR_DIB_MEMORY;
}
} else {
// RGB or greyscale image
dib = FreeImage_AllocateHeader(header_only, cinfo.output_width, cinfo.output_height, 8 * cinfo.num_components, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
+ if (!dib) throw FI_MSG_ERROR_DIB_MEMORY;
if (cinfo.num_components == 1) {
// build a greyscale palette
@@ -1385,7 +1385,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// step 7a: while (scan lines remain to be read) jpeg_read_scanlines(...);
- if((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) != JPEG_CMYK)) {
+ if ((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) != JPEG_CMYK)) {
// convert from CMYK to RGB
JSAMPARRAY buffer; // output row buffer
@@ -1411,7 +1411,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
dst += 3;
}
}
- } else if((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) == JPEG_CMYK)) {
+ } else if ((cinfo.out_color_space == JCS_CMYK) && ((flags & JPEG_CMYK) == JPEG_CMYK)) {
// convert from LibJPEG CMYK to standard CMYK
JSAMPARRAY buffer; // output row buffer
@@ -1466,7 +1466,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
jpeg_destroy_decompress(&cinfo);
// check for automatic Exif rotation
- if(!header_only && ((flags & JPEG_EXIFROTATE) == JPEG_EXIFROTATE)) {
+ if (!header_only && ((flags & JPEG_EXIFROTATE) == JPEG_EXIFROTATE)) {
rotate_exif(&dib);
}
@@ -1560,12 +1560,12 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
jpeg_set_defaults(&cinfo);
// progressive-JPEG support
- if((flags & JPEG_PROGRESSIVE) == JPEG_PROGRESSIVE) {
+ if ((flags & JPEG_PROGRESSIVE) == JPEG_PROGRESSIVE) {
jpeg_simple_progression(&cinfo);
}
// compute optimal Huffman coding tables for the image
- if((flags & JPEG_OPTIMIZE) == JPEG_OPTIMIZE) {
+ if ((flags & JPEG_OPTIMIZE) == JPEG_OPTIMIZE) {
cinfo.optimize_coding = TRUE;
}
@@ -1590,7 +1590,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
// set subsampling options if required
if(cinfo.in_color_space == JCS_RGB) {
- if((flags & JPEG_SUBSAMPLING_411) == JPEG_SUBSAMPLING_411) {
+ if ((flags & JPEG_SUBSAMPLING_411) == JPEG_SUBSAMPLING_411) {
// 4:1:1 (4x1 1x1 1x1) - CrH 25% - CbH 25% - CrV 100% - CbV 100%
// the horizontal color resolution is quartered
cinfo.comp_info[0].h_samp_factor = 4; // Y
@@ -1599,7 +1599,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1; // Cr
cinfo.comp_info[2].v_samp_factor = 1;
- } else if((flags & JPEG_SUBSAMPLING_420) == JPEG_SUBSAMPLING_420) {
+ } else if ((flags & JPEG_SUBSAMPLING_420) == JPEG_SUBSAMPLING_420) {
// 4:2:0 (2x2 1x1 1x1) - CrH 50% - CbH 50% - CrV 50% - CbV 50%
// the chrominance resolution in both the horizontal and vertical directions is cut in half
cinfo.comp_info[0].h_samp_factor = 2; // Y
@@ -1608,7 +1608,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
cinfo.comp_info[1].v_samp_factor = 1;
cinfo.comp_info[2].h_samp_factor = 1; // Cr
cinfo.comp_info[2].v_samp_factor = 1;
- } else if((flags & JPEG_SUBSAMPLING_422) == JPEG_SUBSAMPLING_422){ //2x1 (low)
+ } else if ((flags & JPEG_SUBSAMPLING_422) == JPEG_SUBSAMPLING_422){ //2x1 (low)
// 4:2:2 (2x1 1x1 1x1) - CrH 50% - CbH 50% - CrV 100% - CbV 100%
// half of the horizontal resolution in the chrominance is dropped (Cb & Cr),
// while the full resolution is retained in the vertical direction, with respect to the luminance
@@ -1619,7 +1619,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
cinfo.comp_info[2].h_samp_factor = 1; // Cr
cinfo.comp_info[2].v_samp_factor = 1;
}
- else if((flags & JPEG_SUBSAMPLING_444) == JPEG_SUBSAMPLING_444){ //1x1 (no subsampling)
+ else if ((flags & JPEG_SUBSAMPLING_444) == JPEG_SUBSAMPLING_444){ //1x1 (no subsampling)
// 4:4:4 (1x1 1x1 1x1) - CrH 100% - CbH 100% - CrV 100% - CbV 100%
// the resolution of chrominance information (Cb & Cr) is preserved
// at the same rate as the luminance (Y) information
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPCD.cpp b/plugins/FreeImage/Source/FreeImage/PluginPCD.cpp
index ff0c5b8679..87cbe967b2 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPCD.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPCD.cpp
@@ -155,7 +155,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
try {
// allocate the dib and write out the header
dib = FreeImage_AllocateHeader(header_only, width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!dib) throw FI_MSG_ERROR_DIB_MEMORY;
+ if (!dib) throw FI_MSG_ERROR_DIB_MEMORY;
if(header_only) {
return dib;
@@ -173,7 +173,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
BYTE *y1 = (BYTE*)malloc(width * sizeof(BYTE));
BYTE *y2 = (BYTE*)malloc(width * sizeof(BYTE));
BYTE *cbcr = (BYTE*)malloc(width * sizeof(BYTE));
- if(!y1 || !y2 || !cbcr) throw FI_MSG_ERROR_MEMORY;
+ if (!y1 || !y2 || !cbcr) throw FI_MSG_ERROR_MEMORY;
BYTE *yl[] = { y1, y2 };
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPCX.cpp b/plugins/FreeImage/Source/FreeImage/PluginPCX.cpp
index cd75629ddc..a6feb5fea7 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPCX.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPCX.cpp
@@ -84,9 +84,9 @@ pcx_validate(FreeImageIO *io, fi_handle handle) {
// version
if(signature[1] <= 5) {
// encoding
- if((signature[2] == 0) || (signature[2] == 1)) {
+ if ((signature[2] == 0) || (signature[2] == 1)) {
// bits per pixel per plane
- if((signature[3] == 1) || (signature[3] == 8)) {
+ if ((signature[3] == 1) || (signature[3] == 8)) {
return TRUE;
}
}
@@ -339,7 +339,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
BYTE *ReadBuf = NULL; // buffer;
BOOL bIsRLE; // True if the file is run-length encoded
- if(!handle) {
+ if (!handle) {
return NULL;
}
@@ -351,7 +351,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
long start_pos = io->tell_proc(handle);
BOOL validated = pcx_validate(io, handle);
io->seek_proc(handle, start_pos, SEEK_SET);
- if(!validated) {
+ if (!validated) {
throw FI_MSG_ERROR_MAGIC_NUMBER;
}
@@ -478,10 +478,10 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// ---------------
line = (BYTE*)malloc(linelength * sizeof(BYTE));
- if(!line) throw FI_MSG_ERROR_MEMORY;
+ if (!line) throw FI_MSG_ERROR_MEMORY;
ReadBuf = (BYTE*)malloc(IO_BUF_SIZE * sizeof(BYTE));
- if(!ReadBuf) throw FI_MSG_ERROR_MEMORY;
+ if (!ReadBuf) throw FI_MSG_ERROR_MEMORY;
bits = FreeImage_GetScanLine(dib, height - 1);
@@ -513,7 +513,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
unsigned x, y, written;
buffer = (BYTE*)malloc(width * sizeof(BYTE));
- if(!buffer) throw FI_MSG_ERROR_MEMORY;
+ if (!buffer) throw FI_MSG_ERROR_MEMORY;
for (y = 0; y < height; y++) {
written = readline(*io, handle, line, linelength, bIsRLE, ReadBuf, &ReadPos);
@@ -553,7 +553,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
free(buffer);
- } else if((header.planes == 3) && (header.bpp == 8)) {
+ } else if ((header.planes == 3) && (header.bpp == 8)) {
BYTE *pline;
for (unsigned y = 0; y < height; y++) {
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPFM.cpp b/plugins/FreeImage/Source/FreeImage/PluginPFM.cpp
index 231e8baa22..8ccbd48ba5 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPFM.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPFM.cpp
@@ -48,7 +48,7 @@ pfm_get_line(FreeImageIO *io, fi_handle handle, char *buffer, int length) {
int i;
memset(buffer, 0, length);
for(i = 0; i < length; i++) {
- if(!io->read_proc(&buffer[i], 1, 1, handle))
+ if (!io->read_proc(&buffer[i], 1, 1, handle))
return FALSE;
if(buffer[i] == 0x0A)
break;
@@ -67,7 +67,7 @@ pfm_get_int(FreeImageIO *io, fi_handle handle) {
// skip forward to start of next number
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
while (1) {
// eat comments
@@ -78,7 +78,7 @@ pfm_get_int(FreeImageIO *io, fi_handle handle) {
firstchar = TRUE;
while (1) {
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
if (firstchar && c == ' ') {
// loop off 1 sp after #
@@ -96,7 +96,7 @@ pfm_get_int(FreeImageIO *io, fi_handle handle) {
break;
}
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
}
// we're at the start of a number, continue until we hit a non-number
@@ -106,7 +106,7 @@ pfm_get_int(FreeImageIO *io, fi_handle handle) {
while (1) {
i = (i * 10) + (c - '0');
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
if (c < '0' || c > '9')
break;
@@ -231,7 +231,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
if(bResult) {
bResult = (sscanf(line_buffer, "%f", &scalefactor) == 1) ? TRUE : FALSE;
}
- if(!bResult) {
+ if (!bResult) {
throw "Read error: invalid PFM header";
}
@@ -251,7 +251,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
if(image_type == FIT_RGBF) {
const unsigned lineWidth = 3 * width;
lineBuffer = (float*)malloc(lineWidth * sizeof(float));
- if(!lineBuffer) {
+ if (!lineBuffer) {
throw FI_MSG_ERROR_MEMORY;
}
@@ -285,7 +285,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
} else if(image_type == FIT_FLOAT) {
const unsigned lineWidth = width;
lineBuffer = (float*)malloc(lineWidth * sizeof(float));
- if(!lineBuffer) {
+ if (!lineBuffer) {
throw FI_MSG_ERROR_MEMORY;
}
@@ -330,10 +330,10 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
static BOOL DLL_CALLCONV
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
- if(!dib || !handle) return FALSE;
+ if (!dib || !handle) return FALSE;
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
- if((image_type != FIT_RGBF) && (image_type != FIT_FLOAT)) {
+ if ((image_type != FIT_RGBF) && (image_type != FIT_FLOAT)) {
return FALSE;
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPICT.cpp b/plugins/FreeImage/Source/FreeImage/PluginPICT.cpp
index 99958a489c..0c44cb2d1f 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPICT.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPICT.cpp
@@ -1168,7 +1168,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// io->seek_proc( handle, 122, SEEK_CUR );
// found = TRUE;
BYTE data[ 2 ];
- if( io->read_proc( data, 2, 1, handle ) ) {
+ if ( io->read_proc( data, 2, 1, handle ) ) {
io->seek_proc( handle, -2, SEEK_CUR );
if ( data[0] == 0xFF && data[1] == 0xD8 ) {
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPNG.cpp b/plugins/FreeImage/Source/FreeImage/PluginPNG.cpp
index b2cddec2b8..ad398a87e8 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPNG.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPNG.cpp
@@ -104,7 +104,7 @@ ReadMetadata(png_structp png_ptr, png_infop info_ptr, FIBITMAP *dib) {
for(int i = 0; i < num_text; i++) {
// create a tag
tag = FreeImage_CreateTag();
- if(!tag) return FALSE;
+ if (!tag) return FALSE;
DWORD tag_length = (DWORD) MAX(text_ptr[i].text_length, text_ptr[i].itxt_length);
@@ -354,7 +354,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
#ifndef FREEIMAGE_BIGENDIAN
- if((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
+ if ((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
// turn on 16 bit byte swapping
png_set_swap(png_ptr);
}
@@ -503,7 +503,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color);
- if((color_type == PNG_COLOR_TYPE_GRAY) && trans_color) {
+ if ((color_type == PNG_COLOR_TYPE_GRAY) && trans_color) {
// single transparent color
if (trans_color->gray < palette_entries) {
BYTE table[256];
@@ -511,7 +511,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
table[trans_color->gray] = 0;
FreeImage_SetTransparencyTable(dib, table, palette_entries);
}
- } else if((color_type == PNG_COLOR_TYPE_PALETTE) && trans_alpha) {
+ } else if ((color_type == PNG_COLOR_TYPE_PALETTE) && trans_alpha) {
// transparency table
FreeImage_SetTransparencyTable(dib, (BYTE *)trans_alpha, num_trans);
}
@@ -726,7 +726,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
pixel_depth = FreeImage_GetBPP(dib);
BOOL bInterlaced = FALSE;
- if( (flags & PNG_INTERLACED) == PNG_INTERLACED) {
+ if ( (flags & PNG_INTERLACED) == PNG_INTERLACED) {
interlace_type = PNG_INTERLACE_ADAM7;
bInterlaced = TRUE;
} else {
@@ -735,9 +735,9 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
// set the ZLIB compression level or default to PNG default compression level (ZLIB level = 6)
int zlib_level = flags & 0x0F;
- if((zlib_level >= 1) && (zlib_level <= 9)) {
+ if ((zlib_level >= 1) && (zlib_level <= 9)) {
png_set_compression_level(png_ptr, zlib_level);
- } else if((flags & PNG_Z_NO_COMPRESSION) == PNG_Z_NO_COMPRESSION) {
+ } else if ((flags & PNG_Z_NO_COMPRESSION) == PNG_Z_NO_COMPRESSION) {
png_set_compression_level(png_ptr, Z_NO_COMPRESSION);
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginPNM.cpp b/plugins/FreeImage/Source/FreeImage/PluginPNM.cpp
index 3155315559..a30f858851 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginPNM.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginPNM.cpp
@@ -37,7 +37,7 @@ GetInt(FreeImageIO *io, fi_handle handle) {
// skip forward to start of next number
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
while (1) {
// eat comments
@@ -48,7 +48,7 @@ GetInt(FreeImageIO *io, fi_handle handle) {
firstchar = TRUE;
while (1) {
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
if (firstchar && c == ' ') {
// loop off 1 sp after #
@@ -66,7 +66,7 @@ GetInt(FreeImageIO *io, fi_handle handle) {
break;
}
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
}
// we're at the start of a number, continue until we hit a non-number
@@ -76,7 +76,7 @@ GetInt(FreeImageIO *io, fi_handle handle) {
while (1) {
i = (i * 10) + (c - '0');
- if(!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
+ if (!io->read_proc(&c, 1, 1, handle)) throw FI_MSG_ERROR_PARSING;
if (c < '0' || c > '9')
break;
@@ -239,9 +239,9 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
int height = GetInt(io, handle);
int maxval = 1;
- if((id_two == '2') || (id_two == '5') || (id_two == '3') || (id_two == '6')) {
+ if ((id_two == '2') || (id_two == '5') || (id_two == '3') || (id_two == '6')) {
maxval = GetInt(io, handle);
- if((maxval <= 0) || (maxval > 65535)) {
+ if ((maxval <= 0) || (maxval > 65535)) {
FreeImage_OutputMessageProc(s_format_id, "Invalid max value : %d", maxval);
throw (const char*)NULL;
}
@@ -539,7 +539,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
char buffer[256]; // temporary buffer whose size should be enough for what we need
- if(!dib || !handle) return FALSE;
+ if (!dib || !handle) return FALSE;
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
diff --git a/plugins/FreeImage/Source/FreeImage/PluginRAS.cpp b/plugins/FreeImage/Source/FreeImage/PluginRAS.cpp
index 08fd558450..08fc0c9e17 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginRAS.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginRAS.cpp
@@ -203,7 +203,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
BYTE *bits; // Pointer to dib data
WORD x, y;
- if(!handle) {
+ if (!handle) {
return NULL;
}
@@ -309,7 +309,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// Read SUN raster colormap
int numcolors = 1 << header.depth;
- if((DWORD)(3 * numcolors) > header.maplength) {
+ if ((DWORD)(3 * numcolors) > header.maplength) {
// some RAS may have less colors than the full palette
numcolors = header.maplength / 3;
} else {
diff --git a/plugins/FreeImage/Source/FreeImage/PluginRAW.cpp b/plugins/FreeImage/Source/FreeImage/PluginRAW.cpp
index 2229cbb20b..4611824f4d 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginRAW.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginRAW.cpp
@@ -79,14 +79,14 @@ public:
virtual int get_char() {
int c = 0;
if(substream) return substream->get_char();
- if(!_io->read_proc(&c, 1, 1, _handle)) return -1;
+ if (!_io->read_proc(&c, 1, 1, _handle)) return -1;
return c;
}
virtual char* gets(char *buffer, int length) {
if (substream) return substream->gets(buffer, length);
memset(buffer, 0, length);
for(int i = 0; i < length; i++) {
- if(!_io->read_proc(&buffer[i], 1, 1, _handle))
+ if (!_io->read_proc(&buffer[i], 1, 1, _handle))
return NULL;
if(buffer[i] == 0x0A)
break;
@@ -137,7 +137,7 @@ libraw_ConvertToDib(libraw_processed_image_t *image) {
if(bpp == 16) {
// allocate output dib
dib = FreeImage_AllocateT(FIT_RGB16, width, height);
- if(!dib) {
+ if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
// write data
@@ -154,7 +154,7 @@ libraw_ConvertToDib(libraw_processed_image_t *image) {
} else if(bpp == 8) {
// allocate output dib
dib = FreeImage_AllocateT(FIT_BITMAP, width, height, 24);
- if(!dib) {
+ if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
// write data
@@ -468,15 +468,15 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// header only mode
dib = FreeImage_AllocateHeaderT(header_only, FIT_RGB16, RawProcessor.imgdata.sizes.width, RawProcessor.imgdata.sizes.height);
}
- else if((flags & RAW_PREVIEW) == RAW_PREVIEW) {
+ else if ((flags & RAW_PREVIEW) == RAW_PREVIEW) {
// try to get the embedded JPEG
dib = libraw_LoadEmbeddedPreview(RawProcessor, 0);
- if(!dib) {
+ if (!dib) {
// no JPEG preview: try to load as 8-bit/sample (i.e. RGB 24-bit)
dib = libraw_LoadRawData(RawProcessor, 8);
}
}
- else if((flags & RAW_DISPLAY) == RAW_DISPLAY) {
+ else if ((flags & RAW_DISPLAY) == RAW_DISPLAY) {
// load raw data as 8-bit/sample (i.e. RGB 24-bit)
dib = libraw_LoadRawData(RawProcessor, 8);
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginSGI.cpp b/plugins/FreeImage/Source/FreeImage/PluginSGI.cpp
index 0fd162b1d4..3ac189e0ef 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginSGI.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginSGI.cpp
@@ -265,7 +265,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// read the Offset Tables
int index_len = height * zsize;
pRowIndex = (LONG*)malloc(index_len * sizeof(LONG));
- if(!pRowIndex) {
+ if (!pRowIndex) {
throw FI_MSG_ERROR_MEMORY;
}
@@ -282,7 +282,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// Discard row size index
for (i = 0; i < (int)(index_len * sizeof(LONG)); i++) {
BYTE packed = 0;
- if( io->read_proc(&packed, sizeof(BYTE), 1, handle) < 1 ) {
+ if ( io->read_proc(&packed, sizeof(BYTE), 1, handle) < 1 ) {
throw SGI_EOF_IN_RLE_INDEX;
}
}
@@ -307,7 +307,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
dib = FreeImage_Allocate(width, height, bitcount);
- if(!dib) {
+ if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginTARGA.cpp b/plugins/FreeImage/Source/FreeImage/PluginTARGA.cpp
index 5fb1f53ee0..4e3f1a720a 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginTARGA.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginTARGA.cpp
@@ -176,7 +176,7 @@ FIBITMAP* TargaThumbnail::toFIBITMAP() {
const unsigned line_size = _depth * _w / 8;
FIBITMAP* dib = FreeImage_Allocate(_w, _h, _depth);
- if(!dib) {
+ if (!dib) {
return NULL;
}
@@ -1203,14 +1203,14 @@ saveRLE(FIBITMAP* dib, FreeImageIO* io, fi_handle handle) {
// read next pixel from dib
- if( x + 1*pixel_size < line_size) {
+ if ( x + 1*pixel_size < line_size) {
AssignPixel(next, (bits + x + 1*pixel_size), pixel_size);
} else {
// last pixel in line
// include current pixel and flush
- if(!has_rle) {
+ if (!has_rle) {
writeToPacket(packet, current, pixel_size);
packet += pixel_size;
@@ -1231,7 +1231,7 @@ saveRLE(FIBITMAP* dib, FreeImageIO* io, fi_handle handle) {
// has rle
- if(!has_rle) {
+ if (!has_rle) {
// flush non rle packet
flushPacket(line, pixel_size, packet_begin, packet, packet_count, has_rle);
diff --git a/plugins/FreeImage/Source/FreeImage/PluginTIFF.cpp b/plugins/FreeImage/Source/FreeImage/PluginTIFF.cpp
index d5db9574da..54f81e0938 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginTIFF.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginTIFF.cpp
@@ -450,7 +450,7 @@ static FIBITMAP*
CreateImageType(BOOL header_only, FREE_IMAGE_TYPE fit, int width, int height, uint16 bitspersample, uint16 samplesperpixel) {
FIBITMAP *dib = NULL;
- if((width < 0) || (height < 0)) {
+ if ((width < 0) || (height < 0)) {
// check for malicious images
return NULL;
}
@@ -462,7 +462,7 @@ CreateImageType(BOOL header_only, FREE_IMAGE_TYPE fit, int width, int height, ui
if(bpp == 16) {
- if((samplesperpixel == 2) && (bitspersample == 8)) {
+ if ((samplesperpixel == 2) && (bitspersample == 8)) {
// 8-bit indexed + 8-bit alpha channel -> convert to 8-bit transparent
dib = FreeImage_AllocateHeader(header_only, width, height, 8);
} else {
@@ -562,7 +562,7 @@ ReadImageType(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel) {
break;
case 48:
// 3 x half float => convert to RGBF
- if((samplesperpixel == 3) && (bitspersample == 16)) {
+ if ((samplesperpixel == 3) && (bitspersample == 16)) {
fit = FIT_RGBF;
}
break;
@@ -683,7 +683,7 @@ WriteCompression(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel, uint1
} else if ((flags & TIFF_LZW) == TIFF_LZW) {
compression = COMPRESSION_LZW;
} else if ((flags & TIFF_JPEG) == TIFF_JPEG) {
- if(((bitsperpixel == 8) && (photometric != PHOTOMETRIC_PALETTE)) || (bitsperpixel == 24)) {
+ if (((bitsperpixel == 8) && (photometric != PHOTOMETRIC_PALETTE)) || (bitsperpixel == 24)) {
compression = COMPRESSION_JPEG;
// RowsPerStrip must be multiple of 8 for JPEG
uint32 rowsperstrip = (uint32) -1;
@@ -736,7 +736,7 @@ WriteCompression(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel, uint1
// and many palette-color images. But natural 24-bit color images and some 8-bit
// grayscale images do much better with differencing.
- if((bitspersample == 8) || (bitspersample == 16)) {
+ if ((bitspersample == 8) || (bitspersample == 16)) {
if ((bitsperpixel >= 8) && (photometric != PHOTOMETRIC_PALETTE)) {
TIFFSetField(tiff, TIFFTAG_PREDICTOR, 2);
} else {
@@ -793,7 +793,7 @@ tiff_read_xmp_profile(TIFF *tiff, FIBITMAP *dib) {
if (TIFFGetField(tiff, TIFFTAG_XMLPACKET, &profile_size, &profile) == 1) {
// create a tag
FITAG *tag = FreeImage_CreateTag();
- if(!tag) return FALSE;
+ if (!tag) return FALSE;
FreeImage_SetTagID(tag, TIFFTAG_XMLPACKET); // 700
FreeImage_SetTagKey(tag, g_TagLib_XMPFieldName);
@@ -832,7 +832,7 @@ tiff_read_exif_profile(TIFF *tiff, FIBITMAP *dib) {
if(TIFFGetField(tiff, TIFFTAG_EXIFIFD, &exif_offset)) {
// read EXIF tags
- if(!TIFFReadEXIFDirectory(tiff, exif_offset)) {
+ if (!TIFFReadEXIFDirectory(tiff, exif_offset)) {
return FALSE;
}
@@ -877,7 +877,7 @@ tiff_write_iptc_profile(TIFF *tiff, FIBITMAP *dib) {
uint32 iptc_size = profile_size;
iptc_size += (4-(iptc_size & 0x03)); // Round up for long word alignment
BYTE *iptc_profile = (BYTE*)malloc(iptc_size);
- if(!iptc_profile) {
+ if (!iptc_profile) {
free(profile);
return FALSE;
}
@@ -1046,7 +1046,7 @@ static void * DLL_CALLCONV
Open(FreeImageIO *io, fi_handle handle, BOOL read) {
// wrapper for TIFF I/O
fi_TIFFIO *fio = (fi_TIFFIO*)malloc(sizeof(fi_TIFFIO));
- if(!fio) return NULL;
+ if (!fio) return NULL;
fio->io = io;
fio->handle = handle;
@@ -1106,7 +1106,7 @@ IsValidBitsPerSample(uint16 photometric, uint16 bitspersample, uint16 samplesper
switch(bitspersample) {
case 1:
case 4:
- if((photometric == PHOTOMETRIC_MINISWHITE) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_PALETTE)) {
+ if ((photometric == PHOTOMETRIC_MINISWHITE) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_PALETTE)) {
return TRUE;
} else {
return FALSE;
@@ -1155,12 +1155,12 @@ FindLoadMethod(TIFF *tif, FREE_IMAGE_TYPE image_type, int flags) {
switch(photometric) {
// convert to 24 or 32 bits RGB if the image is full color
case PHOTOMETRIC_RGB:
- if((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
+ if ((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
// load 48-bit RGB and 64-bit RGBA without conversion
loadMethod = LoadAsGenericStrip;
}
else if(image_type == FIT_RGBF) {
- if((samplesperpixel == 3) && (bitspersample == 16)) {
+ if ((samplesperpixel == 3) && (bitspersample == 16)) {
// load 3 x 16-bit half as RGBF
loadMethod = LoadAsHalfFloat;
}
@@ -1182,7 +1182,7 @@ FindLoadMethod(TIFF *tif, FREE_IMAGE_TYPE image_type, int flags) {
// to avoid multiple conversions. Conversion can be done by changing
// the profile from it's original CMYK to an RGB profile with an
// apropriate color management system. Works with non-tiled TIFFs.
- if(!bIsTiled) {
+ if (!bIsTiled) {
loadMethod = LoadAsCMYK;
}
break;
@@ -1192,7 +1192,7 @@ FindLoadMethod(TIFF *tif, FREE_IMAGE_TYPE image_type, int flags) {
// When samplesperpixel = 2 and bitspersample = 8, set the image as a
// 8-bit indexed image + 8-bit alpha layer image
// and convert to a 8-bit image with a transparency table
- if((samplesperpixel > 1) && (bitspersample == 8)) {
+ if ((samplesperpixel > 1) && (bitspersample == 8)) {
loadMethod = LoadAs8BitTrns;
} else {
loadMethod = LoadAsGenericStrip;
@@ -1203,7 +1203,7 @@ FindLoadMethod(TIFF *tif, FREE_IMAGE_TYPE image_type, int flags) {
break;
}
- if((loadMethod == LoadAsGenericStrip) && bIsTiled) {
+ if ((loadMethod == LoadAsGenericStrip) && bIsTiled) {
loadMethod = LoadAsTiled;
}
@@ -1249,7 +1249,7 @@ ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMA
// ... or read the first subIFD
- if(!thumbnail) {
+ if (!thumbnail) {
uint16 subIFD_count = 0;
uint64* subIFD_offsets = NULL;
// ### Theoretically this should also read the first subIFD from a Photoshop-created file with "pyramid".
@@ -1276,7 +1276,7 @@ ReadThumbnail(FreeImageIO *io, fi_handle handle, void *data, TIFF *tiff, FIBITMA
// ... or read Photoshop thumbnail
- if(!thumbnail) {
+ if (!thumbnail) {
uint32 ps_size = 0;
void *ps_data = NULL;
@@ -1399,7 +1399,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
uint32 *raster = NULL;
- if(!header_only) {
+ if (!header_only) {
raster = (uint32*)_TIFFmalloc(width * height * sizeof(uint32));
if (raster == NULL) {
@@ -1443,7 +1443,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
ReadResolution(tif, dib);
- if(!header_only) {
+ if (!header_only) {
// read the raster lines and save them in the DIB
// with RGB mode, we have to change the order of the 3 samples RGB
@@ -1636,7 +1636,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
alpha = FreeImage_Allocate(width, height, 8);
}
- if(!alpha) {
+ if (!alpha) {
FreeImage_OutputMessageProc(s_format_id, "Failed to allocate temporary alpha channel");
} else {
alpha_bits = FreeImage_GetScanLine(alpha, height - 1);
@@ -1658,7 +1658,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
ReadResolution(tif, dib);
- if(!header_only) {
+ if (!header_only) {
// calculate the line + pitch (separate for scr & dest)
@@ -1706,7 +1706,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
for(BYTE *pixel = bits, *al_pixel = alpha_bits, *src_pixel = buf + l * src_line; pixel < bits + dib_pitch; pixel += dibBpp, al_pixel += alpha_Bpp, src_pixel += srcBpp) {
// copy pixel byte by byte
BYTE b = 0;
- for( ; b < dibBpp; ++b) {
+ for ( ; b < dibBpp; ++b) {
pixel[b] = src_pixel[b];
}
// TODO write the remaining bytes to extra channel(s)
@@ -1814,7 +1814,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
free(buf);
- if(!asCMYK) {
+ if (!asCMYK) {
ConvertCMYKtoRGBA(dib);
// The ICC Profile is invalid, clear it
@@ -1862,7 +1862,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
ReadPalette(tif, photometric, bitspersample, dib);
- if(!header_only) {
+ if (!header_only) {
// calculate the line + pitch (separate for scr & dest)
const tmsize_t src_line = TIFFScanlineSize(tif);
@@ -2000,7 +2000,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
ReadPalette(tif, photometric, bitspersample, dib);
// get the tile geometry
- if(!TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tileWidth) || !TIFFGetField(tif, TIFFTAG_TILELENGTH, &tileHeight)) {
+ if (!TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tileWidth) || !TIFFGetField(tif, TIFFTAG_TILELENGTH, &tileHeight)) {
throw "Invalid tiled TIFF image";
}
@@ -2142,7 +2142,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
ReadResolution(tif, dib);
- if(!header_only) {
+ if (!header_only) {
// calculate the line + pitch (separate for scr & dest)
@@ -2268,7 +2268,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
bitspersample = bitsperpixel / samplesperpixel;
photometric = GetPhotometric(dib);
- if((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
+ if ((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
// 8-bit transparent picture : convert later to 8-bit + 8-bit alpha
samplesperpixel = 2;
bitspersample = 8;
@@ -2276,7 +2276,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
else if(bitsperpixel == 32) {
// 32-bit images : check for CMYK or alpha transparency
- if((((iccProfile->flags & FIICC_COLOR_IS_CMYK) == FIICC_COLOR_IS_CMYK) || ((flags & TIFF_CMYK) == TIFF_CMYK))) {
+ if ((((iccProfile->flags & FIICC_COLOR_IS_CMYK) == FIICC_COLOR_IS_CMYK) || ((flags & TIFF_CMYK) == TIFF_CMYK))) {
// CMYK support
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField(out, TIFFTAG_INKSET, INKSET_CMYK);
@@ -2301,7 +2301,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
samplesperpixel = 4;
bitspersample = bitsperpixel / samplesperpixel;
- if((((iccProfile->flags & FIICC_COLOR_IS_CMYK) == FIICC_COLOR_IS_CMYK) || ((flags & TIFF_CMYK) == TIFF_CMYK))) {
+ if ((((iccProfile->flags & FIICC_COLOR_IS_CMYK) == FIICC_COLOR_IS_CMYK) || ((flags & TIFF_CMYK) == TIFF_CMYK))) {
// CMYK support
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField(out, TIFFTAG_INKSET, INKSET_CMYK);
@@ -2321,7 +2321,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
samplesperpixel = 3;
bitspersample = bitsperpixel / samplesperpixel;
// the library converts to and from floating-point XYZ CIE values
- if((flags & TIFF_LOGLUV) == TIFF_LOGLUV) {
+ if ((flags & TIFF_LOGLUV) == TIFF_LOGLUV) {
photometric = PHOTOMETRIC_LOGLUV;
TIFFSetField(out, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_FLOAT);
// TIFFSetField(out, TIFFTAG_STONITS, 1.0); // assume unknown
@@ -2421,7 +2421,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
// thumbnail tag
- if((ifd == 0) && (ifdCount > 1)) {
+ if ((ifd == 0) && (ifdCount > 1)) {
uint16 nsubifd = 1;
uint64 subifd[1];
subifd[0] = 0;
@@ -2442,7 +2442,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
case 4 :
case 8 :
{
- if((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
+ if ((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
// 8-bit transparent picture : convert to 8-bit + 8-bit alpha
// get the transparency table
@@ -2564,7 +2564,7 @@ SaveOneTIFF(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flag
// write out the directory tag if we wrote a page other than -1 or if we have a thumbnail to write later
- if( (page >= 0) || ((ifd == 0) && (ifdCount > 1)) ) {
+ if ( (page >= 0) || ((ifd == 0) && (ifdCount > 1)) ) {
TIFFWriteDirectory(out);
// else: TIFFClose will WriteDirectory
}
@@ -2594,7 +2594,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
}
bResult = SaveOneTIFF(io, bitmap, handle, page, flags, data, ifd, ifdCount);
- if(!bResult) {
+ if (!bResult) {
return FALSE;
}
}
diff --git a/plugins/FreeImage/Source/FreeImage/PluginXBM.cpp b/plugins/FreeImage/Source/FreeImage/PluginXBM.cpp
index 0aac48ca27..140029e862 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginXBM.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginXBM.cpp
@@ -109,14 +109,14 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
while(!found_declaration && !eof) {
- if( readLine(line, MAX_LINE, io, handle) == NULL) {
+ if ( readLine(line, MAX_LINE, io, handle) == NULL) {
eof = TRUE;
}
else {
- if( strlen( line ) == MAX_LINE - 1 )
+ if ( strlen( line ) == MAX_LINE - 1 )
return( ERR_XBM_LINE );
- if( sscanf(line, "#define %s %d", name_and_type, &v) == 2 ) {
- if( ( t = strrchr( name_and_type, '_' ) ) == NULL )
+ if ( sscanf(line, "#define %s %d", name_and_type, &v) == 2 ) {
+ if ( ( t = strrchr( name_and_type, '_' ) ) == NULL )
t = name_and_type;
else
t++;
@@ -127,11 +127,11 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
continue;
}
- if( sscanf( line, "static short %s = {", name_and_type ) == 1 ) {
+ if ( sscanf( line, "static short %s = {", name_and_type ) == 1 ) {
version = 10;
found_declaration = TRUE;
}
- else if( sscanf( line, "static char %s = {", name_and_type ) == 1 ) {
+ else if ( sscanf( line, "static char %s = {", name_and_type ) == 1 ) {
version = 11;
found_declaration = TRUE;
}
@@ -142,12 +142,12 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
}
}
- if(!found_declaration)
+ if (!found_declaration)
return( ERR_XBM_DECL );
- if(*widthP == -1 )
+ if (*widthP == -1 )
return( ERR_XBM_WIDTH );
- if( *heightP == -1 )
+ if ( *heightP == -1 )
return( ERR_XBM_HEIGHT );
padding = 0;
@@ -189,7 +189,7 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
hex_table['f'] = 15;
if(version == 10) {
- for( bytes = 0, ptr = *dataP; bytes < raster_length; bytes += 2 ) {
+ for ( bytes = 0, ptr = *dataP; bytes < raster_length; bytes += 2 ) {
while( ( c1 = readChar(io, handle) ) != 'x' ) {
if ( c1 == EOF )
return( ERR_XBM_EOFREAD );
@@ -197,14 +197,14 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
c1 = readChar(io, handle);
c2 = readChar(io, handle);
- if( c1 == EOF || c2 == EOF )
+ if ( c1 == EOF || c2 == EOF )
return( ERR_XBM_EOFREAD );
value1 = ( hex_table[c1] << 4 ) + hex_table[c2];
if ( value1 >= 256 )
return( ERR_XBM_SYNTAX );
c1 = readChar(io, handle);
c2 = readChar(io, handle);
- if( c1 == EOF || c2 == EOF )
+ if ( c1 == EOF || c2 == EOF )
return( ERR_XBM_EOFREAD );
value2 = ( hex_table[c1] << 4 ) + hex_table[c2];
if ( value2 >= 256 )
@@ -219,7 +219,7 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
/*
** skip until digit is found
*/
- for( ; ; ) {
+ for ( ; ; ) {
c1 = readChar(io, handle);
if ( c1 == EOF )
return( ERR_XBM_EOFREAD );
@@ -230,7 +230,7 @@ readXBMFile(FreeImageIO *io, fi_handle handle, int *widthP, int *heightP, char *
/*
** loop on digits
*/
- for( ; ; ) {
+ for ( ; ; ) {
c2 = readChar(io, handle);
if ( c2 == EOF )
return( ERR_XBM_EOFREAD );
@@ -327,7 +327,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
// allocate a new dib
dib = FreeImage_Allocate(width, height, 1);
- if(!dib) throw (char*)ERR_XBM_MEMORY;
+ if (!dib) throw (char*)ERR_XBM_MEMORY;
// write the palette data
RGBQUAD *pal = FreeImage_GetPalette(dib);
@@ -347,7 +347,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
count = 0;
mask = 1;
}
- if(*bP & mask) {
+ if (*bP & mask) {
// Set bit(x, y) to 0
bits[x >> 3] &= (0xFF7F >> (x & 0x7));
} else {
diff --git a/plugins/FreeImage/Source/FreeImage/PluginXPM.cpp b/plugins/FreeImage/Source/FreeImage/PluginXPM.cpp
index a698321958..16db443c47 100644
--- a/plugins/FreeImage/Source/FreeImage/PluginXPM.cpp
+++ b/plugins/FreeImage/Source/FreeImage/PluginXPM.cpp
@@ -53,7 +53,7 @@ FindChar(FreeImageIO *io, fi_handle handle, BYTE look_for) {
BYTE c;
io->read_proc(&c, sizeof(BYTE), 1, handle);
while(c != look_for) {
- if( io->read_proc(&c, sizeof(BYTE), 1, handle) != 1 )
+ if ( io->read_proc(&c, sizeof(BYTE), 1, handle) != 1 )
return FALSE;
}
return TRUE;
@@ -62,14 +62,14 @@ FindChar(FreeImageIO *io, fi_handle handle, BYTE look_for) {
// find start of string, read data until ending quote found, allocate memory and return a string
static char *
ReadString(FreeImageIO *io, fi_handle handle) {
- if( !FindChar(io, handle,'"') )
+ if ( !FindChar(io, handle,'"') )
return NULL;
BYTE c;
std::string s;
io->read_proc(&c, sizeof(BYTE), 1, handle);
while(c != '"') {
s += c;
- if( io->read_proc(&c, sizeof(BYTE), 1, handle) != 1 )
+ if ( io->read_proc(&c, sizeof(BYTE), 1, handle) != 1 )
return NULL;
}
char *cstr = (char *)malloc(s.length()+1);
@@ -166,16 +166,16 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
//find the starting brace
- if( !FindChar(io, handle,'{') )
+ if ( !FindChar(io, handle,'{') )
throw "Could not find starting brace";
//read info string
str = ReadString(io, handle);
- if(!str)
+ if (!str)
throw "Error reading info string";
int width, height, colors, cpp;
- if( sscanf(str, "%d %d %d %d", &width, &height, &colors, &cpp) != 4 ) {
+ if ( sscanf(str, "%d %d %d %d", &width, &height, &colors, &cpp) != 4 ) {
free(str);
throw "Improperly formed info string";
}
@@ -193,7 +193,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
FILE_RGBA rgba;
str = ReadString(io, handle);
- if(!str)
+ if (!str)
throw "Error reading color strings";
std::string chrs(str,cpp); //create a string for the color chars using the first cpp chars
@@ -207,14 +207,14 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
}
//prefer the color visual
- if( strstr(keys," c ") ) {
+ if ( strstr(keys," c ") ) {
char *clr = strstr(keys," c ") + 3;
while( *clr == ' ' ) clr++; //find the start of the hex rgb value
- if( *clr == '#' ) {
+ if ( *clr == '#' ) {
int red = 0, green = 0, blue = 0, n;
clr++;
//end string at first space, if any found
- if( strchr(clr,' ') )
+ if ( strchr(clr,' ') )
*(strchr(clr,' ')) = '\0';
//parse hex color, it can be #rgb #rrggbb #rrrgggbbb or #rrrrggggbbbb
switch( strlen(clr) ) {
@@ -239,14 +239,14 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
n = 0;
break;
}
- if( n != 3 ) {
+ if ( n != 3 ) {
free(str);
throw "Improperly formed hex color value";
}
rgba.r = (BYTE)red;
rgba.g = (BYTE)green;
rgba.b = (BYTE)blue;
- } else if( !strncmp(clr,"None",4) || !strncmp(clr,"none",4) ) {
+ } else if ( !strncmp(clr,"None",4) || !strncmp(clr,"none",4) ) {
rgba.r = rgba.g = rgba.b = 0xFF;
} else {
char *tmp = clr;
@@ -256,8 +256,8 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
//part of the color name. How many named color end with a 1 or 2 character
//word? Probably none in our list at least.
while( (tmp = strchr(tmp,' ')) != NULL ) {
- if( tmp[1] != ' ' ) {
- if( (tmp[2] == ' ') || (tmp[2] != ' ' && tmp[3] == ' ') ) {
+ if ( tmp[1] != ' ' ) {
+ if ( (tmp[2] == ' ') || (tmp[2] != ' ' && tmp[3] == ' ') ) {
tmp[0] = '\0';
break;
}
@@ -288,7 +288,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
rawpal[chrs] = rgba;
//build palette if needed
- if( colors <= 256 ) {
+ if ( colors <= 256 ) {
RGBQUAD *pal = FreeImage_GetPalette(dib);
pal[i].rgbBlue = rgba.b;
pal[i].rgbGreen = rgba.g;
@@ -308,7 +308,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
for(int y = 0; y < height; y++ ) {
BYTE *line = FreeImage_GetScanLine(dib, height - y - 1);
str = ReadString(io, handle);
- if(!str)
+ if (!str)
throw "Error reading pixel strings";
char *pixel_ptr = str;
@@ -317,7 +317,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
std::string chrs(pixel_ptr,cpp);
FILE_RGBA rgba = rawpal[chrs];
- if( colors > 256 ) {
+ if ( colors > 256 ) {
line[FI_RGBA_BLUE] = rgba.b;
line[FI_RGBA_GREEN] = rgba.g;
line[FI_RGBA_RED] = rgba.r;
@@ -338,7 +338,7 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
} catch(const char *text) {
FreeImage_OutputMessageProc(s_format_id, text);
- if( dib != NULL )
+ if ( dib != NULL )
FreeImage_Unload(dib);
return NULL;
@@ -355,7 +355,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
footer[] = "\"\n};\n",
buf[256]; //256 is more then enough to sprintf 4 ints into, or the base-92 chars and #rrggbb line
- if( io->write_proc(header, (unsigned int)strlen(header), 1, handle) != 1 )
+ if ( io->write_proc(header, (unsigned int)strlen(header), 1, handle) != 1 )
return FALSE;
int width = FreeImage_GetWidth(dib), height = FreeImage_GetHeight(dib), bpp = FreeImage_GetBPP(dib);
@@ -378,7 +378,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
for(x = 0; x < width; x++ ) {
FILE_RGB rgb;
DWORDRGBA u;
- if( bpp > 8 ) {
+ if ( bpp > 8 ) {
u.rgba.b = rgb.b = line[FI_RGBA_BLUE];
u.rgba.g = rgb.g = line[FI_RGBA_GREEN];
u.rgba.r = rgb.r = line[FI_RGBA_RED];
@@ -391,7 +391,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
rgb.r = pal[u.index].rgbRed;
line++;
}
- if( color2chrs.find(u.index) == color2chrs.end() ) { //new color
+ if ( color2chrs.find(u.index) == color2chrs.end() ) { //new color
std::string chrs(Base92(num_colors));
color2chrs[u.index] = chrs;
chrs2color[num_colors] = rgb;
@@ -403,22 +403,22 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
int cpp = (int)(log((double)num_colors)/log(92.0)) + 1;
sprintf(buf, "%d %d %d %d", FreeImage_GetWidth(dib), FreeImage_GetHeight(dib), num_colors, cpp );
- if( io->write_proc(buf, (unsigned int)strlen(buf), 1, handle) != 1 )
+ if ( io->write_proc(buf, (unsigned int)strlen(buf), 1, handle) != 1 )
return FALSE;
- if( io->write_proc(start_colors, (unsigned int)strlen(start_colors), 1, handle) != 1 )
+ if ( io->write_proc(start_colors, (unsigned int)strlen(start_colors), 1, handle) != 1 )
return FALSE;
//write colors, using map of chrs->rgb
for(x = 0; x < num_colors; x++ ) {
sprintf(buf, "%*s c #%02x%02x%02x", cpp, Base92(x), chrs2color[x].r, chrs2color[x].g, chrs2color[x].b );
- if( io->write_proc(buf, (unsigned int)strlen(buf), 1, handle) != 1 )
+ if ( io->write_proc(buf, (unsigned int)strlen(buf), 1, handle) != 1 )
return FALSE;
- if( x == num_colors - 1 ) {
- if( io->write_proc(start_pixels, (unsigned int)strlen(start_pixels), 1, handle) != 1 )
+ if ( x == num_colors - 1 ) {
+ if ( io->write_proc(start_pixels, (unsigned int)strlen(start_pixels), 1, handle) != 1 )
return FALSE;
} else {
- if( io->write_proc(new_line, (unsigned int)strlen(new_line), 1, handle) != 1 )
+ if ( io->write_proc(new_line, (unsigned int)strlen(new_line), 1, handle) != 1 )
return FALSE;
}
}
@@ -429,7 +429,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
BYTE *line = FreeImage_GetScanLine(dib, height - y - 1);
for(x = 0; x < width; x++ ) {
DWORDRGBA u;
- if( bpp > 8 ) {
+ if ( bpp > 8 ) {
u.rgba.b = line[FI_RGBA_BLUE];
u.rgba.g = line[FI_RGBA_GREEN];
u.rgba.r = line[FI_RGBA_RED];
@@ -440,14 +440,14 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void
line++;
}
sprintf(buf, "%*s", cpp, (char *)color2chrs[u.index].c_str());
- if( io->write_proc(buf, cpp, 1, handle) != 1 )
+ if ( io->write_proc(buf, cpp, 1, handle) != 1 )
return FALSE;
}
- if( y == height - 1 ) {
- if( io->write_proc(footer, (unsigned int)strlen(footer), 1, handle) != 1 )
+ if ( y == height - 1 ) {
+ if ( io->write_proc(footer, (unsigned int)strlen(footer), 1, handle) != 1 )
return FALSE;
} else {
- if( io->write_proc(new_line, (unsigned int)strlen(new_line), 1, handle) != 1 )
+ if ( io->write_proc(new_line, (unsigned int)strlen(new_line), 1, handle) != 1 )
return FALSE;
}
}
diff --git a/plugins/FreeImage/Source/FreeImage/ToneMapping.cpp b/plugins/FreeImage/Source/FreeImage/ToneMapping.cpp
index 27f8c95a07..33ae08ea59 100644
--- a/plugins/FreeImage/Source/FreeImage/ToneMapping.cpp
+++ b/plugins/FreeImage/Source/FreeImage/ToneMapping.cpp
@@ -38,7 +38,7 @@ FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param, dou
switch(tmo) {
// Adaptive logarithmic mapping (F. Drago, 2003)
case FITMO_DRAGO03:
- if((first_param == 0) && (second_param == 0)) {
+ if ((first_param == 0) && (second_param == 0)) {
// use default values (gamma = 2.2, exposure = 0)
return FreeImage_TmoDrago03(dib, 2.2, 0);
} else {
@@ -48,7 +48,7 @@ FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param, dou
break;
// Dynamic range reduction inspired by photoreceptor phhysiology (E. Reinhard, 2005)
case FITMO_REINHARD05:
- if((first_param == 0) && (second_param == 0)) {
+ if ((first_param == 0) && (second_param == 0)) {
// use default values by setting intensity to 0 and contrast to 0
return FreeImage_TmoReinhard05(dib, 0, 0);
} else {
@@ -58,7 +58,7 @@ FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param, dou
break;
// Gradient Domain HDR Compression (R. Fattal, 2002)
case FITMO_FATTAL02:
- if((first_param == 0) && (second_param == 0)) {
+ if ((first_param == 0) && (second_param == 0)) {
// use default values by setting color saturation to 0.5 and attenuation to 0.85
return FreeImage_TmoFattal02(dib, 0.5, 0.85);
} else {
diff --git a/plugins/FreeImage/Source/FreeImage/WuQuantizer.cpp b/plugins/FreeImage/Source/FreeImage/WuQuantizer.cpp
index 041eae368b..532fbfc3e6 100644
--- a/plugins/FreeImage/Source/FreeImage/WuQuantizer.cpp
+++ b/plugins/FreeImage/Source/FreeImage/WuQuantizer.cpp
@@ -66,7 +66,7 @@ WuQuantizer::WuQuantizer(FIBITMAP *dib) {
// Allocate Qadd
Qadd = (WORD *)malloc(sizeof(WORD) * width * height);
- if(!gm2 || !wt || !mr || !mg || !mb || !Qadd) {
+ if (!gm2 || !wt || !mr || !mg || !mb || !Qadd) {
if(gm2) free(gm2);
if(wt) free(wt);
if(mr) free(mr);
@@ -127,10 +127,10 @@ WuQuantizer::Hist3D(LONG *vwt, LONG *vmr, LONG *vmg, LONG *vmb, float *m2, int R
}
}
- if( ReserveSize > 0 ) {
+ if ( ReserveSize > 0 ) {
int max = 0;
for(i = 0; i < SIZE_3D; i++) {
- if( vwt[i] > max ) max = vwt[i];
+ if ( vwt[i] > max ) max = vwt[i];
}
max++;
for(i = 0; i < ReserveSize; i++) {
diff --git a/plugins/FreeImage/Source/FreeImage/tmoColorConvert.cpp b/plugins/FreeImage/Source/FreeImage/tmoColorConvert.cpp
index 66869b2806..c40ee29c60 100644
--- a/plugins/FreeImage/Source/FreeImage/tmoColorConvert.cpp
+++ b/plugins/FreeImage/Source/FreeImage/tmoColorConvert.cpp
@@ -275,7 +275,7 @@ ClampConvertRGBFTo24(FIBITMAP *src) {
const unsigned height = FreeImage_GetHeight(src);
FIBITMAP *dst = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!dst) return NULL;
+ if (!dst) return NULL;
const unsigned src_pitch = FreeImage_GetPitch(src);
const unsigned dst_pitch = FreeImage_GetPitch(dst);
@@ -321,7 +321,7 @@ ConvertRGBFToY(FIBITMAP *src) {
const unsigned height = FreeImage_GetHeight(src);
FIBITMAP *dst = FreeImage_AllocateT(FIT_FLOAT, width, height);
- if(!dst) return NULL;
+ if (!dst) return NULL;
const unsigned src_pitch = FreeImage_GetPitch(src);
const unsigned dst_pitch = FreeImage_GetPitch(dst);
@@ -444,7 +444,7 @@ NormalizeY(FIBITMAP *Y, float minPrct, float maxPrct) {
int pitch = FreeImage_GetPitch(Y);
// find max & min luminance values
- if((minPrct > 0) || (maxPrct < 1)) {
+ if ((minPrct > 0) || (maxPrct < 1)) {
maxLum = 0, minLum = 0;
findMaxMinPercentile(Y, minPrct, &minLum, maxPrct, &maxLum);
} else {
diff --git a/plugins/FreeImage/Source/FreeImage/tmoDrago03.cpp b/plugins/FreeImage/Source/FreeImage/tmoDrago03.cpp
index a61534474d..b820bb3577 100644
--- a/plugins/FreeImage/Source/FreeImage/tmoDrago03.cpp
+++ b/plugins/FreeImage/Source/FreeImage/tmoDrago03.cpp
@@ -258,13 +258,13 @@ FIBITMAP* DLL_CALLCONV
FreeImage_TmoDrago03(FIBITMAP *src, double gamma, double exposure) {
float maxLum, minLum, avgLum;
- if(!FreeImage_HasPixels(src)) return NULL;
+ if (!FreeImage_HasPixels(src)) return NULL;
// working RGBF variable
FIBITMAP *dib = NULL;
dib = FreeImage_ConvertToRGBF(src);
- if(!dib) return NULL;
+ if (!dib) return NULL;
// default algorithm parameters
const float biasParam = 0.85F;
diff --git a/plugins/FreeImage/Source/FreeImage/tmoFattal02.cpp b/plugins/FreeImage/Source/FreeImage/tmoFattal02.cpp
index c458246c6f..71be370b3e 100644
--- a/plugins/FreeImage/Source/FreeImage/tmoFattal02.cpp
+++ b/plugins/FreeImage/Source/FreeImage/tmoFattal02.cpp
@@ -54,7 +54,7 @@ static FIBITMAP* GaussianLevel5x5(FIBITMAP *dib) {
h_dib = FreeImage_AllocateT(image_type, width, height);
v_dib = FreeImage_AllocateT(image_type, width, height);
- if(!h_dib || !v_dib) throw(1);
+ if (!h_dib || !v_dib) throw(1);
const unsigned pitch = FreeImage_GetPitch(dib) / sizeof(float);
@@ -166,7 +166,7 @@ static FIBITMAP* GradientLevel(FIBITMAP *H, float *avgGrad, int k) {
const unsigned height = FreeImage_GetHeight(H);
G = FreeImage_AllocateT(image_type, width, height);
- if(!G) throw(1);
+ if (!G) throw(1);
const unsigned pitch = FreeImage_GetPitch(H) / sizeof(float);
@@ -246,7 +246,7 @@ static FIBITMAP* PhiMatrix(FIBITMAP **gradients, float *avgGrad, int nlevels, fl
try {
phi = (FIBITMAP**)malloc(nlevels * sizeof(FIBITMAP*));
- if(!phi) throw(1);
+ if (!phi) throw(1);
memset(phi, 0, nlevels * sizeof(FIBITMAP*));
for(int k = nlevels-1; k >= 0; k--) {
@@ -266,7 +266,7 @@ static FIBITMAP* PhiMatrix(FIBITMAP **gradients, float *avgGrad, int nlevels, fl
if(ALPHA == 0) ALPHA = EPSILON;
phi[k] = FreeImage_AllocateT(FIT_FLOAT, width, height);
- if(!phi[k]) throw(1);
+ if (!phi[k]) throw(1);
src_pixel = (float*)FreeImage_GetBits(Gk);
dst_pixel = (float*)FreeImage_GetBits(phi[k]);
@@ -285,7 +285,7 @@ static FIBITMAP* PhiMatrix(FIBITMAP **gradients, float *avgGrad, int nlevels, fl
if(k < nlevels-1) {
// compute PHI(k) = L( PHI(k+1) ) * phi(k)
FIBITMAP *L = FreeImage_Rescale(phi[k+1], width, height, FILTER_BILINEAR);
- if(!L) throw(1);
+ if (!L) throw(1);
src_pixel = (float*)FreeImage_GetBits(L);
dst_pixel = (float*)FreeImage_GetBits(phi[k]);
@@ -345,9 +345,9 @@ static FIBITMAP* Divergence(FIBITMAP *H, FIBITMAP *PHI) {
const unsigned height = FreeImage_GetHeight(H);
Gx = FreeImage_AllocateT(image_type, width, height);
- if(!Gx) throw(1);
+ if (!Gx) throw(1);
Gy = FreeImage_AllocateT(image_type, width, height);
- if(!Gy) throw(1);
+ if (!Gy) throw(1);
const unsigned pitch = FreeImage_GetPitch(H) / sizeof(float);
@@ -377,7 +377,7 @@ static FIBITMAP* Divergence(FIBITMAP *H, FIBITMAP *PHI) {
// calculate the divergence
divG = FreeImage_AllocateT(image_type, width, height);
- if(!divG) throw(1);
+ if (!divG) throw(1);
gx = (float*)FreeImage_GetBits(Gx);
gy = (float*)FreeImage_GetBits(Gy);
@@ -421,7 +421,7 @@ static FIBITMAP* LogLuminance(FIBITMAP *Y) {
try {
// get the luminance channel
FIBITMAP *H = FreeImage_Clone(Y);
- if(!H) throw(1);
+ if (!H) throw(1);
const unsigned width = FreeImage_GetWidth(H);
const unsigned height = FreeImage_GetHeight(H);
@@ -509,7 +509,7 @@ static FIBITMAP* tmoFattal02(FIBITMAP *Y, float alpha, float beta) {
try {
// get the normalized luminance
FIBITMAP *H = LogLuminance(Y);
- if(!H) throw(1);
+ if (!H) throw(1);
// get the number of levels for the pyramid
const unsigned width = FreeImage_GetWidth(H);
@@ -522,19 +522,19 @@ static FIBITMAP* tmoFattal02(FIBITMAP *Y, float alpha, float beta) {
// create the Gaussian pyramid
pyramid = (FIBITMAP**)malloc(nlevels * sizeof(FIBITMAP*));
- if(!pyramid) throw(1);
+ if (!pyramid) throw(1);
memset(pyramid, 0, nlevels * sizeof(FIBITMAP*));
- if(!GaussianPyramid(H, pyramid, nlevels)) throw(1);
+ if (!GaussianPyramid(H, pyramid, nlevels)) throw(1);
// calculate gradient magnitude and its average value on each pyramid level
gradients = (FIBITMAP**)malloc(nlevels * sizeof(FIBITMAP*));
- if(!gradients) throw(1);
+ if (!gradients) throw(1);
memset(gradients, 0, nlevels * sizeof(FIBITMAP*));
avgGrad = (float*)malloc(nlevels * sizeof(float));
- if(!avgGrad) throw(1);
+ if (!avgGrad) throw(1);
- if(!GradientPyramid(pyramid, nlevels, gradients, avgGrad)) throw(1);
+ if (!GradientPyramid(pyramid, nlevels, gradients, avgGrad)) throw(1);
// free the Gaussian pyramid
for(k = 0; k < nlevels; k++) {
@@ -544,7 +544,7 @@ static FIBITMAP* tmoFattal02(FIBITMAP *Y, float alpha, float beta) {
// compute the gradient attenuation function PHI(x, y)
phy = PhiMatrix(gradients, avgGrad, nlevels, alpha, beta);
- if(!phy) throw(1);
+ if (!phy) throw(1);
// free the gradient pyramid
for(k = 0; k < nlevels; k++) {
@@ -556,7 +556,7 @@ static FIBITMAP* tmoFattal02(FIBITMAP *Y, float alpha, float beta) {
// compute gradients in x and y directions, attenuate them with the attenuation matrix,
// then compute the divergence div G from the attenuated gradient.
divG = Divergence(H, phy);
- if(!divG) throw(1);
+ if (!divG) throw(1);
// H & phy no longer needed
FreeImage_Unload(H); H = NULL;
@@ -564,7 +564,7 @@ static FIBITMAP* tmoFattal02(FIBITMAP *Y, float alpha, float beta) {
// solve the PDE (Poisson equation) using a multigrid solver and 3 cycles
FIBITMAP *U = FreeImage_MultigridPoissonSolver(divG, 3);
- if(!U) throw(1);
+ if (!U) throw(1);
FreeImage_Unload(divG);
@@ -618,21 +618,21 @@ FreeImage_TmoFattal02(FIBITMAP *dib, double color_saturation, double attenuation
FIBITMAP *Yout = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
try {
// convert to RGBF
src = FreeImage_ConvertToRGBF(dib);
- if(!src) throw(1);
+ if (!src) throw(1);
// get the luminance channel
Yin = ConvertRGBFToY(src);
- if(!Yin) throw(1);
+ if (!Yin) throw(1);
// perform the tone mapping
Yout = tmoFattal02(Yin, alpha, beta);
- if(!Yout) throw(1);
+ if (!Yout) throw(1);
// clip low and high values and normalize to [0..1]
//NormalizeY(Yout, 0.001F, 0.995F);
diff --git a/plugins/FreeImage/Source/FreeImage/tmoReinhard05.cpp b/plugins/FreeImage/Source/FreeImage/tmoReinhard05.cpp
index f91b41c062..dfa6553806 100644
--- a/plugins/FreeImage/Source/FreeImage/tmoReinhard05.cpp
+++ b/plugins/FreeImage/Source/FreeImage/tmoReinhard05.cpp
@@ -59,7 +59,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo
// check input parameters
- if((FreeImage_GetImageType(dib) != FIT_RGBF) || (FreeImage_GetImageType(Y) != FIT_FLOAT)) {
+ if ((FreeImage_GetImageType(dib) != FIT_RGBF) || (FreeImage_GetImageType(Y) != FIT_FLOAT)) {
return FALSE;
}
@@ -81,7 +81,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo
// get statistics about the data (but only if its really needed)
f = exp(-f);
- if((m == 0) || (a != 1) && (c != 1)) {
+ if ((m == 0) || (a != 1) && (c != 1)) {
// avoid these calculations if its not needed after ...
LuminanceFromY(Y, &maxLum, &minLum, &Lav, &Llav);
k = (log(maxLum) - Llav) / (log(maxLum) - log(minLum));
@@ -103,7 +103,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo
bits = (BYTE*)FreeImage_GetBits(dib);
Ybits = (BYTE*)FreeImage_GetBits(Y);
- if((a == 1) && (c == 0)) {
+ if ((a == 1) && (c == 0)) {
// when using default values, use a fastest code
for(y = 0; y < height; y++) {
@@ -131,7 +131,7 @@ ToneMappingReinhard05(FIBITMAP *dib, FIBITMAP *Y, float f, float m, float a, flo
// channel averages
Cav[0] = Cav[1] = Cav[2] = 0;
- if((a != 1) && (c != 0)) {
+ if ((a != 1) && (c != 0)) {
// channel averages are not needed when (a == 1) or (c == 0)
bits = (BYTE*)FreeImage_GetBits(dib);
for(y = 0; y < height; y++) {
@@ -215,17 +215,17 @@ User parameters control intensity, contrast, and level of adaptation
*/
FIBITMAP* DLL_CALLCONV
FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity, double contrast, double adaptation, double color_correction) {
- if(!FreeImage_HasPixels(src)) return NULL;
+ if (!FreeImage_HasPixels(src)) return NULL;
// working RGBF variable
FIBITMAP *dib = NULL, *Y = NULL;
dib = FreeImage_ConvertToRGBF(src);
- if(!dib) return NULL;
+ if (!dib) return NULL;
// get the Luminance channel
Y = ConvertRGBFToY(dib);
- if(!Y) {
+ if (!Y) {
FreeImage_Unload(dib);
return NULL;
}
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp b/plugins/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp
index 690db87d8c..e4be1d0bd2 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp
@@ -556,7 +556,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x
// allocate output image
FIBITMAP *dst = FreeImage_Allocate(width, height, bpp);
- if(!dst)
+ if (!dst)
return NULL;
// buid a grey scale palette
RGBQUAD *pal = FreeImage_GetPalette(dst);
@@ -566,7 +566,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x
// allocate a temporary array
ImageRasterArray = (double*)malloc(width * height * sizeof(double));
- if(!ImageRasterArray) {
+ if (!ImageRasterArray) {
FreeImage_Unload(dst);
return NULL;
}
@@ -583,7 +583,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x
// convert between a representation based on image samples
// and a representation based on image B-spline coefficients
bResult = SamplesToCoefficients(ImageRasterArray, width, height, spline);
- if(!bResult) {
+ if (!bResult) {
FreeImage_Unload(dst);
free(ImageRasterArray);
return NULL;
@@ -611,7 +611,7 @@ Rotate8Bit(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x
x1 = x0 + a11 * (double)x;
y1 = y0 + a21 * (double)x;
if(use_mask) {
- if((x1 <= -0.5) || (((double)width - 0.5) <= x1) || (y1 <= -0.5) || (((double)height - 0.5) <= y1)) {
+ if ((x1 <= -0.5) || (((double)width - 0.5) <= x1) || (y1 <= -0.5) || (((double)height - 0.5) <= y1)) {
p = 0;
}
else {
@@ -652,7 +652,7 @@ FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift,
BYTE *src_bits, *dst_bits;
FIBITMAP *src8 = NULL, *dst8 = NULL, *dst = NULL;
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
try {
@@ -666,20 +666,20 @@ FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift,
}
return dst_8;
}
- if((bpp == 24) || (bpp == 32)) {
+ if ((bpp == 24) || (bpp == 32)) {
// allocate dst image
int width = FreeImage_GetWidth(dib);
int height = FreeImage_GetHeight(dib);
- if( bpp == 24 ) {
+ if ( bpp == 24 ) {
dst = FreeImage_Allocate(width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
} else {
dst = FreeImage_Allocate(width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
}
- if(!dst) throw(1);
+ if (!dst) throw(1);
// allocate a temporary 8-bit dib (no need to build a palette)
src8 = FreeImage_Allocate(width, height, 8);
- if(!src8) throw(1);
+ if (!src8) throw(1);
// process each channel separately
// -------------------------------
@@ -698,7 +698,7 @@ FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift,
// process channel
dst8 = Rotate8Bit(src8, angle, x_shift, y_shift, x_origin, y_origin, ROTATE_CUBIC, use_mask);
- if(!dst8) throw(1);
+ if (!dst8) throw(1);
// insert channel to destination dib
for(y = 0; y < height; y++) {
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/Channels.cpp b/plugins/FreeImage/Source/FreeImageToolkit/Channels.cpp
index 5f01ad815f..f6e6c5509c 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/Channels.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/Channels.cpp
@@ -31,7 +31,7 @@
FIBITMAP * DLL_CALLCONV
FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
- if(!FreeImage_HasPixels(src)) return NULL;
+ if (!FreeImage_HasPixels(src)) return NULL;
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(src);
unsigned bpp = FreeImage_GetBPP(src);
@@ -63,7 +63,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
unsigned width = FreeImage_GetWidth(src);
unsigned height = FreeImage_GetHeight(src);
FIBITMAP *dst = FreeImage_Allocate(width, height, 8) ;
- if(!dst) return NULL;
+ if (!dst) return NULL;
// build a greyscale palette
RGBQUAD *pal = FreeImage_GetPalette(dst);
for(int i = 0; i < 256; i++) {
@@ -90,7 +90,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
}
// 48-bit RGB or 64-bit RGBA images
- if((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
+ if ((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
int c;
// select the channel to extract (always RGB[A])
@@ -116,7 +116,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
unsigned width = FreeImage_GetWidth(src);
unsigned height = FreeImage_GetHeight(src);
FIBITMAP *dst = FreeImage_AllocateT(FIT_UINT16, width, height) ;
- if(!dst) return NULL;
+ if (!dst) return NULL;
// perform extraction
@@ -138,7 +138,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
}
// 96-bit RGBF or 128-bit RGBAF images
- if((image_type == FIT_RGBF) || (image_type == FIT_RGBAF)) {
+ if ((image_type == FIT_RGBF) || (image_type == FIT_RGBAF)) {
int c;
// select the channel to extract (always RGB[A])
@@ -164,7 +164,7 @@ FreeImage_GetChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
unsigned width = FreeImage_GetWidth(src);
unsigned height = FreeImage_GetHeight(src);
FIBITMAP *dst = FreeImage_AllocateT(FIT_FLOAT, width, height) ;
- if(!dst) return NULL;
+ if (!dst) return NULL;
// perform extraction
@@ -199,32 +199,32 @@ BOOL DLL_CALLCONV
FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
int c;
- if(!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
+ if (!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
// src and dst images should have the same width and height
unsigned src_width = FreeImage_GetWidth(src);
unsigned src_height = FreeImage_GetHeight(src);
unsigned dst_width = FreeImage_GetWidth(dst);
unsigned dst_height = FreeImage_GetHeight(dst);
- if((src_width != dst_width) || (src_height != dst_height))
+ if ((src_width != dst_width) || (src_height != dst_height))
return FALSE;
// src image should be grayscale, dst image should be RGB or RGBA
FREE_IMAGE_COLOR_TYPE src_type = FreeImage_GetColorType(src);
FREE_IMAGE_COLOR_TYPE dst_type = FreeImage_GetColorType(dst);
- if((dst_type != FIC_RGB) && (dst_type != FIC_RGBALPHA) || (src_type != FIC_MINISBLACK)) {
+ if ((dst_type != FIC_RGB) && (dst_type != FIC_RGBALPHA) || (src_type != FIC_MINISBLACK)) {
return FALSE;
}
FREE_IMAGE_TYPE src_image_type = FreeImage_GetImageType(src);
FREE_IMAGE_TYPE dst_image_type = FreeImage_GetImageType(dst);
- if((dst_image_type == FIT_BITMAP) && (src_image_type == FIT_BITMAP)) {
+ if ((dst_image_type == FIT_BITMAP) && (src_image_type == FIT_BITMAP)) {
// src image should be grayscale, dst image should be 24- or 32-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
- if((src_bpp != 8) || (dst_bpp != 24) && (dst_bpp != 32))
+ if ((src_bpp != 8) || (dst_bpp != 24) && (dst_bpp != 32))
return FALSE;
@@ -263,12 +263,12 @@ FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL chan
return TRUE;
}
- if(((dst_image_type == FIT_RGB16) || (dst_image_type == FIT_RGBA16)) && (src_image_type == FIT_UINT16)) {
+ if (((dst_image_type == FIT_RGB16) || (dst_image_type == FIT_RGBA16)) && (src_image_type == FIT_UINT16)) {
// src image should be grayscale, dst image should be 48- or 64-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
- if((src_bpp != 16) || (dst_bpp != 48) && (dst_bpp != 64))
+ if ((src_bpp != 16) || (dst_bpp != 48) && (dst_bpp != 64))
return FALSE;
@@ -307,12 +307,12 @@ FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL chan
return TRUE;
}
- if(((dst_image_type == FIT_RGBF) || (dst_image_type == FIT_RGBAF)) && (src_image_type == FIT_FLOAT)) {
+ if (((dst_image_type == FIT_RGBF) || (dst_image_type == FIT_RGBAF)) && (src_image_type == FIT_FLOAT)) {
// src image should be grayscale, dst image should be 96- or 128-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
- if((src_bpp != 32) || (dst_bpp != 96) && (dst_bpp != 128))
+ if ((src_bpp != 32) || (dst_bpp != 96) && (dst_bpp != 128))
return FALSE;
@@ -367,14 +367,14 @@ FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
double *dst_bits = NULL;
FIBITMAP *dst = NULL;
- if(!FreeImage_HasPixels(src)) return NULL;
+ if (!FreeImage_HasPixels(src)) return NULL;
if(FreeImage_GetImageType(src) == FIT_COMPLEX) {
// allocate a dib of type FIT_DOUBLE
unsigned width = FreeImage_GetWidth(src);
unsigned height = FreeImage_GetHeight(src);
dst = FreeImage_AllocateT(FIT_DOUBLE, width, height) ;
- if(!dst) return NULL;
+ if (!dst) return NULL;
// perform extraction
@@ -415,7 +415,7 @@ FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel) {
src_bits = (FICOMPLEX *)FreeImage_GetScanLine(src, y);
dst_bits = (double *)FreeImage_GetScanLine(dst, y);
for(x = 0; x < width; x++) {
- if((src_bits[x].r == 0) && (src_bits[x].i == 0)) {
+ if ((src_bits[x].r == 0) && (src_bits[x].i == 0)) {
phase = 0;
} else {
phase = atan2(src_bits[x].i, src_bits[x].r);
@@ -446,12 +446,12 @@ FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANN
double *src_bits = NULL;
FICOMPLEX *dst_bits = NULL;
- if(!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
+ if (!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
// src image should be of type FIT_DOUBLE, dst image should be of type FIT_COMPLEX
const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(src);
const FREE_IMAGE_TYPE dst_type = FreeImage_GetImageType(dst);
- if((src_type != FIT_DOUBLE) || (dst_type != FIT_COMPLEX))
+ if ((src_type != FIT_DOUBLE) || (dst_type != FIT_COMPLEX))
return FALSE;
// src and dst images should have the same width and height
@@ -459,7 +459,7 @@ FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANN
unsigned src_height = FreeImage_GetHeight(src);
unsigned dst_width = FreeImage_GetWidth(dst);
unsigned dst_height = FreeImage_GetHeight(dst);
- if((src_width != dst_width) || (src_height != dst_height))
+ if ((src_width != dst_width) || (src_height != dst_height))
return FALSE;
// select the channel to modify
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp b/plugins/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp
index 83c2f92123..7046a4acc9 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp
@@ -63,7 +63,7 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh
// background
const T pxlBlack[4] = {0, 0, 0, 0 };
const T *pxlBkg = static_cast<const T*>(bkcolor); // assume at least bytespp and 4*sizeof(T) max
- if(!pxlBkg) {
+ if (!pxlBkg) {
// default background color is black
pxlBkg = pxlBlack;
}
@@ -98,7 +98,7 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh
}
// check boundaries
iXPos = i + iOffset;
- if((iXPos >= 0) && (iXPos < (int)dst_width)) {
+ if ((iXPos >= 0) && (iXPos < (int)dst_width)) {
// update left over on source
for(unsigned j = 0; j < samples; j++) {
pxlSrc[j] = pxlSrc[j] - (pxlLeft[j] - pxlOldLeft[j]);
@@ -115,7 +115,7 @@ HorizontalSkewT(FIBITMAP *src, FIBITMAP *dst, int row, int iOffset, double weigh
// go to rightmost point of skew
iXPos = src_width + iOffset;
- if((iXPos >= 0) && (iXPos < (int)dst_width)) {
+ if ((iXPos >= 0) && (iXPos < (int)dst_width)) {
dst_bits = FreeImage_GetScanLine(dst, row) + iXPos * bytespp;
// If still in image bounds, put leftovers there
@@ -194,7 +194,7 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight,
// background
const T pxlBlack[4] = {0, 0, 0, 0 };
const T *pxlBkg = static_cast<const T*>(bkcolor); // assume at least bytespp and 4*sizeof(T) max
- if(!pxlBkg) {
+ if (!pxlBkg) {
// default background color is black
pxlBkg = pxlBlack;
}
@@ -235,7 +235,7 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight,
}
// check boundaries
iYPos = i + iOffset;
- if((iYPos >= 0) && (iYPos < (int)dst_height)) {
+ if ((iYPos >= 0) && (iYPos < (int)dst_height)) {
// update left over on source
for(unsigned j = 0; j < samples; j++) {
pxlSrc[j] = pxlSrc[j] - (pxlLeft[j] - pxlOldLeft[j]);
@@ -252,7 +252,7 @@ VerticalSkewT(FIBITMAP *src, FIBITMAP *dst, int col, int iOffset, double weight,
// go to bottom point of skew
iYPos = src_height + iOffset;
- if((iYPos >= 0) && (iYPos < (int)dst_height)) {
+ if ((iYPos >= 0) && (iYPos < (int)dst_height)) {
dst_bits = FreeImage_GetScanLine(dst, iYPos) + index;
// if still in image bounds, put leftovers there
@@ -367,7 +367,7 @@ Rotate90(FIBITMAP *src) {
}
}
}
- else if((bpp == 8) || (bpp == 24) || (bpp == 32)) {
+ else if ((bpp == 8) || (bpp == 24) || (bpp == 32)) {
// anything other than BW :
// This optimized version of rotation rotates image by smaller blocks. It is quite
// a bit faster than obvious algorithm, because it produces much less CPU cache misses.
@@ -472,7 +472,7 @@ Rotate180(FIBITMAP *src) {
}
break;
}
- // else if((bpp == 8) || (bpp == 24) || (bpp == 32)) FALL TROUGH
+ // else if ((bpp == 8) || (bpp == 24) || (bpp == 32)) FALL TROUGH
case FIT_UINT16:
case FIT_RGB16:
case FIT_RGBA16:
@@ -559,7 +559,7 @@ Rotate270(FIBITMAP *src) {
}
}
}
- else if((bpp == 8) || (bpp == 24) || (bpp == 32)) {
+ else if ((bpp == 8) || (bpp == 24) || (bpp == 32)) {
// anything other than BW :
// This optimized version of rotation rotates image by smaller blocks. It is quite
// a bit faster than obvious algorithm, because it produces much less CPU cache misses.
@@ -767,7 +767,7 @@ RotateAny(FIBITMAP *src, double dAngle, const void *bkcolor) {
// Bring angle to range of [0 .. 360)
dAngle += 360;
}
- if((dAngle > 45) && (dAngle <= 135)) {
+ if ((dAngle > 45) && (dAngle <= 135)) {
// Angle in (45 .. 135]
// Rotate image by 90 degrees into temporary image,
// so it requires only an extra rotation angle
@@ -775,7 +775,7 @@ RotateAny(FIBITMAP *src, double dAngle, const void *bkcolor) {
image = Rotate90(src);
dAngle -= 90;
}
- else if((dAngle > 135) && (dAngle <= 225)) {
+ else if ((dAngle > 135) && (dAngle <= 225)) {
// Angle in (135 .. 225]
// Rotate image by 180 degrees into temporary image,
// so it requires only an extra rotation angle
@@ -783,7 +783,7 @@ RotateAny(FIBITMAP *src, double dAngle, const void *bkcolor) {
image = Rotate180(src);
dAngle -= 180;
}
- else if((dAngle > 225) && (dAngle <= 315)) {
+ else if ((dAngle > 225) && (dAngle <= 315)) {
// Angle in (225 .. 315]
// Rotate image by 270 degrees into temporary image,
// so it requires only an extra rotation angle
@@ -825,7 +825,7 @@ RotateAny(FIBITMAP *src, double dAngle, const void *bkcolor) {
FIBITMAP *DLL_CALLCONV
FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor) {
- if(!FreeImage_HasPixels(dib)) return NULL;
+ if (!FreeImage_HasPixels(dib)) return NULL;
if(0 == angle) {
return FreeImage_Clone(dib);
@@ -846,7 +846,7 @@ FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor) {
// perform the rotation
FIBITMAP *dst = RotateAny(dib, angle, bkcolor);
- if(!dst) throw(1);
+ if (!dst) throw(1);
// build a greyscale palette
RGBQUAD *dst_pal = FreeImage_GetPalette(dst);
@@ -863,9 +863,9 @@ FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor) {
return dst;
}
- else if((bpp == 8) || (bpp == 24) || (bpp == 32)) {
+ else if ((bpp == 8) || (bpp == 24) || (bpp == 32)) {
FIBITMAP *dst = RotateAny(dib, angle, bkcolor);
- if(!dst) throw(1);
+ if (!dst) throw(1);
if(bpp == 8) {
// copy original palette to rotated bitmap
@@ -878,7 +878,7 @@ FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor) {
// copy background color
RGBQUAD bkcolor;
- if( FreeImage_GetBackgroundColor(dib, &bkcolor) ) {
+ if ( FreeImage_GetBackgroundColor(dib, &bkcolor) ) {
FreeImage_SetBackgroundColor(dst, &bkcolor);
}
@@ -898,7 +898,7 @@ FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor) {
case FIT_RGBAF:
{
FIBITMAP *dst = RotateAny(dib, angle, bkcolor);
- if(!dst) throw(1);
+ if (!dst) throw(1);
// copy metadata from src to dst
FreeImage_CloneMetadata(dst, dib);
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/Colors.cpp b/plugins/FreeImage/Source/FreeImageToolkit/Colors.cpp
index 67191768bb..8b9bbd6482 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/Colors.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/Colors.cpp
@@ -108,7 +108,7 @@ FreeImage_Invert(FIBITMAP *src) {
return FALSE;
}
}
- else if((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
+ else if ((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
// Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit)
const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD);
@@ -149,11 +149,11 @@ FreeImage_AdjustCurve(FIBITMAP *src, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel
unsigned x, y;
BYTE *bits = NULL;
- if(!FreeImage_HasPixels(src) || !LUT || (FreeImage_GetImageType(src) != FIT_BITMAP))
+ if (!FreeImage_HasPixels(src) || !LUT || (FreeImage_GetImageType(src) != FIT_BITMAP))
return FALSE;
int bpp = FreeImage_GetBPP(src);
- if((bpp != 8) && (bpp != 24) && (bpp != 32))
+ if ((bpp != 8) && (bpp != 24) && (bpp != 32))
return FALSE;
// apply the LUT
@@ -271,7 +271,7 @@ BOOL DLL_CALLCONV
FreeImage_AdjustGamma(FIBITMAP *src, double gamma) {
BYTE LUT[256]; // Lookup table
- if(!FreeImage_HasPixels(src) || (gamma <= 0))
+ if (!FreeImage_HasPixels(src) || (gamma <= 0))
return FALSE;
// Build the lookup table
@@ -302,7 +302,7 @@ FreeImage_AdjustBrightness(FIBITMAP *src, double percentage) {
BYTE LUT[256]; // Lookup table
double value;
- if(!FreeImage_HasPixels(src))
+ if (!FreeImage_HasPixels(src))
return FALSE;
// Build the lookup table
@@ -328,7 +328,7 @@ FreeImage_AdjustContrast(FIBITMAP *src, double percentage) {
BYTE LUT[256]; // Lookup table
double value;
- if(!FreeImage_HasPixels(src))
+ if (!FreeImage_HasPixels(src))
return FALSE;
// Build the lookup table
@@ -357,7 +357,7 @@ FreeImage_GetHistogram(FIBITMAP *src, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL cha
BYTE *bits = NULL;
unsigned x, y;
- if(!FreeImage_HasPixels(src) || !histo) return FALSE;
+ if (!FreeImage_HasPixels(src) || !histo) return FALSE;
unsigned width = FreeImage_GetWidth(src);
unsigned height = FreeImage_GetHeight(src);
@@ -377,7 +377,7 @@ FreeImage_GetHistogram(FIBITMAP *src, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL cha
}
return TRUE;
}
- else if((bpp == 24) || (bpp == 32)) {
+ else if ((bpp == 24) || (bpp == 32)) {
int bytespp = bpp / 8; // bytes / pixel
// clear histogram array
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp b/plugins/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp
index e4b8155739..59757287ed 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp
@@ -58,12 +58,12 @@ Combine1(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
BOOL value;
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 1) || (FreeImage_GetBPP(src_dib) != 1)) {
+ if ((FreeImage_GetBPP(dst_dib) != 1) || (FreeImage_GetBPP(src_dib) != 1)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -97,12 +97,12 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
BOOL bOddStart, bOddEnd;
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 4) || (FreeImage_GetBPP(src_dib) != 4)) {
+ if ((FreeImage_GetBPP(dst_dib) != 4) || (FreeImage_GetBPP(src_dib) != 4)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -196,12 +196,12 @@ Combine4(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
static BOOL
Combine8(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned alpha) {
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 8) || (FreeImage_GetBPP(src_dib) != 8)) {
+ if ((FreeImage_GetBPP(dst_dib) != 8) || (FreeImage_GetBPP(src_dib) != 8)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -238,12 +238,12 @@ Combine8(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
static BOOL
Combine16_555(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned alpha) {
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 16) || (FreeImage_GetBPP(src_dib) != 16)) {
+ if ((FreeImage_GetBPP(dst_dib) != 16) || (FreeImage_GetBPP(src_dib) != 16)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -298,12 +298,12 @@ Combine16_555(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi
static BOOL
Combine16_565(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned alpha) {
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 16) || (FreeImage_GetBPP(src_dib) != 16)) {
+ if ((FreeImage_GetBPP(dst_dib) != 16) || (FreeImage_GetBPP(src_dib) != 16)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -362,12 +362,12 @@ Combine16_565(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsi
static BOOL
Combine24(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned alpha) {
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 24) || (FreeImage_GetBPP(src_dib) != 24)) {
+ if ((FreeImage_GetBPP(dst_dib) != 24) || (FreeImage_GetBPP(src_dib) != 24)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -404,12 +404,12 @@ Combine24(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned
static BOOL
Combine32(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y, unsigned alpha) {
// check the bit depth of src and dst images
- if((FreeImage_GetBPP(dst_dib) != 32) || (FreeImage_GetBPP(src_dib) != 32)) {
+ if ((FreeImage_GetBPP(dst_dib) != 32) || (FreeImage_GetBPP(src_dib) != 32)) {
return FALSE;
}
// check the size of src image
- if((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
+ if ((x + FreeImage_GetWidth(src_dib) > FreeImage_GetWidth(dst_dib)) || (y + FreeImage_GetHeight(src_dib) > FreeImage_GetHeight(dst_dib))) {
return FALSE;
}
@@ -459,7 +459,7 @@ CombineSameType(FIBITMAP *dst_dib, FIBITMAP *src_dib, unsigned x, unsigned y) {
unsigned dst_pitch = FreeImage_GetPitch(dst_dib);
// check the size of src image
- if((x + src_width > dst_width) || (y + src_height > dst_height)) {
+ if ((x + src_width > dst_width) || (y + src_height > dst_height)) {
return FALSE;
}
@@ -493,7 +493,7 @@ Works with any bitmap type.
FIBITMAP * DLL_CALLCONV
FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) {
- if(!FreeImage_HasPixels(src))
+ if (!FreeImage_HasPixels(src))
return NULL;
// normalize the rectangle
@@ -506,7 +506,7 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) {
// check the size of the sub image
int src_width = FreeImage_GetWidth(src);
int src_height = FreeImage_GetHeight(src);
- if((left < 0) || (right > src_width) || (top < 0) || (bottom > src_height)) {
+ if ((left < 0) || (right > src_width) || (top < 0) || (bottom > src_height)) {
return NULL;
}
@@ -608,7 +608,7 @@ FreeImage_Copy(FIBITMAP *src, int left, int top, int right, int bottom) {
// copy background color
RGBQUAD bkcolor;
- if( FreeImage_GetBackgroundColor(src, &bkcolor) ) {
+ if ( FreeImage_GetBackgroundColor(src, &bkcolor) ) {
FreeImage_SetBackgroundColor(dst, &bkcolor);
}
@@ -639,13 +639,13 @@ BOOL DLL_CALLCONV
FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha) {
BOOL bResult = FALSE;
- if(!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
+ if (!FreeImage_HasPixels(src) || !FreeImage_HasPixels(dst)) return FALSE;
// check the size of src image
- if((left < 0) || (top < 0)) {
+ if ((left < 0) || (top < 0)) {
return FALSE;
}
- if((left + FreeImage_GetWidth(src) > FreeImage_GetWidth(dst)) || (top + FreeImage_GetHeight(src) > FreeImage_GetHeight(dst))) {
+ if ((left + FreeImage_GetWidth(src) > FreeImage_GetWidth(dst)) || (top + FreeImage_GetHeight(src) > FreeImage_GetHeight(dst))) {
return FALSE;
}
@@ -704,7 +704,7 @@ FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha) {
return FALSE;
}
- if(!clone) return FALSE;
+ if (!clone) return FALSE;
// paste src to dst
switch(FreeImage_GetBPP(dst)) {
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/Display.cpp b/plugins/FreeImage/Source/FreeImageToolkit/Display.cpp
index 245c5c3a18..3e4807042d 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/Display.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/Display.cpp
@@ -40,20 +40,20 @@ For colour images, the computation is done separately for R, G, and B samples.
*/
FIBITMAP * DLL_CALLCONV
FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP *bg) {
- if(!FreeImage_HasPixels(fg)) return NULL;
+ if (!FreeImage_HasPixels(fg)) return NULL;
int width = FreeImage_GetWidth(fg);
int height = FreeImage_GetHeight(fg);
int bpp = FreeImage_GetBPP(fg);
- if((bpp != 8) && (bpp != 32))
+ if ((bpp != 8) && (bpp != 32))
return NULL;
if(bg) {
int bg_width = FreeImage_GetWidth(bg);
int bg_height = FreeImage_GetHeight(bg);
int bg_bpp = FreeImage_GetBPP(bg);
- if((bg_width != width) || (bg_height != height) || (bg_bpp != 24))
+ if ((bg_width != width) || (bg_height != height) || (bg_bpp != 24))
return NULL;
}
@@ -71,7 +71,7 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP
// allocate the composite image
FIBITMAP *composite = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- if(!composite) return NULL;
+ if (!composite) return NULL;
// get the palette
RGBQUAD *pal = FreeImage_GetPalette(fg);
@@ -133,7 +133,7 @@ FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP
// background color
- if(!bHasBkColor) {
+ if (!bHasBkColor) {
if(bg) {
// get the background color from the background image
bkc.rgbBlue = bg_bits[FI_RGBA_BLUE];
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp b/plugins/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp
index 5822f748a6..c5345497f5 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp
@@ -61,7 +61,7 @@ ls_jpeg_error_exit (j_common_ptr cinfo) {
(*cinfo->err->output_message)(cinfo);
// allow JPEG with a premature end of file
- if((cinfo)->err->msg_parm.i[0] != 13) {
+ if ((cinfo)->err->msg_parm.i[0] != 13) {
// let the memory manager delete any temp files before we die
jpeg_destroy(cinfo);
@@ -171,7 +171,7 @@ LosslessTransform(const FilenameIO *filenameIO, FREE_IMAGE_JPEG_OPERATION operat
// crop option
if(crop != NULL) {
- if(!jtransform_parse_crop_spec(&transfoptions, crop)) {
+ if (!jtransform_parse_crop_spec(&transfoptions, crop)) {
FreeImage_OutputMessageProc(FIF_JPEG, "Bogus crop argument %s", crop);
throw(1);
}
@@ -180,14 +180,14 @@ LosslessTransform(const FilenameIO *filenameIO, FREE_IMAGE_JPEG_OPERATION operat
// Open the input file
if(bUseUnicode) {
#ifdef _WIN32
- if((fp = _wfopen(filenameIO->wsrc_file, L"rb")) == NULL) {
+ if ((fp = _wfopen(filenameIO->wsrc_file, L"rb")) == NULL) {
FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open input file for reading");
}
#else
fp = NULL;
#endif // _WIN32
} else {
- if((fp = fopen(filenameIO->src_file, "rb")) == NULL) {
+ if ((fp = fopen(filenameIO->src_file, "rb")) == NULL) {
FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open %s for reading", filenameIO->src_file);
}
}
@@ -211,7 +211,7 @@ LosslessTransform(const FilenameIO *filenameIO, FREE_IMAGE_JPEG_OPERATION operat
// Prepare transformation workspace
// Fails right away if perfect flag is TRUE and transformation is not perfect
- if( !jtransform_request_workspace(&srcinfo, &transfoptions) ) {
+ if ( !jtransform_request_workspace(&srcinfo, &transfoptions) ) {
FreeImage_OutputMessageProc(FIF_JPEG, "Transformation is not perfect");
throw(1);
}
@@ -237,14 +237,14 @@ LosslessTransform(const FilenameIO *filenameIO, FREE_IMAGE_JPEG_OPERATION operat
// Open the output file
if(bUseUnicode) {
#ifdef _WIN32
- if((fp = _wfopen(filenameIO->wdst_file, L"wb")) == NULL) {
+ if ((fp = _wfopen(filenameIO->wdst_file, L"wb")) == NULL) {
FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open output file for writing");
}
#else
fp = NULL;
#endif // _WIN32
} else {
- if((fp = fopen(filenameIO->dst_file, "wb")) == NULL) {
+ if ((fp = fopen(filenameIO->dst_file, "wb")) == NULL) {
FreeImage_OutputMessageProc(FIF_JPEG, "Cannot open %s for writing", filenameIO->dst_file);
}
}
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp b/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp
index 3b577cbd0a..6d17d45319 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp
@@ -311,7 +311,7 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) {
#define _CREATE_ARRAY_GRID_(array, array_size) \
array = (FIBITMAP**)malloc(array_size * sizeof(FIBITMAP*));\
- if(!array) throw(1);\
+ if (!array) throw(1);\
memset(array, 0, array_size * sizeof(FIBITMAP*))
#define _FREE_ARRAY_GRID_(array, array_size) \
@@ -351,7 +351,7 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) {
// allocate storage for r.h.s. on grid (ng - 2) ...
IRHO[ngrid] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IRHO[ngrid]) throw(1);
+ if (!IRHO[ngrid]) throw(1);
// ... and fill it by restricting from the fine grid
fmg_restrict(IRHO[ngrid], U, nn);
@@ -361,16 +361,16 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) {
nn = nn/2 + 1;
ngrid--;
IRHO[ngrid] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IRHO[ngrid]) throw(1);
+ if (!IRHO[ngrid]) throw(1);
fmg_restrict(IRHO[ngrid], IRHO[ngrid+1], nn);
}
nn = 3;
IU[0] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IU[0]) throw(1);
+ if (!IU[0]) throw(1);
IRHS[0] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IRHS[0]) throw(1);
+ if (!IRHS[0]) throw(1);
// initial solution on coarsest grid
fmg_solve(IU[0], IRHO[0]);
@@ -384,11 +384,11 @@ static BOOL fmg_mglin(FIBITMAP *U, int n, int ncycle) {
nn = 2*nn - 1;
IU[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IU[j]) throw(1);
+ if (!IU[j]) throw(1);
IRHS[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IRHS[j]) throw(1);
+ if (!IRHS[j]) throw(1);
IRES[j] = FreeImage_AllocateT(FIT_FLOAT, nn, nn);
- if(!IRES[j]) throw(1);
+ if (!IRES[j]) throw(1);
fmg_prolongate(IU[j], IU[j-1], nn);
@@ -464,7 +464,7 @@ where j is such that 2^j is the nearest larger dimension corresponding to MAX(im
*/
FIBITMAP* DLL_CALLCONV
FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) {
- if(!FreeImage_HasPixels(Laplacian)) return NULL;
+ if (!FreeImage_HasPixels(Laplacian)) return NULL;
int width = FreeImage_GetWidth(Laplacian);
int height = FreeImage_GetHeight(Laplacian);
@@ -473,7 +473,7 @@ FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) {
int n = MAX(width, height);
int size = 0;
while((n >>= 1) > 0) size++;
- if((1 << size) < MAX(width, height)) {
+ if ((1 << size) < MAX(width, height)) {
size++;
}
// size must be of the form 2^j + 1 for some integer j
@@ -481,7 +481,7 @@ FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle) {
// allocate a temporary square image I
FIBITMAP *I = FreeImage_AllocateT(FIT_FLOAT, size, size);
- if(!I) return NULL;
+ if (!I) return NULL;
// copy Laplacian into I and shift pixels to create a boundary
FreeImage_Paste(I, Laplacian, 1, 1, 255);
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/Rescale.cpp b/plugins/FreeImage/Source/FreeImageToolkit/Rescale.cpp
index d957d9cb5e..e79e5f456c 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/Rescale.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/Rescale.cpp
@@ -52,7 +52,7 @@ FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTE
break;
}
- if(!pFilter) {
+ if (!pFilter) {
return NULL;
}
@@ -60,7 +60,7 @@ FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTE
// perform upsampling or downsampling
- if((FreeImage_GetBPP(src) == 4) || (FreeImage_GetColorType(src) == FIC_PALETTE)) {
+ if ((FreeImage_GetBPP(src) == 4) || (FreeImage_GetColorType(src) == FIC_PALETTE)) {
// special case for 4-bit images or color map indexed images ...
if(FreeImage_IsTransparent(src) == FALSE) {
FIBITMAP *src24 = NULL;
@@ -68,10 +68,10 @@ FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTE
try {
// transparent conversion to 24-bit (any transparency table will be destroyed)
src24 = FreeImage_ConvertTo24Bits(src);
- if(!src24) throw(1);
+ if (!src24) throw(1);
// perform upsampling or downsampling
dst24 = Engine.scale(src24, dst_width, dst_height);
- if(!dst24) throw(1);
+ if (!dst24) throw(1);
FreeImage_Unload(src24); src24 = NULL;
// color quantize to 8-bit
dst = FreeImage_ColorQuantize(dst24, FIQ_NNQUANT);
@@ -86,10 +86,10 @@ FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTE
try {
// transparent conversion to 32-bit (keep transparency)
src32 = FreeImage_ConvertTo32Bits(src);
- if(!src32) throw(1);
+ if (!src32) throw(1);
// perform upsampling or downsampling
dst = Engine.scale(src32, dst_width, dst_height);
- if(!dst) throw(1);
+ if (!dst) throw(1);
// free and return
FreeImage_Unload(src32);
} catch(int) {
@@ -98,16 +98,16 @@ FreeImage_Rescale(FIBITMAP *src, int dst_width, int dst_height, FREE_IMAGE_FILTE
}
}
}
- else if((FreeImage_GetBPP(src) == 16) && (FreeImage_GetImageType(src) == FIT_BITMAP)) {
+ else if ((FreeImage_GetBPP(src) == 16) && (FreeImage_GetImageType(src) == FIT_BITMAP)) {
// convert 16-bit RGB to 24-bit
FIBITMAP *src24 = NULL;
try {
// transparent conversion to 24-bit (any transparency table will be destroyed)
src24 = FreeImage_ConvertTo24Bits(src);
- if(!src24) throw(1);
+ if (!src24) throw(1);
// perform upsampling or downsampling
dst = Engine.scale(src24, dst_width, dst_height);
- if(!dst) throw(1);
+ if (!dst) throw(1);
// free and return
FreeImage_Unload(src24);
} catch(int) {
@@ -137,14 +137,14 @@ FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert) {
FIBITMAP *thumbnail = NULL;
int new_width, new_height;
- if(!FreeImage_HasPixels(dib) || (max_pixel_size <= 0)) return NULL;
+ if (!FreeImage_HasPixels(dib) || (max_pixel_size <= 0)) return NULL;
int width = FreeImage_GetWidth(dib);
int height = FreeImage_GetHeight(dib);
if(max_pixel_size == 0) max_pixel_size = 1;
- if((width < max_pixel_size) && (height < max_pixel_size)) {
+ if ((width < max_pixel_size) && (height < max_pixel_size)) {
// image is smaller than the requested thumbnail
return FreeImage_Clone(dib);
}
@@ -192,7 +192,7 @@ FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert) {
break;
}
- if((thumbnail != NULL) && (image_type != FIT_BITMAP) && convert) {
+ if ((thumbnail != NULL) && (image_type != FIT_BITMAP) && convert) {
// convert to a standard bitmap
FIBITMAP *bitmap = NULL;
switch(image_type) {
diff --git a/plugins/FreeImage/Source/FreeImageToolkit/Resize.cpp b/plugins/FreeImage/Source/FreeImageToolkit/Resize.cpp
index 5dcec62af0..5421bd47ab 100644
--- a/plugins/FreeImage/Source/FreeImageToolkit/Resize.cpp
+++ b/plugins/FreeImage/Source/FreeImageToolkit/Resize.cpp
@@ -68,7 +68,7 @@ CWeightsTable::CWeightsTable(CGenericFilter *pFilter, unsigned uDstSize, unsigne
int iRight = MIN ((int)ceil (dCenter + dWidth), int(uSrcSize) - 1);
// cut edge points to fit in filter window in case of spill-off
- if((iRight - iLeft + 1) > int(m_WindowSize)) {
+ if ((iRight - iLeft + 1) > int(m_WindowSize)) {
if(iLeft < (int(uSrcSize) - 1 / 2)) {
iLeft++;
} else {
@@ -87,7 +87,7 @@ CWeightsTable::CWeightsTable(CGenericFilter *pFilter, unsigned uDstSize, unsigne
m_WeightTable[u].Weights[iSrc-iLeft] = weight;
dTotalWeight += weight;
}
- if((dTotalWeight > 0) && (dTotalWeight != 1)) {
+ if ((dTotalWeight > 0) && (dTotalWeight != 1)) {
// normalize weight of neighbouring points
for(iSrc = iLeft; iSrc <= iRight; iSrc++) {
// normalize point
@@ -149,7 +149,7 @@ FIBITMAP* CResizeEngine::scale(FIBITMAP *src, unsigned dst_width, unsigned dst_h
// allocate the dst image
FIBITMAP *dst = FreeImage_AllocateT(image_type, dst_width, dst_height, bpp, redMask, greenMask, blueMask);
- if(!dst) return NULL;
+ if (!dst) return NULL;
if(bpp == 8) {
if(FreeImage_GetColorType(src) == FIC_MINISWHITE) {
@@ -191,7 +191,7 @@ FIBITMAP* CResizeEngine::scale(FIBITMAP *src, unsigned dst_width, unsigned dst_h
// allocate a temporary image
FIBITMAP *tmp = FreeImage_AllocateT(image_type, dst_width, src_height, bpp, redMask, greenMask, blueMask);
- if(!tmp) {
+ if (!tmp) {
FreeImage_Unload(dst);
return NULL;
}
@@ -211,7 +211,7 @@ FIBITMAP* CResizeEngine::scale(FIBITMAP *src, unsigned dst_width, unsigned dst_h
// allocate a temporary image
FIBITMAP *tmp = FreeImage_AllocateT(image_type, src_width, dst_height, bpp, redMask, greenMask, blueMask);
- if(!tmp) {
+ if (!tmp) {
FreeImage_Unload(dst);
return NULL;
}
diff --git a/plugins/FreeImage/Source/LibPNG/pngrutil.c b/plugins/FreeImage/Source/LibPNG/pngrutil.c
index 7b4557f5a3..995896dbc5 100644
--- a/plugins/FreeImage/Source/LibPNG/pngrutil.c
+++ b/plugins/FreeImage/Source/LibPNG/pngrutil.c
@@ -3115,7 +3115,7 @@ png_combine_row(png_structp png_ptr, png_bytep dp, int display)
/* This can only be the RGB case, so each copy is exactly one
* pixel and it is not necessary to check for a partial copy.
*/
- for(;;)
+ for (;;)
{
dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
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<<img->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 : "<unknown>", 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;
}
diff --git a/plugins/FreeImage/Source/Metadata/Exif.cpp b/plugins/FreeImage/Source/Metadata/Exif.cpp
index ed667b0974..7d0955c5db 100644
--- a/plugins/FreeImage/Source/Metadata/Exif.cpp
+++ b/plugins/FreeImage/Source/Metadata/Exif.cpp
@@ -69,7 +69,7 @@ static int
FreeImage_strnicmp(const char *s1, const char *s2, size_t len) {
unsigned char c1, c2;
- if(!s1 || !s2) return -1;
+ if (!s1 || !s2) return -1;
c1 = 0; c2 = 0;
if(len) {
@@ -182,7 +182,7 @@ processMakerNote(FIBITMAP *dib, char *pval, BOOL msb_order, DWORD *subdirOffset,
FreeImage_GetMetadata(FIMD_EXIF_MAIN, dib, "Make", &tagMake);
const char *Maker = (char*)FreeImage_GetTagValue(tagMake);
- if((memcmp("OLYMP\x00\x01", pval, 7) == 0) || (memcmp("OLYMP\x00\x02", pval, 7) == 0) || (memcmp("EPSON", pval, 5) == 0) || (memcmp("AGFA", pval, 4) == 0)) {
+ if ((memcmp("OLYMP\x00\x01", pval, 7) == 0) || (memcmp("OLYMP\x00\x02", pval, 7) == 0) || (memcmp("EPSON", pval, 5) == 0) || (memcmp("AGFA", pval, 4) == 0)) {
// Olympus Type 1 Makernote
// Epson and Agfa use Olympus maker note standard,
// see: http://www.ozhiker.com/electronics/pjmt/jpeg_info/
@@ -280,11 +280,11 @@ processMakerNote(FIBITMAP *dib, char *pval, BOOL msb_order, DWORD *subdirOffset,
*subdirOffset = 0;
}
}
- else if((memcmp("SONY CAM\x20\x00\x00\x00", pval, 12) == 0) || (memcmp("SONY DSC\x20\x00\x00\x00", pval, 12) == 0)) {
+ else if ((memcmp("SONY CAM\x20\x00\x00\x00", pval, 12) == 0) || (memcmp("SONY DSC\x20\x00\x00\x00", pval, 12) == 0)) {
*md_model = TagLib::EXIF_MAKERNOTE_SONY;
*subdirOffset = 12;
}
- else if((memcmp("SIGMA\x00\x00\x00", pval, 8) == 0) || (memcmp("FOVEON\x00\x00", pval, 8) == 0)) {
+ else if ((memcmp("SIGMA\x00\x00\x00", pval, 8) == 0) || (memcmp("FOVEON\x00\x00", pval, 8) == 0)) {
FITAG *tagModel = NULL;
FreeImage_GetMetadata(FIMD_EXIF_MAIN, dib, "Model", &tagModel);
const char *Model = (char*)FreeImage_GetTagValue(tagModel);
@@ -365,7 +365,7 @@ processCanonMakerNoteTag(FIBITMAP *dib, FITAG *tag) {
// create a tag
FITAG *canonTag = FreeImage_CreateTag();
- if(!canonTag) return FALSE;
+ if (!canonTag) return FALSE;
// we intentionally skip the first array member (if needed)
for (DWORD i = startIndex; i < FreeImage_GetTagCount(tag); i++) {
@@ -560,7 +560,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
do {
// if there is anything on the stack then pop it off
- if(!destack.empty()) {
+ if (!destack.empty()) {
ifdp = ifdstack.top(); ifdstack.pop();
de = destack.top(); destack.pop();
md_model = modelstack.top(); modelstack.pop();
@@ -577,13 +577,13 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
// determine how many entries there are in the current IFD
nde = ReadUint16(msb_order, ifdp);
- for(; de < nde; de++) {
+ for (; de < nde; de++) {
char *pde = NULL; // pointer to the directory entry
char *pval = NULL; // pointer to the tag value
// create a tag
FITAG *tag = FreeImage_CreateTag();
- if(!tag) return FALSE;
+ if (!tag) return FALSE;
// point to the directory entry
pde = (char*) DIR_ENTRY_ADDR(ifdp, de);
@@ -592,7 +592,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
FreeImage_SetTagID(tag, ReadUint16(msb_order, pde));
// get the tag type
WORD tag_type = (WORD)ReadUint16(msb_order, pde + 2);
- if((tag_type - 1) >= EXIF_NUM_FORMATS) {
+ if ((tag_type - 1) >= EXIF_NUM_FORMATS) {
// a problem occured : delete the tag (not free'd after)
FreeImage_DeleteTag(tag);
// break out of the for loop
@@ -658,7 +658,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
next_ifd = (BYTE*)tiffp + sub_offset;
}
- if((sub_offset < (DWORD) length) && (next_mdmodel != TagLib::UNKNOWN)) {
+ if ((sub_offset < (DWORD) length) && (next_mdmodel != TagLib::UNKNOWN)) {
// push our current directory state onto the stack
ifdstack.push(ifdp);
// bump to the next entry
@@ -675,7 +675,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
// select a new metadata model
modelstack.push(next_mdmodel);
- // delete the tag as it won't be stored nor deleted in the for() loop
+ // delete the tag as it won't be stored nor deleted in the for () loop
FreeImage_DeleteTag(tag);
break; // break out of the for loop
@@ -707,7 +707,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
const WORD entriesCount0th = ReadUint16(msb_order, ifd0th);
DWORD next_offset = ReadUint32(msb_order, DIR_ENTRY_ADDR(ifd0th, entriesCount0th));
- if((next_offset == 0) || (next_offset >= length)) {
+ if ((next_offset == 0) || (next_offset >= length)) {
return TRUE; //< no thumbnail
}
@@ -763,7 +763,7 @@ jpeg_read_exif_dir(FIBITMAP *dib, const BYTE *tiffp, unsigned long offset, unsig
}
}
- if(/*thCompression != 6 ||*/ thOffset == 0 || thSize == 0) {
+ if (/*thCompression != 6 ||*/ thOffset == 0 || thSize == 0) {
return TRUE;
}
diff --git a/plugins/FreeImage/Source/Metadata/FreeImageTag.cpp b/plugins/FreeImage/Source/Metadata/FreeImageTag.cpp
index 5d9f3034ec..84e15d0822 100644
--- a/plugins/FreeImage/Source/Metadata/FreeImageTag.cpp
+++ b/plugins/FreeImage/Source/Metadata/FreeImageTag.cpp
@@ -81,11 +81,11 @@ FreeImage_DeleteTag(FITAG *tag) {
FITAG * DLL_CALLCONV
FreeImage_CloneTag(FITAG *tag) {
- if(!tag) return NULL;
+ if (!tag) return NULL;
// allocate a new tag
FITAG *clone = FreeImage_CreateTag();
- if(!clone) return NULL;
+ if (!clone) return NULL;
try {
// copy the tag
@@ -97,7 +97,7 @@ FreeImage_CloneTag(FITAG *tag) {
// tag key
if(src_tag->key) {
dst_tag->key = (char*)malloc((strlen(src_tag->key) + 1) * sizeof(char));
- if(!dst_tag->key) {
+ if (!dst_tag->key) {
throw FI_MSG_ERROR_MEMORY;
}
strcpy(dst_tag->key, src_tag->key);
@@ -105,7 +105,7 @@ FreeImage_CloneTag(FITAG *tag) {
// tag description
if(src_tag->description) {
dst_tag->description = (char*)malloc((strlen(src_tag->description) + 1) * sizeof(char));
- if(!dst_tag->description) {
+ if (!dst_tag->description) {
throw FI_MSG_ERROR_MEMORY;
}
strcpy(dst_tag->description, src_tag->description);
@@ -118,7 +118,7 @@ FreeImage_CloneTag(FITAG *tag) {
dst_tag->length = src_tag->length;
// tag value
dst_tag->value = (BYTE*)malloc(src_tag->length * sizeof(BYTE));
- if(!dst_tag->value) {
+ if (!dst_tag->value) {
throw FI_MSG_ERROR_MEMORY;
}
memcpy(dst_tag->value, src_tag->value, src_tag->length);
@@ -253,7 +253,7 @@ FreeImage_SetTagValue(FITAG *tag, const void *value) {
case FIDT_ASCII:
{
tag_header->value = (char*)malloc((tag_header->length + 1) * sizeof(char));
- if(!tag_header->value) {
+ if (!tag_header->value) {
return FALSE;
}
char *src_data = (char*)value;
@@ -267,7 +267,7 @@ FreeImage_SetTagValue(FITAG *tag, const void *value) {
default:
tag_header->value = malloc(tag_header->length * sizeof(BYTE));
- if(!tag_header->value) {
+ if (!tag_header->value) {
return FALSE;
}
memcpy(tag_header->value, value, tag_header->length);
diff --git a/plugins/FreeImage/Source/Metadata/IPTC.cpp b/plugins/FreeImage/Source/Metadata/IPTC.cpp
index 1aba46c094..817beddf98 100644
--- a/plugins/FreeImage/Source/Metadata/IPTC.cpp
+++ b/plugins/FreeImage/Source/Metadata/IPTC.cpp
@@ -46,7 +46,7 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
WORD tag_id;
- if(!dataptr || (datalen == 0)) {
+ if (!dataptr || (datalen == 0)) {
return FALSE;
}
@@ -59,7 +59,7 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
// find start of the BIM portion of the binary data
size_t offset = 0;
while(offset < length - 1) {
- if((profile[offset] == 0x1C) && (profile[offset+1] == 0x02))
+ if ((profile[offset] == 0x1C) && (profile[offset+1] == 0x02))
break;
offset++;
}
@@ -211,7 +211,7 @@ append_iptc_tag(BYTE *profile, unsigned *profile_size, WORD id, DWORD length, co
// calculate the new buffer size
size_t buffer_size = (5 + *profile_size + length) * sizeof(BYTE);
buffer = (BYTE*)malloc(buffer_size);
- if(!buffer)
+ if (!buffer)
return NULL;
// add the header
diff --git a/plugins/FreeImage/Source/Metadata/TagConversion.cpp b/plugins/FreeImage/Source/Metadata/TagConversion.cpp
index 041ba9a747..7b91598014 100644
--- a/plugins/FreeImage/Source/Metadata/TagConversion.cpp
+++ b/plugins/FreeImage/Source/Metadata/TagConversion.cpp
@@ -39,7 +39,7 @@ ConvertAnyTag(FITAG *tag) {
static std::string buffer;
DWORD i;
- if(!tag)
+ if (!tag)
return NULL;
buffer.erase();
@@ -259,7 +259,7 @@ ConvertExifTag(FITAG *tag) {
char format[MAX_TEXT_EXTENT];
static std::string buffer;
- if(!tag)
+ if (!tag)
return NULL;
buffer.erase();
@@ -993,7 +993,7 @@ ConvertExifGPSTag(FITAG *tag) {
char format[MAX_TEXT_EXTENT];
static std::string buffer;
- if(!tag)
+ if (!tag)
return NULL;
buffer.erase();
diff --git a/plugins/FreeImage/Source/Metadata/TagLib.cpp b/plugins/FreeImage/Source/Metadata/TagLib.cpp
index 123d860041..eff291beab 100644
--- a/plugins/FreeImage/Source/Metadata/TagLib.cpp
+++ b/plugins/FreeImage/Source/Metadata/TagLib.cpp
@@ -1478,14 +1478,14 @@ TagLib::TagLib() {
BOOL TagLib::addMetadataModel(MDMODEL md_model, TagInfo *tag_table) {
// check that the model doesn't already exist
- if((_table_map.find(md_model) == _table_map.end()) && (tag_table != NULL)) {
+ if ((_table_map.find(md_model) == _table_map.end()) && (tag_table != NULL)) {
// add the tag description table
TAGINFO *info_map = new(std::nothrow) TAGINFO();
- if(!info_map) return FALSE;
+ if (!info_map) return FALSE;
for(int i = 0; ; i++) {
- if((tag_table[i].tag == 0) && (tag_table[i].fieldname == NULL))
+ if ((tag_table[i].tag == 0) && (tag_table[i].fieldname == NULL))
break;
(*info_map)[tag_table[i].tag] = &tag_table[i];
}
diff --git a/plugins/FreeImage/Source/Metadata/XTIFF.cpp b/plugins/FreeImage/Source/Metadata/XTIFF.cpp
index c6ec5ba858..bc63cf38b2 100644
--- a/plugins/FreeImage/Source/Metadata/XTIFF.cpp
+++ b/plugins/FreeImage/Source/Metadata/XTIFF.cpp
@@ -123,7 +123,7 @@ tiff_read_geotiff_profile(TIFF *tif, FIBITMAP *dib) {
if(TIFFGetField(tif, fieldInfo->field_tag, &params)) {
// create a tag
FITAG *tag = FreeImage_CreateTag();
- if(!tag)
+ if (!tag)
return;
WORD tag_id = (WORD)fieldInfo->field_tag;
@@ -147,7 +147,7 @@ tiff_read_geotiff_profile(TIFF *tif, FIBITMAP *dib) {
if(TIFFGetField(tif, fieldInfo->field_tag, &tag_count, &data)) {
// create a tag
FITAG *tag = FreeImage_CreateTag();
- if(!tag)
+ if (!tag)
return;
WORD tag_id = (WORD)fieldInfo->field_tag;
@@ -315,7 +315,7 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib, TagLib& t
// build FreeImage tag from Tiff Tag data we collected
FITAG *fitag = FreeImage_CreateTag();
- if(!fitag) {
+ if (!fitag) {
if(mem_alloc) {
_TIFFfree(raw_data);
}
@@ -514,18 +514,18 @@ tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
// test if tag value is set
// (lifted directly form LibTiff _TIFFWriteDirectory)
- if( fld->field_bit == FIELD_CUSTOM ) {
+ if ( fld->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 == fld);
}
- if( !is_set ) {
+ if ( !is_set ) {
continue;
}
- } else if(!TIFFFieldSet(tif, fld->field_bit)) {
+ } else if (!TIFFFieldSet(tif, fld->field_bit)) {
continue;
}
@@ -639,7 +639,7 @@ tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
// check for identical formats
// (enum value are the sames between FREE_IMAGE_MDTYPE and TIFFDataType types)
- if((int)tif_tag_type != (int)tag_type) {
+ if ((int)tif_tag_type != (int)tag_type) {
// skip tag or _TIFFmemcpy will fail
continue;
}
diff --git a/plugins/FreeImage/Source/Utilities.h b/plugins/FreeImage/Source/Utilities.h
index bf836e1e87..b743325129 100644
--- a/plugins/FreeImage/Source/Utilities.h
+++ b/plugins/FreeImage/Source/Utilities.h
@@ -174,7 +174,7 @@ MAXMIN(const T* L, long n, T& max, T& min) {
long k1, k2;
i1 = 0; i2 = 0; min = L[0]; max = L[0]; j = 0;
- if((n % 2) != 0) j = 1;
+ if ((n % 2) != 0) j = 1;
for(i = j; i < n; i+= 2) {
k1 = i; k2 = i+1;
x1 = L[k1]; x2 = L[k2];
diff --git a/plugins/FreeImage/Source/Zlib/zutil.h b/plugins/FreeImage/Source/Zlib/zutil.h
index 223a74d3dc..8f33fd3e7d 100644
--- a/plugins/FreeImage/Source/Zlib/zutil.h
+++ b/plugins/FreeImage/Source/Zlib/zutil.h
@@ -219,7 +219,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# include <stdio.h>
extern int ZLIB_INTERNAL z_verbose;
extern void ZLIB_INTERNAL z_error OF((char *m));
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+# define Assert(cond,msg) {if (!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}