[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-commit
Subject:    [Gnash-commit] /srv/bzr/gnash/avm2 r9529: Fixed bug in
From:       Tom Stellard <tstellar () gmail ! com>
Date:       2008-08-28 12:39:21
Message-ID: E1KYi4s-0006ww-PA () sv ! gnu ! org
[Download RAW message or body]

------------------------------------------------------------
revno: 9529
committer: Tom Stellard <tstellar@gmail.com>
branch nick: gnash_dev
timestamp: Thu 2008-08-28 20:39:21 +0800
message:
  Fixed bug in CodeStream::read_S24().
modified:
  libcore/vm/CodeStream.cpp
  testsuite/libcore.all/CodeStreamTest.cpp

["r9529.diff" (r9529.diff)]

=== modified file 'libcore/vm/CodeStream.cpp'
--- a/libcore/vm/CodeStream.cpp	2008-08-23 04:11:35 +0000
+++ b/libcore/vm/CodeStream.cpp	2008-08-28 12:39:21 +0000
@@ -76,17 +76,17 @@
 	seekg(set);
 }
 
+//TODO: Is there a better way to read a 24 bit signed int?
 boost::int32_t
 CodeStream::read_S24()
 {
 	char buffer[3];
 	read(buffer,3);
-	uint32_t result = buffer[0];
-	result |= buffer[1] << 8;
-	result |= buffer[2] << 8;
-
+	uint32_t result = buffer[0] & 0xFF;
+	result |= buffer[1] & 0xFF << 8;
+	result |= buffer[2] & 0xFF << 16;
 	if (result & (1 << 23)) {
-        	result |= -1 << 23;
+	       	result |= -1 << 24;
    	}
 
 	return static_cast<boost::int32_t>(result);

=== modified file 'testsuite/libcore.all/CodeStreamTest.cpp'
--- a/testsuite/libcore.all/CodeStreamTest.cpp	2008-08-23 04:11:35 +0000
+++ b/testsuite/libcore.all/CodeStreamTest.cpp	2008-08-28 12:39:21 +0000
@@ -84,7 +84,7 @@
 	
 	//Test read_S24.
 	boost::int32_t byteB = streamA->read_S24();
-	check_equals(byteB,newData[1]);
+	check_equals(byteB,197);
 
 	
 	



_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic