public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: waratah@zip.com.au
To: gcc-gnats@gcc.gnu.org
Subject: c++/4645: -Wall warning for -1 return on signed long does not make sense
Date: Mon, 22 Oct 2001 08:16:00 -0000	[thread overview]
Message-ID: <20011022151501.20450.qmail@sourceware.cygnus.com> (raw)

>Number:         4645
>Category:       c++
>Synopsis:       -Wall warning for -1 return on signed long does not make sense
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 22 08:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ken Foskey
>Release:        gcc  2.95.4
>Organization:
>Environment:
LInux,  debian woody
>Description:
The final return line in this open office 'tools' code generates under -Wall:

/data/office/tools/source/zcodec/zcodec.cxx:195: warning: converting of negative value `-1' to `long unsigned int'

Where does the 'long unsigned int' come from?  The line before it lists 'In method `long int ZCodec::Compress(SvStream &, SvStream &)':'  so it cannot be the return value.


long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
{
	char	err;
	ULONG	nInToRead;
	long	nOldTotal_Out = PZSTREAM->total_out;

	if ( mbFinish )	
		return PZSTREAM->total_out - nOldTotal_Out;

	if ( mbInit == 0 )
	{
		mpIStm = &rIStm;
		mpOStm = &rOStm;
		ImplInitBuf( TRUE );
		PZSTREAM->next_out = mpOutBuf = new BYTE[ PZSTREAM->avail_out = mnOutBufSize ];
	}
	do
	{
		if ( PZSTREAM->avail_out == 0 ) ImplWriteBack();
		if ( PZSTREAM->avail_in == 0 && mnInToRead )
		{		
			nInToRead = ( mnInBufSize > mnInToRead ) ? mnInToRead : mnInBufSize;
			PZSTREAM->avail_in = mpIStm->Read( PZSTREAM->next_in = mpInBuf, nInToRead );
			mnInToRead -= nInToRead;

			if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
				mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );

		}
		err = inflate( PZSTREAM, Z_NO_FLUSH );
		if ( err < 0 )
		{
			mbStatus = FALSE;
			break;
		}
		
	}		
	while ( ( err != Z_STREAM_END)  && ( PZSTREAM->avail_in || mnInToRead ) );
	ImplWriteBack();
	
	if ( err == Z_STREAM_END ) 
		mbFinish = TRUE;	
	return ( mbStatus ) ? PZSTREAM->total_out - nOldTotal_Out : -1;
}

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-10-22  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-22  8:16 waratah [this message]
2001-11-20 18:01 aoliva
2001-11-20 18:03 aoliva
2002-02-17 19:10 rodrigc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011022151501.20450.qmail@sourceware.cygnus.com \
    --to=waratah@zip.com.au \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).