{
gint nx, ny, nw, nh;
- if(sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
+ if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
*x = nx;
*y = ny;
int fd;
struct stat fs;
- if ((fd = open(path, O_RDONLY)) == -1)
+ fd = open(path, O_RDONLY);
+ if (fd == -1)
{
perror(path);
return -1;
*size = fs.st_size;
- if ((*mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0)) == MAP_FAILED)
+ *mapping = mmap(0, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+ if (*mapping == MAP_FAILED)
{
perror(path);
close(fd);
exif->items = NULL;
exif->current = NULL;
- if ((res = exif_jpeg_parse(exif, (unsigned char *)f, size,
- ExifKnownMarkersList)) == -2)
+ res = exif_jpeg_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList);
+ if (res == -2)
{
res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList);
}
try {
if (!item) return 0;
Exiv2::Metadatum *md = (Exiv2::Metadatum *)item;
- if(data_len) *data_len = md->size();
+ if (data_len) *data_len = md->size();
char *data = (char *)g_malloc(md->size());
long res = md->copy((Exiv2::byte *)data, Exiv2::littleEndian /* should not matter */);
g_assert(res == md->size());
#if EXIV2_TEST_VERSION(0,16,0)
Exiv2::Xmpdatum *xmpdatum;
#endif
-
- if ((exifdatum = dynamic_cast<Exiv2::Exifdatum *>(metadatum)))
+ if ((exifdatum = dynamic_cast<Exiv2::Exifdatum *>(metadatum)))
str << *exifdatum;
else if ((iptcdatum = dynamic_cast<Exiv2::Iptcdatum *>(metadatum)))
str << *iptcdatum;
gint file_cache_get(FileCacheData *fc, FileData *fd)
{
GList *work;
- if ((work = g_list_find_custom(fc->list, fd, file_cache_entry_compare_cb)))
+
+ work = g_list_find_custom(fc->list, fd, file_cache_entry_compare_cb);
+ if (work)
{
fc->list = g_list_remove_link(fc->list, work);
fc->list = g_list_concat(work, fc->list);
{
GList *work;
FileCacheEntry *fe;
- if ((work = g_list_find_custom(fc->list, fd, file_cache_entry_compare_cb)))
+
+ work = g_list_find_custom(fc->list, fd, file_cache_entry_compare_cb);
+ if (work)
{
/* entry already exists, move it to the beginning */
fc->list = g_list_remove_link(fc->list, work);
DEBUG_1("cache dump: max size:%ld size:%ld", fc->max_size, fc->size);
- while(work)
+ while (work)
{
FileCacheEntry *fe = work->data;
work = work->next;
FileData *file_data_add_sidecar_file(FileData *target, FileData *sfd)
{
sfd->parent = target;
- if(!g_list_find(target->sidecar_files, sfd))
+ if (!g_list_find(target->sidecar_files, sfd))
target->sidecar_files = g_list_prepend(target->sidecar_files, sfd);
file_data_increment_version(sfd); /* increments both sfd and target */
return target;
gint width, height, depth;
file = fopen(filename, "rt");
- if(!file) return NULL;
+ if (!file) return NULL;
fgets(buffer, XV_BUFFER, file);
- if(strncmp(buffer, "P7 332", 6) != 0)
+ if (strncmp(buffer, "P7 332", 6) != 0)
{
fclose(file);
return NULL;
while (fgets(buffer, XV_BUFFER, file) && buffer[0] == '#') /* do_nothing() */;
- if(sscanf(buffer, "%d %d %d", &width, &height, &depth) != 3)
+ if (sscanf(buffer, "%d %d %d", &width, &height, &depth) != 3)
{
fclose(file);
return NULL;
packed_data = load_xv_thumbnail(thumb_name, &width, &height);
g_free(thumb_name);
- if(packed_data)
+ if (packed_data)
{
guchar *rgb_data;
GdkPixbuf *pixbuf;
{
GList *work = list;
- while(work)
+ while (work)
{
FileData *fd = work->data;
work = work->next;