Preserve endianness when duplicating bytebuffers#2865
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility class ByteBufferUtils with a duplicate method that duplicates a ByteBuffer while preserving its byte order. It replaces direct calls to ByteBuffer.duplicate() with this utility across several classes (including AndroidGL, EnvMapUtils, GLRenderer, BufferObject, and others) and updates buffer allocations to explicitly maintain byte order. Feedback suggests adding a defensive null check to ByteBufferUtils.duplicate to prevent potential NullPointerExceptions, and adding a null check while simplifying the duplication logic in BufferObject.setData to avoid side effects on the caller's buffer.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This currently does not fix anything in the engine, since in one way or the other the endianess was restored manually, or unimportant in jme code.
This is mostly for correctness and to avoid surprises in the future.