Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mac68k/dev Correct two more problems of the same ty...
details: https://anonhg.NetBSD.org/src/rev/f809acbdc9cc
branches: trunk
changeset: 472742:f809acbdc9cc
user: scottr <scottr%NetBSD.org@localhost>
date: Thu May 06 06:01:27 1999 +0000
description:
Correct two more problems of the same type as in rev 1.21: use the length
of the buffer you're copying from as the loop interator, not the length
of the buffer you're copying to. Also, rewrite print_single() with
pointer instead of array operators. Appears to correct some ADB-related
`hangs' during autoconfig.
diffstat:
sys/arch/mac68k/dev/adb_direct.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diffs (74 lines):
diff -r e7af0c9efc06 -r f809acbdc9cc sys/arch/mac68k/dev/adb_direct.c
--- a/sys/arch/mac68k/dev/adb_direct.c Thu May 06 04:37:44 1999 +0000
+++ b/sys/arch/mac68k/dev/adb_direct.c Thu May 06 06:01:27 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adb_direct.c,v 1.21 1999/03/18 09:10:19 scottr Exp $ */
+/* $NetBSD: adb_direct.c,v 1.22 1999/05/06 06:01:27 scottr Exp $ */
/* From: adb_direct.c 2.02 4/18/97 jpw */
@@ -316,26 +316,26 @@
* is in [0].
*/
void
-print_single(thestring)
- u_char *thestring;
+print_single(str)
+ u_char *str;
{
int x;
- if ((int)(thestring[0]) == 0) {
+ if (str == 0) {
+ printf_intr("no data - null pointer\n");
+ return;
+ }
+ if (*str == 0) {
printf_intr("nothing returned\n");
return;
}
- if (thestring == 0) {
- printf_intr("no data - null pointer\n");
- return;
- }
- if (thestring[0] > 20) {
+ if (*str > 20) {
printf_intr("ADB: ACK > 20 no way!\n");
- thestring[0] = 20;
+ *str = (u_char)20;
}
- printf_intr("(length=0x%x):", thestring[0]);
- for (x = 0; x < thestring[0]; x++)
- printf_intr(" 0x%02x", thestring[x + 1]);
+ printf_intr("(length=0x%x):", (u_int)*str);
+ for (x = 1; x <= *str; x++)
+ printf_intr(" 0x%02x", (u_int)*(str + x));
printf_intr("\n");
}
#endif
@@ -1082,7 +1082,7 @@
adbOutQueue.outBuf[1 + i] = buffer[i];
} else
/* if data ready, just copy over */
- for (i = 0; i <= (adbOutQueue.outBuf[0] + 1); i++)
+ for (i = 0; i <= (in[0] + 1); i++)
adbOutQueue.outBuf[i] = in[i];
adbOutQueue.saveBuf = buffer; /* save buffer to know where to save
@@ -1472,7 +1472,7 @@
* data, if any */
adbOutputBuffer[2 + i] = buffer[i];
} else
- for (i = 0; i <= (adbOutputBuffer[0] + 1); i++)
+ for (i = 0; i <= (in[0] + 1); i++)
adbOutputBuffer[i] = in[i];
adbSentChars = 0; /* nothing sent yet */
@@ -2200,6 +2200,7 @@
if (adbHardware != ADB_HW_PB) /* ints must be on for PB? */
splx(s);
+
return;
}
Home |
Main Index |
Thread Index |
Old Index