changeset 516:b7e99bfeadc9

Convert the minority of while() to while ().
author zas_
date Thu, 24 Apr 2008 15:49:57 +0000
parents adc45cd3f08b
children d84f2210a73c
files src/bar_info.c src/cache_maint.c src/collect-table.c src/collect.c src/dupe.c src/editors.c src/exif-common.c src/pan-view.c src/rcfile.c src/slideshow.c src/thumb.c src/ui_bookmark.c src/ui_fileops.c src/ui_tabcomp.c src/view_file_icon.c
diffstat 15 files changed, 50 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_info.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/bar_info.c	Thu Apr 24 15:49:57 2008 +0000
@@ -152,7 +152,7 @@
 			gchar *keystr = ++ptr;
 			
 			key = MK_NONE;
-			while(*ptr != ']' && *ptr != '\n' && *ptr != '\0') ptr++;
+			while (*ptr != ']' && *ptr != '\n' && *ptr != '\0') ptr++;
 			
 			if (*ptr == ']')
 				{
--- a/src/cache_maint.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/cache_maint.c	Thu Apr 24 15:49:57 2008 +0000
@@ -368,7 +368,7 @@
 		GList *work;
 
 		work = dlist;
-		while(work)
+		while (work)
 			{
 			gchar *path = work->data;
 			if (recursive && strlen(path) > base_length &&
--- a/src/collect-table.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/collect-table.c	Thu Apr 24 15:49:57 2008 +0000
@@ -293,7 +293,7 @@
 	ct->selection = NULL;
 
 	work = ct->cd->list;
-	while(work)
+	while (work)
 		{
 		ct->selection = g_list_append(ct->selection, work->data);
 		collection_table_selection_add(ct, work->data, SELECTION_SELECTED, NULL);
@@ -895,7 +895,7 @@
 		if (new_row < 0) new_row = 0;
 		if (new_row >= ct->rows) new_row = ct->rows - 1;
 
-		while(col != 0)
+		while (col != 0)
 			{
 			if (col < 0)
 				{
--- a/src/collect.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/collect.c	Thu Apr 24 15:49:57 2008 +0000
@@ -114,7 +114,7 @@
 {
 	GList *work;
 	work = list;
-	while(work)
+	while (work)
 		{
 		collection_info_free((CollectInfo *)work->data);
 		work = work->next;
@@ -215,7 +215,7 @@
 {
 	GList *work = list;
 
-	while(work)
+	while (work)
 		{
 		CollectInfo *ci = work->data;
 		if (strcmp(ci->fd->path, path) == 0) return ci;
@@ -230,7 +230,7 @@
 {
 	GList *work = list;
 
-	while(work)
+	while (work)
 		{
 		CollectInfo *ci = work->data;
 		if (strcmp(ci->fd->path, path) == 0) return work;
@@ -245,7 +245,7 @@
 	gint c = 0;
 	GList *work = list;
 
-	while(work)
+	while (work)
 		{
 		CollectInfo *ci = work->data;
 		if (strcmp(ci->fd->path, path) == 0) return c;
@@ -436,7 +436,7 @@
 		gint b, e;
 
 		b = 0;
-		while(data[b] != '\0' && data[b] != '\n' ) b++;
+		while (data[b] != '\0' && data[b] != '\n' ) b++;
 		b++;
 		e = b;
 
@@ -481,7 +481,7 @@
 	temp = NULL;
 	temp = g_list_prepend(temp, g_strdup_printf("COLLECTION:%d\n", n));
 	work = list;
-	while(work)
+	while (work)
 		{
 		n = g_list_index(cd->list, work->data);
 		if (n >= 0)
@@ -493,7 +493,7 @@
 
 	total = 0;
 	work = temp;
-	while(work)
+	while (work)
 		{
 		total += strlen((gchar *)work->data);
 		work = work->next;
@@ -504,7 +504,7 @@
 	ptr = uri_text;
 
 	work = g_list_last(temp);
-	while(work)
+	while (work)
 		{
 		gchar *text = work->data;
 
@@ -718,7 +718,7 @@
 		}
 
 	work = list;
-	while(work)
+	while (work)
 		{
 		cd->list = collection_list_remove(cd->list, work->data);
 		work = work->next;
@@ -762,12 +762,12 @@
 	GList *work;
 
 	work = collection_list;
-	while(work)
+	while (work)
 		{
 		CollectionData *cd = work->data;
 		work = work->next;
 
-		while(collection_remove(cd, fd));
+		while (collection_remove(cd, fd));
 		}
 #if 0
 	/* Do we really need to do this? removed files are
@@ -782,12 +782,12 @@
 	GList *work;
 
 	work = collection_list;
-	while(work)
+	while (work)
 		{
 		CollectionData *cd = work->data;
 		work = work->next;
 
-		while(collection_rename(cd, fd));
+		while (collection_rename(cd, fd));
 		}
 
 	collect_manager_moved(fd);
--- a/src/dupe.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/dupe.c	Thu Apr 24 15:49:57 2008 +0000
@@ -1741,14 +1741,14 @@
 				d = filelist_filter(d, TRUE);
 
 				work = f;
-				while(work)
+				while (work)
 					{
 					dupe_files_add(dw, NULL, NULL, (FileData *)work->data, TRUE);
 					work = work->next;
 					}
 				filelist_free(f);
 				work = d;
-				while(work)
+				while (work)
 					{
 					dupe_files_add(dw, NULL, NULL, (FileData *)work->data, TRUE);
 					work = work->next;
@@ -1775,7 +1775,7 @@
 	CollectInfo *info;
 
 	info = collection_get_first(collection);
-	while(info)
+	while (info)
 		{
 		dupe_files_add(dw, collection, info, NULL, FALSE);
 		info = collection_next_by_info(collection, info);
@@ -1789,7 +1789,7 @@
 	GList *work;
 
 	work = list;
-	while(work)
+	while (work)
 		{
 		FileData *fd = work->data;
 		work = work->next;
@@ -3431,7 +3431,7 @@
 		case TARGET_URI_LIST:
 			list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
 			work = list;
-			while(work)
+			while (work)
 				{
 				FileData *fd = work->data;
 				if (isdir(fd->path))
--- a/src/editors.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/editors.c	Thu Apr 24 15:49:57 2008 +0000
@@ -288,7 +288,7 @@
 			p = fd->path;
 		else
 			{
-			while(work)
+			while (work)
 				{
 				GList *work2;
 				gchar *ext = work->data;
@@ -302,7 +302,7 @@
 					}
 
 				work2 = fd->sidecar_files;
-				while(work2)
+				while (work2)
 					{
 					FileData *sfd = work2->data;
 					work2 = work2->next;
--- a/src/exif-common.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/exif-common.c	Thu Apr 24 15:49:57 2008 +0000
@@ -165,7 +165,7 @@
 do {                                    \
 	if (g_str_has_suffix(str,suff)) \
 		str[strlen(str)-(sizeof(suff)-1)] = 0;  \
-} while(0)
+} while (0)
 			REMOVE_SUFFIX(make," Corporation"); /* Pentax */
 			REMOVE_SUFFIX(make," OPTICAL CO.,LTD"); /* OLYMPUS */
 			REMOVE_SUFFIX(make," CORPORATION"); /* Nikon */
@@ -500,7 +500,7 @@
 
 	if (filter_file_class(fd->extension, FORMAT_CLASS_RAWIMAGE))
 		{
-		while(work)
+		while (work)
 			{
 			FileData *sfd = work->data;
 			work = work->next;
--- a/src/pan-view.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/pan-view.c	Thu Apr 24 15:49:57 2008 +0000
@@ -256,7 +256,7 @@
 	pi->queued = TRUE;
 	pw->queue = g_list_prepend(pw->queue, pi);
 
-	if (!pw->tl && !pw->il) while(pan_queue_step(pw));
+	if (!pw->tl && !pw->il) while (pan_queue_step(pw));
 }
 
 
--- a/src/rcfile.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/rcfile.c	Thu Apr 24 15:49:57 2008 +0000
@@ -582,18 +582,18 @@
 		gchar *option_start, *value_start;
 		gchar *p = s_buf;
 
-		while(g_ascii_isspace(*p)) p++;
+		while (g_ascii_isspace(*p)) p++;
 		if (!*p || *p == '\n' || *p == '#') continue;
 		option_start = p;
-		while(*p && *p != ':') p++;
+		while (*p && *p != ':') p++;
 		if (!*p) continue;
 		*p = '\0';
 		p++;
 		strncpy(option, option_start, sizeof(option));
-		while(g_ascii_isspace(*p)) p++;
+		while (g_ascii_isspace(*p)) p++;
 		value_start = p;
 		strncpy(value_all, value_start, sizeof(value_all));
-		while(*p && !g_ascii_isspace(*p) && *p != '\n') p++;
+		while (*p && !g_ascii_isspace(*p) && *p != '\n') p++;
 		*p = '\0';
 		strncpy(value, value_start, sizeof(value));
 
--- a/src/slideshow.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/slideshow.c	Thu Apr 24 15:49:57 2008 +0000
@@ -74,7 +74,7 @@
 
 	src_list = generate_list(ss);
 
-	while(src_list)
+	while (src_list)
 		{
 		gint p = (double)rand() / ((double)RAND_MAX + 1.0) * g_list_length(src_list);
 		work = g_list_nth(src_list, p);
@@ -107,7 +107,7 @@
 			/* start with specified image by skipping to it */
 			gint i = 0;
 
-			while(ss->list && i < start_index)
+			while (ss->list && i < start_index)
 				{
 				ss->list_done = g_list_prepend(ss->list_done, ss->list->data);
 				ss->list = g_list_remove(ss->list, ss->list->data);
--- a/src/thumb.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/thumb.c	Thu Apr 24 15:49:57 2008 +0000
@@ -564,7 +564,7 @@
 		return NULL;
 		}
 
-	while(fgets(buffer, XV_BUFFER, file) && buffer[0] == '#') /* do_nothing() */;
+	while (fgets(buffer, XV_BUFFER, file) && buffer[0] == '#') /* do_nothing() */;
 
 	if(sscanf(buffer, "%d %d %d", &width, &height, &depth) != 3)
 		{
--- a/src/ui_bookmark.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/ui_bookmark.c	Thu Apr 24 15:49:57 2008 +0000
@@ -112,7 +112,7 @@
 
 			ptr = s_buf + 1;
 			c = 0;
-			while(ptr[c] != ']' && ptr[c] != '\n' && ptr[c] != '\0') c++;
+			while (ptr[c] != ']' && ptr[c] != '\n' && ptr[c] != '\0') c++;
 
 			g_free(key);
 			key = g_strndup(ptr, c);
@@ -155,7 +155,7 @@
 	secure_fprintf(ssi, "#History lists\n\n");
 
 	list = g_list_last(history_list);
-	while(list && secsave_errno == SS_ERR_NONE)
+	while (list && secsave_errno == SS_ERR_NONE)
 		{
 		HistoryData *hd;
 		GList *work;
@@ -169,7 +169,7 @@
 		 * so that when reading they are added correctly
 		 */
 		work = g_list_last(hd->list);
-		while(work && secsave_errno == SS_ERR_NONE)
+		while (work && secsave_errno == SS_ERR_NONE)
 			{
 			secure_fprintf(ssi, "\"%s\"\n", (gchar *)work->data);
 			work = work->prev;
@@ -189,7 +189,7 @@
 	if (!hd) return;
 
 	work = hd->list;
-	while(work)
+	while (work)
 		{
 		g_free(work->data);
 		work = work->next;
@@ -252,7 +252,7 @@
 
 	/* if already in the list, simply move it to the top */
 	work = hd->list;
-	while(work)
+	while (work)
 		{
 		gchar *buf = work->data;
 		work = work->next;
@@ -269,7 +269,7 @@
 	if (max == -1) max = HISTORY_DEFAULT_KEY_COUNT;
 	if (max > 0)
 		{
-		while(hd->list && g_list_length(hd->list) > max)
+		while (hd->list && g_list_length(hd->list) > max)
 			{
 			GList *work = g_list_last(hd->list);
 			gchar *buf = work->data;
@@ -289,7 +289,7 @@
 	if (!hd) return;
 
 	work = hd->list;
-	while(work)
+	while (work)
 		{
 		gchar *buf = work->data;
 		if (strcmp(buf, oldpath) == 0)
@@ -1356,7 +1356,7 @@
 
 		w = r = text;
 
-		while(*r != '\0')
+		while (*r != '\0')
 			{
 			if (*r == '%' && *(r + 1) != '\0' && *(r + 2) != '\0')
 				{
--- a/src/ui_fileops.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/ui_fileops.c	Thu Apr 24 15:49:57 2008 +0000
@@ -426,7 +426,7 @@
 
 	if (!fi || !fo) return FALSE;
 
-	while((b = fread(buf, sizeof(char), sizeof(buf), fi)) && b != 0)
+	while ((b = fread(buf, sizeof(char), sizeof(buf), fi)) && b != 0)
 		{
 		if (fwrite(buf, sizeof(char), b, fo) != b)
 			{
@@ -634,7 +634,7 @@
 	g_free(path8);
 	if (!f) return -1;
 
-	while((c = fgetc(f)) != EOF)
+	while ((c = fgetc(f)) != EOF)
 		{
 		sum += c;
 		}
@@ -727,7 +727,7 @@
 
 	p = strlen(path) - 1;
 	if (p < 0) return NULL;
-	while(ptr[p] != '/' && p > 0) p--;
+	while (ptr[p] != '/' && p > 0) p--;
 	if (p == 0 && ptr[p] == '/') p++;
 	new_path = g_strndup(path, (guint)p);
 	return new_path;
@@ -772,7 +772,7 @@
 	if (strlen(path) < 2) return g_strdup(path);
 
 	p = strlen(path) - 1;
-	while(ptr[p] != '.' && p > 0) p--;
+	while (ptr[p] != '.' && p > 0) p--;
 	if (p == 0) p = strlen(path) - 1;
 	new_path = g_strndup(path, (guint)p);
 	return new_path;
--- a/src/ui_tabcomp.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/ui_tabcomp.c	Thu Apr 24 15:49:57 2008 +0000
@@ -88,7 +88,7 @@
 
 	list = td->file_list;
 
-	while(list)
+	while (list)
 		{
 		g_free(list->data);
 		list = list->next;
@@ -457,7 +457,7 @@
 		if (strcmp(entry_dir, "/") == 0) entry_dir[0] = '\0';
 
 		list = td->file_list;
-		while(list)
+		while (list)
 			{
 			gchar *file = list->data;
 			if (strncmp(entry_file, file, l) == 0)
@@ -498,7 +498,7 @@
 					{
 					list = poss;
 					if (!list) done = TRUE;
-					while(list && !done)
+					while (list && !done)
 						{
 						gchar *file = list->data;
 						if (strlen(file) < c || strncmp(test_file, file, c) != 0)
--- a/src/view_file_icon.c	Thu Apr 24 15:44:43 2008 +0000
+++ b/src/view_file_icon.c	Thu Apr 24 15:49:57 2008 +0000
@@ -1122,7 +1122,7 @@
 		if (new_row < 0) new_row = 0;
 		if (new_row >= vfi->rows) new_row = vfi->rows - 1;
 
-		while(col != 0)
+		while (col != 0)
 			{
 			if (col < 0)
 				{