aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2014-04-11 10:58:09 -0700
committerHarvey Harrison <[email protected]>2014-04-11 10:58:09 -0700
commite0241be09419849ed88c68ea2a387a46bde2b77f (patch)
treedbe333333cc0ddabf486fa9961cd4561f7cc4055
parent45395696c252c215a8a22d05e5da7e98c662d07e (diff)
jogl: avoid bugs with sign-extension in JPEGDecoder
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r--src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
index 45087ea2c..078965301 100644
--- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
+++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
@@ -117,8 +117,8 @@ public class JPEGDecoder {
private JFIF(final byte data[]) {
version = new VersionNumber(data[5], data[6], 0);
densityUnits = data[7];
- xDensity = (data[8] << 8) | data[9];
- yDensity = (data[10] << 8) | data[11];
+ xDensity = ((data[ 8] << 8) & 0xff00) | (data[ 9] & 0xff);
+ yDensity = ((data[10] << 8) & 0xff00) | (data[11] & 0xff);
thumbWidth = data[12];
thumbHeight = data[13];
if( 0 < thumbWidth && 0 < thumbHeight ) {
@@ -155,8 +155,8 @@ public class JPEGDecoder {
private Adobe(final byte[] data) {
version = data[6];
- flags0 = (short) ( (data[7] << 8) | data[8] ) ;
- flags1 = (short) ( (data[9] << 8) | data[10] ) ;
+ flags0 = (short)(((data[7] << 8) & 0xff00) | (data[ 8] & 0xff));
+ flags1 = (short)(((data[9] << 8) & 0xff00) | (data[10] & 0xff));
colorCode = data[11];
switch( colorCode ) {
case 2: colorSpace = ColorSpace.YCCK; break;