This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: java/awt/image/PixelGrabber.java
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 25 Jan 2002 17:40:05 +1300
- Subject: Patch: java/awt/image/PixelGrabber.java
The build was failing on PixelGrabber due to an "Unreachable Statement"
error. This is probably a bug in GCJ because with -O it considers "(x !=
1 || x != 2)" to a constant expression with the value of true, while I
guess the JLS does not. This likely happens due to fold() collapsing it.
In any case, the PixelGrabber code is certainly not right, and this
patch is a slight improvement which at least compiles.
regards
Bryce.
Index: PixelGrabber.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/image/PixelGrabber.java,v
retrieving revision 1.1
diff -u -r1.1 PixelGrabber.java
--- PixelGrabber.java 2002/01/24 01:05:12 1.1
+++ PixelGrabber.java 2002/01/25 04:23:10
@@ -155,15 +155,7 @@
*/
public boolean grabPixels() throws InterruptedException
{
- startGrabbing();
- while ( (status != ImageObserver.ALLBITS ) ||
- (status != ImageObserver.ERROR ) ||
- (status != ImageObserver.ABORT ) );
-
- if( status == ImageObserver.ALLBITS )
- return true;
- else
- return false;
+ return grabPixels(0);
}
/**
@@ -176,24 +168,17 @@
*/
public synchronized boolean grabPixels(long ms) throws
InterruptedException
{
- long start = System.currentTimeMillis();
startGrabbing();
- while ( (status != ImageObserver.ALLBITS ) ||
- (status != ImageObserver.ERROR ) ||
- (status != ImageObserver.ABORT ) )
- {
- if( (System.currentTimeMillis() - start ) >= ms )
- {
- abortGrabbing();
- throw new InterruptedException();
- }
- }
-
- if( status == ImageObserver.ALLBITS )
+
+ if (ms < 0)
+ return (status == ImageObserver.ALLBITS);
+
+ wait(ms);
+
+ if (status == ImageObserver.ALLBITS)
return true;
else
return false;
-
}
/**