LCDproc development and user support list

Text archives Help


[Lcdproc] compiler requirement


Chronological Thread 
  • From: paul_c AT users.sourceforge.net (paul_c)
  • Subject: [Lcdproc] compiler requirement
  • Date: Mon May 28 16:03:01 2007

On Monday 28 May 2007 16:16, Peter Marschall wrote:
> What are the exact problems with MtxOrb.c

MtxOrb_set_char - A double semicolon at the end of assignment of out[12].

Attached is a small patch that resolves some of the gcc-2.95 issues.


Regards, Paul.



diff -uwr lcdptoc-0.5.2-orig/clients/lcdproc/chrono.c lcdproc-0.5.2/clients/lcdproc/chrono.c
--- lcdptoc-0.5.2-orig/clients/lcdproc/chrono.c	2007-04-14 15:38:15.000000000 +0100
+++ lcdproc-0.5.2/clients/lcdproc/chrono.c	2007-05-28 16:30:47.000000000 +0100
@@ -98,8 +98,8 @@
 	tickTime(now, heartbeat);
 
 	if (lcd_hgt >= 4) {
-		machine_get_uptime(&uptime, &idle);
 		char tmp[40];	// should be large enough
+		machine_get_uptime(&uptime, &idle);
 
 		// display the uptime...
 		days = (int) uptime / 86400;
diff -uwr lcdptoc-0.5.2-orig/clients/lcdproc/disk.c lcdproc-0.5.2/clients/lcdproc/disk.c
--- lcdptoc-0.5.2-orig/clients/lcdproc/disk.c	2007-04-14 15:38:15.000000000 +0100
+++ lcdproc-0.5.2/clients/lcdproc/disk.c	2007-05-28 16:53:03.000000000 +0100
@@ -103,7 +103,7 @@
 	//  second, then hold at the end for two seconds)
 	sock_printf(sock, "widget_set D f 1 2 %i %i %i %i v 12\n", lcd_wid, lcd_hgt, lcd_wid, count);
 	for (i = 0; i < count; i++) {
-		char tmp[lcd_wid+1];	// should be large enough
+                char *tmp = malloc(sizeof(char)*lcd_wid+1);
 
 		if (table[i].dev[0] == '\0')
 			continue;
@@ -122,6 +122,7 @@
 			sock_printf(sock, "widget_set D s%i 1 %i {%s}\n", i, i + 1, tmp);
 			sock_printf(sock, "widget_set D h%i %i %i %i\n", i, 3 + dev_wid, i + 1, table[i].full);
 		}
+                free(tmp);
 	}
 
 	// Now remove extra widgets...
diff -uwr lcdptoc-0.5.2-orig/clients/lcdproc/iface.c lcdproc-0.5.2/clients/lcdproc/iface.c
--- lcdptoc-0.5.2-orig/clients/lcdproc/iface.c	2007-04-14 15:38:15.000000000 +0100
+++ lcdproc-0.5.2/clients/lcdproc/iface.c	2007-05-28 16:39:03.000000000 +0100
@@ -239,12 +239,14 @@
 void
 format_value (char *buff, double value, char *unit)
 {
+	char *mag;
+
 	/* Convert bytes to bits, if necessary */
 	if (strstr(unit, "b"))
 		value *= 8;
 
 	/* If units are bytes, then divide by 2^10, otherwise by 10^3 */
-	char *mag = convert_double(&value, (strstr(unit, "B")) ? 1024 : 1000, 1.0f);
+	mag = convert_double(&value, (strstr(unit, "B")) ? 1024 : 1000, 1.0f);
 
 	/* Formatting rules:
 	 * - if original value was < 1000, output decimal value only
@@ -266,10 +268,12 @@
 void
 format_value_multi_interface (char *buff, double value, char *unit)
 {
+	char *mag;
+
 	if (strstr(unit, "b"))
 		value *= 8;
 
-	char *mag = convert_double(&value, (strstr(unit, "B")) ? 1024 : 1000, 1.0f);
+	mag = convert_double(&value, (strstr(unit, "B")) ? 1024 : 1000, 1.0f);
 
 	/* Formatting rules:
 	 * - if original value was < 1000, output decimal value only
@@ -281,7 +285,7 @@
 	else if (value < 10)
 		sprintf(buff, "%3.1f%s", value, mag);
 	else
-		sprintf(buff, "%3.f%s", value, mag);
+		sprintf(buff, "%3.0f%s", value, mag);
 
 } /* format_value_multi_interface() */
 
diff -uwr lcdptoc-0.5.2-orig/server/commands/menu_commands.c lcdproc-0.5.2/server/commands/menu_commands.c
--- lcdptoc-0.5.2-orig/server/commands/menu_commands.c	2007-04-14 15:38:14.000000000 +0100
+++ lcdproc-0.5.2/server/commands/menu_commands.c	2007-05-28 16:43:41.000000000 +0100
@@ -433,8 +433,6 @@
 		{ -1,			NULL,		-1,		-1 }
 	};
 
