diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-02 20:55:18 +0000 |
commit | 78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch) | |
tree | 8512c50df70b8dd80c919e88ade3419207c95956 /plugins/FreeImage/Source/Metadata | |
parent | ce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff) |
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FreeImage/Source/Metadata')
-rw-r--r-- | plugins/FreeImage/Source/Metadata/Exif.cpp | 26 | ||||
-rw-r--r-- | plugins/FreeImage/Source/Metadata/FreeImageTag.cpp | 14 | ||||
-rw-r--r-- | plugins/FreeImage/Source/Metadata/IPTC.cpp | 6 | ||||
-rw-r--r-- | plugins/FreeImage/Source/Metadata/TagConversion.cpp | 6 | ||||
-rw-r--r-- | plugins/FreeImage/Source/Metadata/TagLib.cpp | 6 | ||||
-rw-r--r-- | plugins/FreeImage/Source/Metadata/XTIFF.cpp | 16 |
6 files changed, 37 insertions, 37 deletions
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, ¶ms)) {
// 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;
}
|