[openib-general] [PATCH] osm: fixing broken compilation on Windows

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Oct 31 04:42:00 PST 2006


Fixing a broken compilation on windows (problems with data types).

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>

Index: opensm/osm_ucast_file.c
===================================================================
--- opensm/osm_ucast_file.c	(revision 10009)
+++ opensm/osm_ucast_file.c	(working copy)
@@ -113,7 +113,7 @@ static void add_lid_hops(osm_opensm_t *p
 			 uint8_t hops[], unsigned len)
 {
 	uint16_t new_lid;
-	unsigned i;
+	uint8_t i;
 
 	new_lid = guid ? remap_lid(p_osm, lid, guid) : lid;
 	if (len > osm_switch_get_num_ports(p_sw))
@@ -370,7 +370,8 @@ static int do_lid_matrix_file_load(void 
 					file_name, lineno, p);
 				return -1;
 			}
-			lid = num;
+			/* We have just checked the range, so casting is safe */
+			lid = (uint16_t)num;
 			p = q;
 			while (isspace(*p) || *p == ':')
 				p++;
@@ -383,7 +384,8 @@ static int do_lid_matrix_file_load(void 
 					file_name, lineno, p);
 					return -1;
 				}
-				hops[len++] = num;
+				/* We have just checked the range, so casting is safe */
+				hops[len++] = (uint8_t)num;
 				p = q;
 				while (isspace(*p))
 					p++;







More information about the general mailing list