[Mit-cadr-cvs] r410 - branches/ggilley/emulator/usim

ggilley at common-lisp.net ggilley at common-lisp.net
Sun Mar 3 22:44:11 UTC 2013


Author: ggilley
Date: Sun Mar  3 14:44:10 2013
New Revision: 410

Log:
fix an error and some warnings

Modified:
   branches/ggilley/emulator/usim/Files.c
   branches/ggilley/emulator/usim/chaos.c
   branches/ggilley/emulator/usim/ether.c
   branches/ggilley/emulator/usim/glob.c
   branches/ggilley/emulator/usim/iob.c
   branches/ggilley/emulator/usim/ucode.c

Modified: branches/ggilley/emulator/usim/Files.c
==============================================================================
--- branches/ggilley/emulator/usim/Files.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/Files.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -1057,16 +1057,17 @@
                     for (o = options; o->o_name; o++)
                         if (strcmp(oname, o->o_name) == 0)
                             break;
-                    free(oname);
                     if (o->o_name == NOSTR) {
                         log(LOG_ERR, "FILE: UOO:'%s'\n",
                             oname);
                         (void)sprintf(errstring = errbuf,
                                       "Unknown open option: %s",
                                       oname);
+                        free(oname);
                         afree(a);
                         return UUO;
                     }
+                    free(oname);
                     switch (o->o_type) {
                         case O_BIT:
                             a->a_options |= o->o_value;
@@ -1503,7 +1504,6 @@
 		free((char *)f);
 		free(of->f_name);
 		free((char *)of);
-        t->t_fh = FNULL;
 	}
 }
 
@@ -3600,8 +3600,7 @@
             errstring = "CHANGE-PROPERTIES on directory transfer";
             error(t, fhname, BUG);
         } else {
-            file = x->x_options & O_WRITE ? x->x_tempname :
-            x->x_realname;
+            file = x->x_options & O_WRITE ? x->x_tempname : x->x_realname;
             if (stat(file, &sbuf) < 0)
                 fatal(FSTAT);
             goto doit;
@@ -3639,12 +3638,8 @@
             for (pp = properties; pp->p_indicator; pp++)
                 if (strcmp(pp->p_indicator, plp->p_name) == 0) {
                     if (pp->p_put)
-                        if ((errcode =
-                             (*pp->p_put)
-                             (&sbuf, file,
-                              plp->p_value, x))) {
-                                 error(t,
-                                       fhname, errcode);
+                        if ((errcode = (*pp->p_put)(&sbuf, file, plp->p_value, x))) {
+                                 error(t, fhname, errcode);
                                  return;
                              } else
                                  break;
@@ -4497,7 +4492,7 @@
                         register char *from = x->x_bptr;
                         register char *to = x->x_pptr;
                         
-                        n = MIN(x->x_room, x->x_left);
+                        n = MIN(x->x_room, (int)x->x_left);
                         x->x_left -= n;
                         x->x_room -= n;
                         do *to++ = *from++; while (--n);
@@ -4612,7 +4607,7 @@
                         register char *from = x->x_pptr;
                         register char *to = x->x_bptr;
                         
-                        n = MIN(x->x_left, x->x_room);
+                        n = MIN((int)x->x_left, x->x_room);
                         x->x_left -= n;
                         x->x_room -= n;
                         do *to++ = *from++; while (--n);
@@ -4859,6 +4854,7 @@
             log(LOG_ERR, "FILE: bad opcode in data connection: %d\n",
                 x->x_op & 0377);
             free(packet);
+            packet = 0;
             fatal("Bad opcode on data connection");
             /* NOTREACHED */
     }

Modified: branches/ggilley/emulator/usim/chaos.c
==============================================================================
--- branches/ggilley/emulator/usim/chaos.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/chaos.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -818,7 +818,10 @@
         pthread_mutex_unlock(&conn->queuelock);
 
         if (node)
+        {
             free(node);
+            node = 0;
+        }
         if (packet)
         {
             if (cmp_gt(packet->number, conn->lastreceived))

Modified: branches/ggilley/emulator/usim/ether.c
==============================================================================
--- branches/ggilley/emulator/usim/ether.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/ether.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -236,7 +236,7 @@
                 if (status & ETHER_DESC_TX_READY) {
                 len = (size_t) descs.desc_structs[i].len;
                 ptr = descs.desc_structs[i].ptr;
-                words = (len + 3) >> 2;
+                words = (int)((len + 3) >> 2);
                 for (j = 0; j < words; j++) {
                     read_phy_mem(ptr + j, &packet[j]);
                 }
@@ -311,7 +311,7 @@
 
                 ptr = descs.desc_structs[i].ptr;
                 descs.desc_structs[i].len = (uint16_t) len;
-                words = (len + 3) >> 2;
+                words = (int)((len + 3) >> 2);
                 for (j = 0; j < words; j++) {
                     write_phy_mem(ptr + j, packet[j]);
                 }

Modified: branches/ggilley/emulator/usim/glob.c
==============================================================================
--- branches/ggilley/emulator/usim/glob.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/glob.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -763,7 +763,10 @@
         {
             *bv = malloc(strlen(*av) + 1);
             if (*bv == 0)
+            {
+                free(nv);
                 return 0;
+            }
             strcpy(*bv, *av);
             av++;
             bv++;

Modified: branches/ggilley/emulator/usim/iob.c
==============================================================================
--- branches/ggilley/emulator/usim/iob.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/iob.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -188,7 +188,7 @@
 unsigned int
 get_us_clock_high(void)
 {
-	return cv >> 16;
+	return (unsigned int)(cv >> 16);
 }
 
 unsigned int get_60hz_clock(void)

Modified: branches/ggilley/emulator/usim/ucode.c
==============================================================================
--- branches/ggilley/emulator/usim/ucode.c	Sat Jan 19 19:49:30 2013	(r409)
+++ branches/ggilley/emulator/usim/ucode.c	Sun Mar  3 14:44:10 2013	(r410)
@@ -796,7 +796,7 @@
 static inline void
 write_ucode(int addr, ucw_t w)
 {
-	tracef("u-code write; %Lo @ %o\n", w, addr);
+	tracef("u-code write; %llo @ %o\n", w, addr);
 	ucode[addr] = w;
 }
 
@@ -1978,6 +1978,9 @@
 {
 	int trace_pt_prom, trace_pt, trace_pt_count, trace_label_pt;
 	char *sym, *last_sym = 0;
+    ucw_t p1 = 0;
+    int p0_pc = 0, p1_pc= 0;
+    char no_exec_next = 0;
 
 	/* 2Mwords */
 	phys_ram_pages = 8192;
@@ -2002,7 +2005,6 @@
 
 	while (run_ucode_flag) {
 		char op_code;
-		char no_exec_next;
 		char invert_sense, take_jump;
 		int a_src, m_src, new_pc, dest, alu_op;
 		int r_bit, p_bit, n_bit, ir8, ir7;
@@ -2020,8 +2022,6 @@
 		unsigned int out_bus;
 		int64 lv;
 		ucw_t u, w;
-		ucw_t p1;
-		int p0_pc, p1_pc;
 #define p0 u
 
 		char n_plus1, enable_ish;





More information about the mit-cadr-cvs mailing list