diff examples/calculator/main.c @ 93:c3c41f88e776

-
author Thinker K.F. Li <thinker@branda.to>
date Sun, 24 Aug 2008 01:18:58 +0800
parents 3f619ae03678
children 57f8fecca8f3
line wrap: on
line diff
--- a/examples/calculator/main.c	Sun Aug 24 00:18:59 2008 +0800
+++ b/examples/calculator/main.c	Sun Aug 24 01:18:58 2008 +0800
@@ -47,10 +47,9 @@
 	r = v1 * v2;
 	break;
     case '/':
+	r = v1;
 	if(v2)
-	    r = v1 / v2;
-	else
-	    r = v1;
+	    r /= v2;
 	break;
     case 'n':
 	r = v2;
@@ -161,7 +160,7 @@
 
     for(i = 0; i < 16; i++) {
 	off = tgt_list[i].off;
-	coord = *(coord_t **)((void *)calculator_scr + off);
+	coord = OFF2TYPE(calculator_scr, off, coord_t *);
 	subject = coord_get_mouse_event(coord);
 	subject_add_observer(factory, subject, buttons_handler, ex_rt);
     }