mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 00:12:19 +01:00 
			
		
		
		
	gnode: Eliminate implicit signed-to-unsigned integer conversion
When doing a level traverse of a GNode with depth of -1, the depth was implicitly being converted to an unsigned integer. This worked (making the depth limit G_MAXUINT), but was a bit mystical. Change g_node_depth_traverse_level() to explicitly take a signed depth and handle it appropriately. Coverity issue: #1159465 https://bugzilla.gnome.org/show_bug.cgi?id=732003
This commit is contained in:
		
				
					committed by
					
						 Philip Withnall
						Philip Withnall
					
				
			
			
				
	
			
			
			
						parent
						
							b16d7fc1a7
						
					
				
				
					commit
					ae7895002b
				
			| @@ -779,7 +779,7 @@ g_node_traverse_level (GNode		 *node, | ||||
| static gboolean | ||||
| g_node_depth_traverse_level (GNode             *node, | ||||
| 			     GTraverseFlags	flags, | ||||
| 			     guint		depth, | ||||
| 			     gint		depth, | ||||
| 			     GNodeTraverseFunc  func, | ||||
| 			     gpointer	        data) | ||||
| { | ||||
| @@ -787,7 +787,7 @@ g_node_depth_traverse_level (GNode             *node, | ||||
|   gboolean more_levels; | ||||
|  | ||||
|   level = 0;   | ||||
|   while (level != depth)  | ||||
|   while (depth < 0 || level != (guint) depth) | ||||
|     { | ||||
|       more_levels = FALSE; | ||||
|       if (g_node_traverse_level (node, flags, level, func, data, &more_levels)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user