[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12166: Adjust swapBytes' signature
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12166: Adjust swapBytes' signature to match the way it's used. |
Date: |
Wed, 21 Apr 2010 20:29:59 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12166
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Wed 2010-04-21 20:29:59 +0200
message:
Adjust swapBytes' signature to match the way it's used.
modified:
libbase/AMF.cpp
libbase/AMF.h
=== modified file 'libbase/AMF.cpp'
--- a/libbase/AMF.cpp 2010-02-25 21:39:02 +0000
+++ b/libbase/AMF.cpp 2010-04-21 18:29:59 +0000
@@ -145,7 +145,7 @@
write(SimpleBuffer& buf, const std::string& str)
{
Type t = str.size() < 65536 ? STRING_AMF0 : LONG_STRING_AMF0;
- buf.appendByte(t);
+ buf.appendByte(t);
writePlainString(buf, str, t);
}
@@ -160,35 +160,33 @@
void
write(SimpleBuffer& buf, bool b)
{
- buf.appendByte(BOOLEAN_AMF0);
+ buf.appendByte(BOOLEAN_AMF0);
buf.appendByte(b ? 1 : 0);
}
-void*
+void
swapBytes(void* word, size_t size)
{
union {
- boost::uint16_t s;
- struct {
- boost::uint8_t c0;
- boost::uint8_t c1;
- } c;
+ boost::uint16_t s;
+ struct {
+ boost::uint8_t c0;
+ boost::uint8_t c1;
+ } c;
} u;
u.s = 1;
- if (u.c.c0 == 0) {
+ if (u.c.c0 == 0) {
// Big-endian machine: do nothing
- return word;
+ return;
}
// Little-endian machine: byte-swap the word
// A conveniently-typed pointer to the source data
boost::uint8_t *x = static_cast<boost::uint8_t *>(word);
- /// Handle odd as well as even counts of bytes
+ // Handles odd as well as even counts of bytes
std::reverse(x, x + size);
-
- return word;
}
=== modified file 'libbase/AMF.h'
--- a/libbase/AMF.h 2010-03-08 06:29:39 +0000
+++ b/libbase/AMF.h 2010-04-21 18:29:59 +0000
@@ -195,7 +195,7 @@
/// @param word The address of the data to byte swap.
/// @param size The number of bytes in the data.
/// @return A pointer to the raw data.
-DSOEXPORT void* swapBytes(void* word, size_t size);
+DSOEXPORT void swapBytes(void* word, size_t size);
} // namespace amf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12166: Adjust swapBytes' signature to match the way it's used.,
Bastiaan Jacques <=