View Single Post
Old 2017-02-22, 15:49   #1
Explorer09
 
May 2014

3×11 Posts
Default [Patch] Fix meaningless (char (*)[13]) to (char *) cast

Not a bug, but to fix a code readability problem.

A pointer to array is rarely useful in C. Here, passing m_start_time instead of &m_start_time as function arguments is what the code intended.

(In prime95 / mprime "menu.c")
Code:
diff -r -u a/linux/menu.c b/linux/menu.c
--- a/linux/menu.c	2016-09-15 10:15:10.000000000 +0800
+++ b/linux/menu.c	2017-02-22 23:30:39.806257928 +0800
@@ -866,8 +866,8 @@
 		askNum ("Daytime P-1/ECM stage 2 memory in MB", &m_day_memory, 8, max_mem);
 		askNum ("Nighttime P-1/ECM stage 2 memory in MB", &m_night_memory, 8, max_mem);
 		if (m_day_memory != m_night_memory) {
-			askStr ("Daytime begins at", (char *) &m_start_time, 12);
-			askStr ("Daytime ends at", (char *) &m_end_time, 12);
+			askStr ("Daytime begins at", m_start_time, 12);
+			askStr ("Daytime ends at", m_end_time, 12);
 		}
 	}
 
@@ -887,8 +887,8 @@
 			delete_timed_event (TE_COMM_SERVER);
 			UpdateEndDates ();
 		}
-		new_day_start_time = strToMinutes ((char *) &m_start_time);
-		new_day_end_time = strToMinutes ((char *) &m_end_time);
+		new_day_start_time = strToMinutes (m_start_time);
+		new_day_end_time = strToMinutes (m_end_time);
 		if (m_memory_editable &&
 		    (day_memory != m_day_memory ||
 		     night_memory != m_night_memory ||
Explorer09 is offline   Reply With Quote