Skip to content

Commit

Permalink
correctly handle negative IDs in getUniqueId() methods (#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold authored Apr 29, 2023
1 parent 53815ae commit d418e1f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -132,6 +132,6 @@ public NativeObject createDestructableClone() {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_AUDIOBUFFER << 32) | ((long) id);
return ((long) OBJTYPE_AUDIOBUFFER << 32) | (0xffffffffL & (long) id);
}
}
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/audio/AudioStream.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -222,6 +222,6 @@ public void setTime(float time) {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_AUDIOSTREAM << 32) | ((long) ids[0]);
return ((long) OBJTYPE_AUDIOSTREAM << 32) | (0xffffffffL & (long) ids[0]);
}
}
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2020 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -99,6 +99,6 @@ public NativeObject createDestructableClone() {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_FILTER << 32) | ((long) id);
return ((long) OBJTYPE_FILTER << 32) | (0xffffffffL & (long) id);
}
}
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -1116,7 +1116,7 @@ public NativeObject createDestructableClone() {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_VERTEXBUFFER << 32) | ((long) id);
return ((long) OBJTYPE_VERTEXBUFFER << 32) | (0xffffffffL & (long) id);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jme3-core/src/main/java/com/jme3/shader/BufferObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,6 @@ protected void deleteNativeBuffers() {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_BO << 32) | ((long) id);
return ((long) OBJTYPE_BO << 32) | (0xffffffffL & (long) id);
}
}
6 changes: 3 additions & 3 deletions jme3-core/src/main/java/com/jme3/shader/Shader.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -189,7 +189,7 @@ public String getDefines() {

@Override
public long getUniqueId() {
return ((long)OBJTYPE_SHADERSOURCE << 32) | ((long)id);
return ((long)OBJTYPE_SHADERSOURCE << 32) | (0xffffffffL & (long)id);
}

@Override
Expand Down Expand Up @@ -462,6 +462,6 @@ public NativeObject createDestructableClone(){

@Override
public long getUniqueId() {
return ((long)OBJTYPE_SHADER << 32) | ((long)id);
return ((long)OBJTYPE_SHADER << 32) | (0xffffffffL & (long)id);
}
}
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -806,7 +806,7 @@ public NativeObject createDestructableClone() {

@Override
public long getUniqueId() {
return ((long) OBJTYPE_FRAMEBUFFER << 32) | ((long) id);
return ((long) OBJTYPE_FRAMEBUFFER << 32) | (0xffffffffL & (long) id);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions jme3-core/src/main/java/com/jme3/texture/Image.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2022 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -698,7 +698,7 @@ public NativeObject createDestructableClone() {

@Override
public long getUniqueId() {
return ((long)OBJTYPE_TEXTURE << 32) | ((long)id);
return ((long)OBJTYPE_TEXTURE << 32) | (0xffffffffL & (long)id);
}

/**
Expand Down

0 comments on commit d418e1f

Please sign in to comment.