Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctly handle negative IDs in getUniqueId() methods #1991

Merged
merged 1 commit into from
Apr 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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