Skip to content

Commit d418e1f

Browse files
authored
correctly handle negative IDs in getUniqueId() methods (#1991)
1 parent 53815ae commit d418e1f

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -132,6 +132,6 @@ public NativeObject createDestructableClone() {
132132

133133
@Override
134134
public long getUniqueId() {
135-
return ((long) OBJTYPE_AUDIOBUFFER << 32) | ((long) id);
135+
return ((long) OBJTYPE_AUDIOBUFFER << 32) | (0xffffffffL & (long) id);
136136
}
137137
}

jme3-core/src/main/java/com/jme3/audio/AudioStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -222,6 +222,6 @@ public void setTime(float time) {
222222

223223
@Override
224224
public long getUniqueId() {
225-
return ((long) OBJTYPE_AUDIOSTREAM << 32) | ((long) ids[0]);
225+
return ((long) OBJTYPE_AUDIOSTREAM << 32) | (0xffffffffL & (long) ids[0]);
226226
}
227227
}

jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2020 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -99,6 +99,6 @@ public NativeObject createDestructableClone() {
9999

100100
@Override
101101
public long getUniqueId() {
102-
return ((long) OBJTYPE_FILTER << 32) | ((long) id);
102+
return ((long) OBJTYPE_FILTER << 32) | (0xffffffffL & (long) id);
103103
}
104104
}

jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -1116,7 +1116,7 @@ public NativeObject createDestructableClone() {
11161116

11171117
@Override
11181118
public long getUniqueId() {
1119-
return ((long) OBJTYPE_VERTEXBUFFER << 32) | ((long) id);
1119+
return ((long) OBJTYPE_VERTEXBUFFER << 32) | (0xffffffffL & (long) id);
11201120
}
11211121

11221122
@Override

jme3-core/src/main/java/com/jme3/shader/BufferObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,6 @@ protected void deleteNativeBuffers() {
829829

830830
@Override
831831
public long getUniqueId() {
832-
return ((long) OBJTYPE_BO << 32) | ((long) id);
832+
return ((long) OBJTYPE_BO << 32) | (0xffffffffL & (long) id);
833833
}
834834
}

jme3-core/src/main/java/com/jme3/shader/Shader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -189,7 +189,7 @@ public String getDefines() {
189189

190190
@Override
191191
public long getUniqueId() {
192-
return ((long)OBJTYPE_SHADERSOURCE << 32) | ((long)id);
192+
return ((long)OBJTYPE_SHADERSOURCE << 32) | (0xffffffffL & (long)id);
193193
}
194194

195195
@Override
@@ -462,6 +462,6 @@ public NativeObject createDestructableClone(){
462462

463463
@Override
464464
public long getUniqueId() {
465-
return ((long)OBJTYPE_SHADER << 32) | ((long)id);
465+
return ((long)OBJTYPE_SHADER << 32) | (0xffffffffL & (long)id);
466466
}
467467
}

jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2022 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -806,7 +806,7 @@ public NativeObject createDestructableClone() {
806806

807807
@Override
808808
public long getUniqueId() {
809-
return ((long) OBJTYPE_FRAMEBUFFER << 32) | ((long) id);
809+
return ((long) OBJTYPE_FRAMEBUFFER << 32) | (0xffffffffL & (long) id);
810810
}
811811

812812
/**

jme3-core/src/main/java/com/jme3/texture/Image.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2022 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -698,7 +698,7 @@ public NativeObject createDestructableClone() {
698698

699699
@Override
700700
public long getUniqueId() {
701-
return ((long)OBJTYPE_TEXTURE << 32) | ((long)id);
701+
return ((long)OBJTYPE_TEXTURE << 32) | (0xffffffffL & (long)id);
702702
}
703703

704704
/**

0 commit comments

Comments
 (0)