public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4645: -Wall warning for -1 return on signed long does not make sense
@ 2001-11-20 18:03 aoliva
  0 siblings, 0 replies; 4+ messages in thread
From: aoliva @ 2001-11-20 18:03 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4645; it has been noted by GNATS.

From: aoliva@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org, waratah@zip.com.au
Cc:  
Subject: Re: c++/4645: -Wall warning for -1 return on signed long does not make sense
Date: 25 Nov 2001 17:28:07 -0000

 Synopsis: -Wall warning for -1 return on signed long does not make sense
 
 State-Changed-From-To: open->feedback
 State-Changed-By: aoliva
 State-Changed-When: Sun Nov 25 09:28:06 2001
 State-Changed-Why:
     Could it be the type of PZSTREAM->total_out causing nOldTotal_Out to promote to unsigned long int, and ditto for the ``else'' branch of the ternary operator?
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4645&database=gcc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/4645: -Wall warning for -1 return on signed long does not make sense
@ 2002-02-17 19:10 rodrigc
  0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-02-17 19:10 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, waratah

Synopsis: -Wall warning for -1 return on signed long does not make sense

State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Feb 17 19:10:42 2002
State-Changed-Why:
    No further feedback.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4645


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/4645: -Wall warning for -1 return on signed long does not make sense
@ 2001-11-20 18:01 aoliva
  0 siblings, 0 replies; 4+ messages in thread
From: aoliva @ 2001-11-20 18:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-gnats, gcc-prs, nobody, waratah

Synopsis: -Wall warning for -1 return on signed long does not make sense

State-Changed-From-To: open->feedback
State-Changed-By: aoliva
State-Changed-When: Sun Nov 25 09:28:06 2001
State-Changed-Why:
    Could it be the type of PZSTREAM->total_out causing nOldTotal_Out to promote to unsigned long int, and ditto for the ``else'' branch of the ternary operator?

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=4645&database=gcc


^ permalink raw reply	[flat|nested] 4+ messages in thread

* c++/4645: -Wall warning for -1 return on signed long does not make sense
@ 2001-10-22  8:16 waratah
  0 siblings, 0 replies; 4+ messages in thread
From: waratah @ 2001-10-22  8:16 UTC (permalink / raw)
  To: gcc-gnats

>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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-18  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-20 18:03 c++/4645: -Wall warning for -1 return on signed long does not make sense aoliva
  -- strict thread matches above, loose matches on Subject: below --
2002-02-17 19:10 rodrigc
2001-11-20 18:01 aoliva
2001-10-22  8:16 waratah

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).