diff options
author | Sven Gothel <[email protected]> | 2014-07-08 21:13:15 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-08 21:13:15 +0200 |
commit | 815776c5760e42c8b3c858a9bab982b203c59c24 (patch) | |
tree | 3f8ecd7e905b0f431f5472565fce837b24f922ab /src/jogl/classes/jogamp/opengl | |
parent | a41db57df54863566b0e286cd100bbbc5518eb7f (diff) |
Findbugs: Remove branches where reference cannot be null
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
5 files changed, 25 insertions, 24 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index 6f89a95f2..f2a9c78fa 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -354,7 +354,7 @@ public class GLUtessellatorImpl implements GLUtessellator { /* Create a new vertex and edge which immediately follow e * in the ordering around the left face. */ - if (Mesh.__gl_meshSplitEdge(e) == null) return false; + Mesh.__gl_meshSplitEdge(e); e = e.Lnext; } @@ -396,11 +396,12 @@ public class GLUtessellatorImpl implements GLUtessellator { final CachedVertex[] v = cache; mesh = Mesh.__gl_meshNewMesh(); - if (mesh == null) return false; for (int i = 0; i < cacheCount; i++) { final CachedVertex vertex = v[i]; - if (!addVertex(vertex.coords, vertex.data)) return false; + if (!addVertex(vertex.coords, vertex.data)) { + return false; + } } cacheCount = 0; flushCacheOnNextVertex = false; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java index 74d981907..fa29db8dc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java @@ -173,10 +173,11 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { pqNodes[i] = new PQnode(); } nodes = pqNodes; + /** Cannot be null if (nodes == null) { - nodes = saveNodes; /* restore ptr to free upon return */ + nodes = saveNodes; // restore ptr to free upon return return Integer.MAX_VALUE; - } + } */ // pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); final PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; @@ -185,10 +186,11 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { pqHandles[i] = new PQhandleElem(); } handles = pqHandles; + /** cannot be null if (handles == null) { - handles = saveHandles; /* restore ptr to free upon return */ + handles = saveHandles; // restore ptr to free upon return return Integer.MAX_VALUE; - } + } */ } if (freeList == 0) { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java index 45e994b67..d88f584cf 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java @@ -202,7 +202,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } curr = size; if (++size >= max) { - final Object[] saveKey = keys; + // final Object[] saveKey = keys; /* If the heap overflows, double its size. */ max <<= 1; @@ -210,10 +210,11 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { final Object[] pqKeys = new Object[max]; System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; + /** Cannot be null if (keys == null) { - keys = saveKey; /* restore ptr to free upon return */ + keys = saveKey; // restore ptr to free upon return return Integer.MAX_VALUE; - } + } */ } assert curr != Integer.MAX_VALUE; keys[curr] = keyNew; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index 9cf05378c..b6c60058f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -1237,7 +1237,6 @@ class Sweep { return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); } }); - if (pq == null) return false; vHead = tess.mesh.vHead; for (v = vHead.next; v != vHead; v = v.next) { diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 6aa753ac1..05e192bbc 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -571,19 +571,17 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.vid = vid; this.aid = aid; - if ( this.streamLoc != null ) { - new Thread() { - public void run() { - try { - // StreamWorker may be used, see API-doc of StreamWorker - initStreamImpl(vid, aid); - } catch (final Throwable t) { - streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t); - changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized); - } // also initializes width, height, .. etc - } - }.start(); - } + new Thread() { + public void run() { + try { + // StreamWorker may be used, see API-doc of StreamWorker + initStreamImpl(vid, aid); + } catch (final Throwable t) { + streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t); + changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized); + } // also initializes width, height, .. etc + } + }.start(); } } /** |