changeset 855:0c3f6ef17d18

Tidy up.
author zas_
date Wed, 25 Jun 2008 20:53:52 +0000
parents a0cdc9d066ae
children ff15a32ad17f
files src/collect-io.c src/exif.c src/exiv2.cc src/filecache.c src/filedata.c src/thumb.c src/utilops.c
diffstat 7 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect-io.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/collect-io.c	Wed Jun 25 20:53:52 2008 +0000
@@ -43,7 +43,7 @@
 {
 	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;
--- a/src/exif.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/exif.c	Wed Jun 25 20:53:52 2008 +0000
@@ -1104,7 +1104,8 @@
 	int fd;
 	struct stat fs;
 
-	if ((fd = open(path, O_RDONLY)) == -1)
+	fd = open(path, O_RDONLY);
+	if (fd == -1)
 		{
 		perror(path);
 		return -1;
@@ -1119,7 +1120,8 @@
 
 	*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);
@@ -1180,8 +1182,8 @@
 	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);
 		}
--- a/src/exiv2.cc	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/exiv2.cc	Wed Jun 25 20:53:52 2008 +0000
@@ -356,7 +356,7 @@
 	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());
@@ -454,8 +454,7 @@
 #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;
--- a/src/filecache.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/filecache.c	Wed Jun 25 20:53:52 2008 +0000
@@ -50,7 +50,9 @@
 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);
@@ -86,7 +88,9 @@
 {
 	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);
@@ -127,7 +131,7 @@
 	
 	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;
--- a/src/filedata.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/filedata.c	Wed Jun 25 20:53:52 2008 +0000
@@ -428,7 +428,7 @@
 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;
--- a/src/thumb.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/thumb.c	Wed Jun 25 20:53:52 2008 +0000
@@ -592,10 +592,10 @@
 	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;
@@ -603,7 +603,7 @@
 
 	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;
@@ -665,7 +665,7 @@
 	packed_data = load_xv_thumbnail(thumb_name, &width, &height);
 	g_free(thumb_name);
 
-	if(packed_data)
+	if (packed_data)
 		{
 		guchar *rgb_data;
 		GdkPixbuf *pixbuf;
--- a/src/utilops.c	Wed Jun 25 20:22:02 2008 +0000
+++ b/src/utilops.c	Wed Jun 25 20:53:52 2008 +0000
@@ -1191,7 +1191,7 @@
 {
 	GList *work = list;
 	
-	while(work)
+	while (work)
 		{
 		FileData *fd = work->data;
 		work = work->next;