From d418e1fc59e703c8ac16f759e961793613ac39a5 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Fri, 28 Apr 2023 18:02:39 -0700 Subject: [PATCH] correctly handle negative IDs in getUniqueId() methods (#1991) --- jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java | 4 ++-- jme3-core/src/main/java/com/jme3/audio/AudioStream.java | 4 ++-- jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java | 4 ++-- jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java | 4 ++-- jme3-core/src/main/java/com/jme3/shader/BufferObject.java | 2 +- jme3-core/src/main/java/com/jme3/shader/Shader.java | 6 +++--- jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java | 4 ++-- jme3-core/src/main/java/com/jme3/texture/Image.java | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java b/jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java index 80f5f63040..249d9601eb 100644 --- a/jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java +++ b/jme3-core/src/main/java/com/jme3/audio/AudioBuffer.java @@ -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 @@ -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); } } diff --git a/jme3-core/src/main/java/com/jme3/audio/AudioStream.java b/jme3-core/src/main/java/com/jme3/audio/AudioStream.java index ccc74e181c..15b40c5b43 100644 --- a/jme3-core/src/main/java/com/jme3/audio/AudioStream.java +++ b/jme3-core/src/main/java/com/jme3/audio/AudioStream.java @@ -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 @@ -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]); } } diff --git a/jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java b/jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java index aaf1f5b69b..daa49adb65 100644 --- a/jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java +++ b/jme3-core/src/main/java/com/jme3/audio/LowPassFilter.java @@ -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 @@ -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); } } diff --git a/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java b/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java index 8698bf421a..8c0a388bb7 100644 --- a/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java +++ b/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java @@ -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 @@ -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 diff --git a/jme3-core/src/main/java/com/jme3/shader/BufferObject.java b/jme3-core/src/main/java/com/jme3/shader/BufferObject.java index f1522ff5ba..b893576a87 100644 --- a/jme3-core/src/main/java/com/jme3/shader/BufferObject.java +++ b/jme3-core/src/main/java/com/jme3/shader/BufferObject.java @@ -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); } } diff --git a/jme3-core/src/main/java/com/jme3/shader/Shader.java b/jme3-core/src/main/java/com/jme3/shader/Shader.java index 7860e29b13..eb2f778d39 100644 --- a/jme3-core/src/main/java/com/jme3/shader/Shader.java +++ b/jme3-core/src/main/java/com/jme3/shader/Shader.java @@ -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 @@ -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 @@ -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); } } diff --git a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java index 3b18bce1a2..7153f8200f 100644 --- a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java +++ b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java @@ -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 @@ -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); } /** diff --git a/jme3-core/src/main/java/com/jme3/texture/Image.java b/jme3-core/src/main/java/com/jme3/texture/Image.java index b928fd9959..4f576b810c 100644 --- a/jme3-core/src/main/java/com/jme3/texture/Image.java +++ b/jme3-core/src/main/java/com/jme3/texture/Image.java @@ -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 @@ -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); } /**