-	debug (RPT_DEBUG, "%s( Client [%d]: %s)",
-	       __FUNCTION__, c->sock, argv2string(argc, argv));
 	bool bool_value = false;
 	CheckboxValue checkbox_value = CHECKBOX_OFF;
 	short short_value = 0;
@@ -448,6 +446,8 @@
 	char * item_id;
 	int argnr;
 
+	debug (RPT_DEBUG, "%s( Client [%d]: %s)",
+	       __FUNCTION__, c->sock, argv2string(argc, argv));
 	if (!c->ack)
 		return 1;
 
diff -uwr lcdptoc-0.5.2-orig/server/drivers/MtxOrb.c lcdproc-0.5.2/server/drivers/MtxOrb.c
--- lcdptoc-0.5.2-orig/server/drivers/MtxOrb.c	2007-04-14 15:38:15.000000000 +0100
+++ lcdproc-0.5.2/server/drivers/MtxOrb.c	2007-05-28 16:42:15.000000000 +0100
@@ -569,6 +569,11 @@
 		unsigned char *sp = p->framebuf + (i * p->width);
 		unsigned char *sq = p->backingstore + (i * p->width);
 
+		// set  pointers to end of the line in frame buffer & backing store
+		unsigned char *ep = sp + (p->width - 1);
+		unsigned char *eq = sq + (p->width - 1);
+		int length = 0;
+
 		debug(RPT_DEBUG, "Framebuf: '%.*s'", p->width, sp);
 		debug(RPT_DEBUG, "Backingstore: '%.*s'", p->width, sq);
 
@@ -577,11 +582,6 @@
 		 * - leave out leading and trailing parts that are identical
 		 */
 
-		// set  pointers to end of the line in frame buffer & backing store
-		unsigned char *ep = sp + (p->width - 1);
-		unsigned char *eq = sq + (p->width - 1);
-		int length = 0;
-
 		// skip over leading identical portions of the line
 		for (j = 0; (sp <= ep) && (*sp == *sq); sp++, sq++, j++)
 			;
@@ -1193,7 +1193,7 @@
 MtxOrb_set_char (Driver *drvthis, int n, unsigned char *dat)
 {
 	PrivateData *p = drvthis->private_data;
-	unsigned char out[12] = { '\xFE', 'N', 0, 0,0,0,0,0,0,0,0 };;
+	unsigned char out[12] = { '\xFE', 'N', 0, 0,0,0,0,0,0,0,0 };
 	unsigned char mask = (1 << p->cellwidth) - 1;
 	int row;
 
diff -uwr lcdptoc-0.5.2-orig/server/menu.c lcdproc-0.5.2/server/menu.c
--- lcdptoc-0.5.2-orig/server/menu.c	2007-04-14 15:38:14.000000000 +0100
+++ lcdproc-0.5.2/server/menu.c	2007-05-28 16:50:51.000000000 +0100
@@ -704,10 +704,11 @@
  * hidden or not valid subitem of menu this function does nothing. */
 void menu_select_subitem(Menu *menu, char *subitem_id)
 {
+        int position;
 	assert(menu != NULL);
+	position = menu_get_index_of(menu, subitem_id);
 	debug(RPT_DEBUG, "%s(menu=[%s], subitem_id=\"%s\")", __FUNCTION__,
 	       menu->id, subitem_id);
-	int position = menu_get_index_of(menu, subitem_id);
 	if (position < 0)
 	{
 		debug(RPT_DEBUG, "%s: subitem \"%s\" not found"
diff -uwr lcdptoc-0.5.2-orig/server/menuscreens.c lcdproc-0.5.2/server/menuscreens.c
--- lcdptoc-0.5.2-orig/server/menuscreens.c	2007-04-14 15:38:14.000000000 +0100
+++ lcdproc-0.5.2/server/menuscreens.c	2007-05-28 16:50:03.000000000 +0100
@@ -275,13 +275,14 @@
 
 static void handle_predecessor(void)
 {
+        MenuItem* predecessor;
 	MenuItem* item = (active_menuitem->type == MENUITEM_MENU)
 		? menu_get_item_for_predecessor_check(active_menuitem)
 		: active_menuitem;
 	assert(item != NULL);
 	debug(RPT_DEBUG, "%s: Switching to registered predecessor '%s' of '%s'.",
 	       __FUNCTION__, item->predecessor_id, item->id);
-	MenuItem *predecessor = menuitem_search(
+	predecessor = menuitem_search(
 		item->predecessor_id, (Client*)active_menuitem->client);
 	if (predecessor == NULL)
 	{
@@ -316,13 +317,14 @@
 
 static void handle_successor(void)
 {
+        MenuItem *successor;
 	MenuItem* item = (active_menuitem->type == MENUITEM_MENU)
 		? menu_get_item_for_successor_check(active_menuitem)
 		: active_menuitem;
 	assert(item != NULL);
 	debug(RPT_DEBUG, "%s: Switching to registered successor '%s' of '%s'.",
 	       __FUNCTION__, item->successor_id, item->id);
-	MenuItem *successor = menuitem_search(
+	successor = menuitem_search(
 		item->successor_id, (Client*)active_menuitem->client);
 	if (successor == NULL)
 	{



Archive powered by MHonArc 2.6.18.

Top of page