Ethereal-dev: Re: [ethereal-dev] Problem with toshiba.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Wed, 17 Nov 1999 22:20:53 -0600
On Thu, Nov 18, 1999 at 12:53:13AM -0500, Craig Rodrigues wrote:
> Hi,
> 
> I am having some problems compiling toshiba.c:
> ==========================================================================
>       152 |                 if (fgets(buf, 240, wth->fh) >= 0) {
>             .............................................a......
> a - 1506-068 (S) Operation between types "char*" and "int" is not allowed.

That was rather silly of me. I've checked in the fix, and attached
the diff as well.

--gilbert
Index: toshiba.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/wiretap/toshiba.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- toshiba.c	1999/11/11 19:19:17	1.4
+++ toshiba.c	1999/11/18 07:04:29	1.5
@@ -1,6 +1,6 @@
 /* toshiba.c
  *
- * $Id: toshiba.c,v 1.4 1999/11/11 19:19:17 gram Exp $
+ * $Id: toshiba.c,v 1.5 1999/11/18 07:04:29 gram Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@xxxxxxxxxx>
@@ -149,7 +149,7 @@
 	buf[TOSHIBA_LINE_LENGTH-1] = 0;
 
 	for (line = 0; line < TOSHIBA_HEADER_LINES_TO_CHECK; line++) {
-		if (file_gets(buf, TOSHIBA_LINE_LENGTH, wth->fh) >= 0) {
+		if (file_gets(buf, TOSHIBA_LINE_LENGTH, wth->fh) != NULL) {
 
 			reclen = strlen(buf);
 			if (reclen < TOSHIBA_HDR_MAGIC_SIZE) {
@@ -263,7 +263,7 @@
 	 * summary information for a packet. Read in that line and
 	 * extract the useful information
 	 */
-	if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) < 0) {
+	if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) {
 		*err = file_error(fh);
 		if (*err == 0) {
 			*err = WTAP_ERR_SHORT_READ;
@@ -284,7 +284,7 @@
 
 	/* The next line contains mostly junk, but it does contain the
 	 * packet length. */
-	if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) < 0) {
+	if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) {
 		*err = file_error(fh);
 		if (*err == 0) {
 			*err = WTAP_ERR_SHORT_READ;
@@ -334,7 +334,7 @@
 	hex_lines = pkt_len / 16 + ((pkt_len % 16) ? 1 : 0);
 
 	for (i = 0; i < hex_lines; i++) {
-		if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) < 0) {
+		if (file_gets(line, TOSHIBA_LINE_LENGTH, fh) == NULL) {
 			*err = file_error(fh);
 			if (*err == 0) {
 				*err = WTAP_ERR_SHORT_READ;