[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/avm2 r9529: Fixed bug in CodeStream::read_
From: |
Tom Stellard |
Subject: |
[Gnash-commit] /srv/bzr/gnash/avm2 r9529: Fixed bug in CodeStream::read_S24(). |
Date: |
Thu, 28 Aug 2008 20:39:21 +0800 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9529
committer: Tom Stellard <address@hidden>
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
=== 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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/avm2 r9529: Fixed bug in CodeStream::read_S24().,
Tom Stellard <=