[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/libamf amf.cpp amf.h sol.h
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash/libamf amf.cpp amf.h sol.h |
Date: |
Wed, 26 Dec 2007 05:37:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 07/12/26 05:37:33
Modified files:
libamf : amf.cpp amf.h sol.h
Log message:
add boost:: prefix for boost typedefs, otherwise we are using the
global typedefs. those global(system dependent) typedefs are not available on
win32 platform.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/sol.h?cvsroot=gnash&r1=1.3&r2=1.4
Patches:
Index: amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- amf.cpp 20 Dec 2007 21:50:10 -0000 1.50
+++ amf.cpp 26 Dec 2007 05:37:32 -0000 1.51
@@ -133,25 +133,25 @@
// Little-endian machine: byte-swap the word
// A conveniently-typed pointer to the source data
- uint8_t *x = static_cast<uint8_t *>(word);
+ boost::uint8_t *x = static_cast<boost::uint8_t *>(word);
switch (size) {
case 2: // 16-bit integer
{
- uint8_t c;
+ boost::uint8_t c;
c=x[0]; x[0]=x[1]; x[1]=c;
break;
}
case 4: // 32-bit integer
{
- uint8_t c;
+ boost::uint8_t c;
c=x[0]; x[0]=x[3]; x[3]=c;
c=x[1]; x[1]=x[2]; x[2]=c;
break;
}
case 8: // 64-bit integer
{
- uint8_t c;
+ boost::uint8_t c;
c=x[0]; x[0]=x[7]; x[7]=c;
c=x[1]; x[1]=x[6]; x[6]=c;
c=x[2]; x[2]=x[5]; x[5]=c;
@@ -165,11 +165,11 @@
bool
-AMF::parseAMF(uint8_t *in)
+AMF::parseAMF(boost::uint8_t *in)
{
// GNASH_REPORT_FUNCTION;
- uint8_t *x = in;
+ boost::uint8_t *x = in;
while (*x != OBJECT_END) {
x = readElement(x);
@@ -177,12 +177,12 @@
return true;
}
-uint8_t *
+boost::uint8_t *
AMF::readElement(void *in)
{
// GNASH_REPORT_FUNCTION;
- uint8_t *x = static_cast<uint8_t *>(in);
+ boost::uint8_t *x = static_cast<boost::uint8_t *>(in);
astype_e type = (astype_e)*x;
bool boolshift;
const char *mstr = NULL;
@@ -290,15 +290,15 @@
/// normal ASCII. It may be that these need to be converted to wide
/// characters, but for now we just leave them as standard multibyte
/// characters.
-uint8_t *
+boost::uint8_t *
AMF::encodeElement(astype_e type, const void *in, int nbytes)
{
// GNASH_REPORT_FUNCTION;
amfnum_t num;
int pktsize = 0;
- uint8_t* out = NULL;
- uint8_t* x = NULL;
+ boost::uint8_t* out = NULL;
+ boost::uint8_t* x = NULL;
// Packets are of varying length. A few pass in a byte count, but
// most packets have a hardcoded size.
@@ -368,7 +368,7 @@
switch (type) {
case NUMBER:
// Encode the data as a 64 bit, big-endian, numeric value
- x = out = new uint8_t[pktsize];
+ x = out = new boost::uint8_t[pktsize];
memset(x, 0, pktsize);
*x++ = (char)AMF::NUMBER;
memcpy(&num, in, AMF_NUMBER_SIZE);
@@ -377,7 +377,7 @@
break;
case BOOLEAN:
// Encode a boolean value. 0 for false, 1 for true
- out = new uint8_t[pktsize];
+ out = new boost::uint8_t[pktsize];
x = out;
*x++ = (char)AMF::BOOLEAN;
*x = *static_cast<const char *>(in);
@@ -406,7 +406,7 @@
log_unimpl("Null AMF encoder");
break;
case UNDEFINED:
- x = out = new uint8_t[pktsize];
+ x = out = new boost::uint8_t[pktsize];
memset(x, 0, pktsize);
*x++ = AMF::UNDEFINED;
num = nbytes;
@@ -429,7 +429,7 @@
break;
// Encode the date as a 64 bit, big-endian, numeric value
case DATE:
- x = out = new uint8_t[pktsize];
+ x = out = new boost::uint8_t[pktsize];
memset(x, 0, pktsize);
*x++ = AMF::DATE;
num = *static_cast<const amfnum_t*>(in);
@@ -448,7 +448,7 @@
case XML_OBJECT:
// Encode an XML object. The data follows a 4 byte length
// field. (which must be big-endian)
- x = out = new uint8_t[pktsize];
+ x = out = new boost::uint8_t[pktsize];
memset(x, 0, pktsize);
*x++ = AMF::STRING;
num = nbytes;
@@ -716,12 +716,12 @@
return 0;
}
-int8_t *
-AMF::extractString(const uint8_t *in)
+boost::int8_t *
+AMF::extractString(const boost::uint8_t *in)
{
// GNASH_REPORT_FUNCTION;
- int8_t *buf = NULL;
- uint8_t *x = const_cast<uint8_t *>(in);
+ boost::int8_t *buf = NULL;
+ boost::uint8_t *x = const_cast<boost::uint8_t *>(in);
if (*x == AMF::STRING) {
x++;
@@ -740,10 +740,10 @@
}
amfnum_t *
-AMF::extractNumber(const uint8_t *in)
+AMF::extractNumber(const boost::uint8_t *in)
{
// GNASH_REPORT_FUNCTION;
- uint8_t *x = const_cast<uint8_t *>(in);
+ boost::uint8_t *x = const_cast<uint8_t *>(in);
amfnum_t *num = new amfnum_t;
memset(num, 0, AMF_NUMBER_SIZE);
@@ -760,7 +760,7 @@
AMF::amf_element_t *
AMF::createElement(amf_element_t *el, astype_e type,
- const std::string &name, uint8_t *data, int nbytes)
+ const std::string &name, boost::uint8_t *data, int nbytes)
{
// GNASH_REPORT_FUNCTION;
log_debug("Creating element %s", name.c_str());
@@ -790,7 +790,7 @@
el->name = name;
el->length = AMF_NUMBER_SIZE;
// char *numptr = (char *)&data;
- el->data = new uint8_t[AMF_NUMBER_SIZE + 1];
+ el->data = new boost::uint8_t[AMF_NUMBER_SIZE + 1];
memset(el->data, 0, AMF_NUMBER_SIZE + 1);
memcpy(el->data, &data, AMF_NUMBER_SIZE);
@@ -815,7 +815,7 @@
el->name = name;
el->length = AMF_NUMBER_SIZE;
// char *numptr = (char *)&data;
- el->data = new uint8_t[AMF_NUMBER_SIZE + 1];
+ el->data = new boost::uint8_t[AMF_NUMBER_SIZE + 1];
memset(el->data, 0, AMF_NUMBER_SIZE + 1);
memcpy(el->data, &data, AMF_NUMBER_SIZE);
@@ -832,7 +832,7 @@
el->name = name;
el->length = strlen(data);
char *str = const_cast<char *>(data);
- el->data = reinterpret_cast<uint8_t *>(str);
+ el->data = reinterpret_cast<boost::uint8_t *>(str);
return el;
}
@@ -846,7 +846,7 @@
el->name = name;
el->length = data.size();
char *str = const_cast<char *>(data.c_str());
- el->data = reinterpret_cast<uint8_t *>(str);
+ el->data = reinterpret_cast<boost::uint8_t *>(str);
return el;
}
@@ -867,7 +867,7 @@
el->type = AMF::BOOLEAN;
el->name = name;
el->length = 1;
- el->data = new uint8_t[sizeof(uint16_t)];
+ el->data = new boost::uint8_t[sizeof(uint16_t)];
memset(el->data, 0, sizeof(uint16_t));
*el->data = data;
return el;
@@ -904,13 +904,13 @@
{
// GNASH_REPORT_FUNCTION;
int outsize = el->name.size() + el->length + 5;
- uint8_t *out = new uint8_t[outsize + 2];
+ boost::uint8_t *out = new boost::uint8_t[outsize + 2];
memset(out, 0, outsize + 2);
- uint8_t *tmpptr = out;
+ boost::uint8_t *tmpptr = out;
// Add the length of the string for the name of the variable
size_t length = el->name.size();
- uint16_t enclength = length;
+ boost::uint16_t enclength = length;
swapBytes(&enclength, 2);
memcpy(tmpptr, &enclength, 2);
@@ -946,13 +946,13 @@
return out;
}
-uint8_t *
+boost::uint8_t *
AMF::encodeVariable(amf_element_t &el)
{
// GNASH_REPORT_FUNCTION;
int outsize = el.name.size() + el.length + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
// Add the length of the string for the name of the variable
size_t length = el.name.size();
@@ -973,14 +973,14 @@
return out;
}
-uint8_t *
+boost::uint8_t *
AMF::encodeVariable(const char *name, bool flag)
{
// GNASH_REPORT_FUNCTION;
int outsize = strlen(name) + AMF_NUMBER_SIZE + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
size_t length = strlen(name);
short enclength = length;
@@ -996,13 +996,13 @@
return out;
}
-uint8_t *
+boost::uint8_t *
AMF::encodeVariable(const char *name)
{
// GNASH_REPORT_FUNCTION;
size_t outsize = strlen(name) + AMF_NUMBER_SIZE + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new boost::uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
size_t length = strlen(name);
short enclength = length;
@@ -1017,13 +1017,13 @@
return out;
}
-uint8_t *
+boost::uint8_t *
AMF::encodeVariable(const char *name, amfnum_t bignum)
{
// GNASH_REPORT_FUNCTION;
int outsize = strlen(name) + AMF_NUMBER_SIZE + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new boost::uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
amfnum_t newnum = bignum;
char *numptr = (char *)&newnum;
@@ -1048,8 +1048,8 @@
// GNASH_REPORT_FUNCTION;
int outsize = strlen(name) + strlen(val) + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new boost::uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
size_t length = strlen(name);
short enclength = length;
@@ -1070,14 +1070,14 @@
return out;
}
-uint8_t *
+boost::uint8_t *
AMF::encodeVariable(std::string &name, std::string &val)
{
// GNASH_REPORT_FUNCTION;
int outsize = name.size() + val.size() + 5;
- uint8_t *out = new uint8_t[outsize];
- uint8_t *tmpptr = out;
+ boost::uint8_t *out = new boost::uint8_t[outsize];
+ boost::uint8_t *tmpptr = out;
short length;
length = name.size() && 0xffff;
@@ -1098,7 +1098,7 @@
}
int
-AMF::headerSize(int8_t header)
+AMF::headerSize(boost::int8_t header)
{
// GNASH_REPORT_FUNCTION;
@@ -1128,11 +1128,11 @@
}
int
-AMF::parseHeader(uint8_t *in)
+AMF::parseHeader(boost::uint8_t *in)
{
// GNASH_REPORT_FUNCTION;
- uint8_t *tmpptr = in;
+ boost::uint8_t *tmpptr = in;
log_msg (_("AMF header byte is: 0x%X"), *in);
@@ -1143,13 +1143,13 @@
log_msg (_("The header size is %d"), _header_size);
#if 1
- uint8_t *hexint;
- hexint = new uint8_t[(_header_size + 3) *3];
- hexify((uint8_t *)hexint, (uint8_t *)in, _header_size, false);
+ boost::uint8_t *hexint;
+ hexint = new boost::uint8_t[(_header_size + 3) *3];
+ hexify((boost::uint8_t *)hexint, (uint8_t *)in, _header_size, false);
log_msg(_("The packet head is: 0x%s"), hexint);
#endif
if (_header_size >= 4) {
- hexify((uint8_t *)hexint, (uint8_t *)tmpptr, 3, false);
+ hexify((boost::uint8_t *)hexint, (boost::uint8_t *)tmpptr, 3, false);
_mystery_word = *tmpptr++;
_mystery_word = (_mystery_word << 12) + *tmpptr++;
_mystery_word = (_mystery_word << 8) + *tmpptr++;
@@ -1157,7 +1157,7 @@
}
if (_header_size >= 8) {
- hexify((uint8_t *)hexint, (uint8_t *)tmpptr, 3, false);
+ hexify((boost::uint8_t *)hexint, (boost::uint8_t *)tmpptr, 3, false);
_total_size = *tmpptr++;
_total_size = (_total_size << 12) + *tmpptr++;
_total_size = (_total_size << 8) + *tmpptr++;
@@ -1169,7 +1169,7 @@
}
if (_header_size >= 8) {
- hexify((uint8_t *)hexint, (uint8_t *)tmpptr, 1, false);
+ hexify((boost::uint8_t *)hexint, (boost::uint8_t *)tmpptr, 1, false);
_type = *(content_types_e *)tmpptr;
tmpptr++;
log_msg(_("The type is: %d, or 0x%s"), _type, hexint);
@@ -1196,7 +1196,7 @@
};
if (_header_size == 12) {
- hexify((uint8_t *)hexint, (uint8_t *)tmpptr, 3, false);
+ hexify((boost::uint8_t *)hexint, (boost::uint8_t *)tmpptr, 3, false);
_src_dest = *(reinterpret_cast<amfsource_e *>(tmpptr));
tmpptr += sizeof(unsigned int);
log_msg(_("The source/destination is: %d, or 0x%s"), _src_dest,
hexint);
@@ -1205,8 +1205,8 @@
return _packet_size;
}
-uint8_t *
-AMF::addPacketData(uint8_t *data, int bytes)
+boost::uint8_t *
+AMF::addPacketData(boost::uint8_t *data, int bytes)
{
// GNASH_REPORT_FUNCTION;
memcpy(_seekptr, data, bytes);
@@ -1223,14 +1223,14 @@
}
int
-AMF::parseBody(uint8_t *in, int bytes)
+AMF::parseBody(boost::uint8_t *in, int bytes)
{
// GNASH_REPORT_FUNCTION;
- uint8_t *tmpptr;
+ boost::uint8_t *tmpptr;
// uint8_t hexint[(bytes*2)+1];
- uint8_t* hexint;
+ boost::uint8_t* hexint;
char buffer[500];
// char *name;
@@ -1246,12 +1246,12 @@
return -1;
}
- hexint = (uint8_t*) malloc((bytes * 3) + 12);
+ hexint = (boost::uint8_t*) malloc((bytes * 3) + 12);
// memcpy(_amf_data +_read_size, in, AMF_VIDEO_PACKET_SIZE);
// _read_size += bytes;
#if 1
- hexify((uint8_t *)hexint, (uint8_t *)in, bytes, true);
+ hexify((boost::uint8_t *)hexint, (boost::uint8_t *)in, bytes, true);
log_msg(_("The packet body is: 0x%s"), hexint);
#endif
@@ -1319,14 +1319,14 @@
return -1;
}
-uint8_t *
-AMF::extractVariable(AMF::amf_element_t *el, uint8_t *in)
+boost::uint8_t *
+AMF::extractVariable(AMF::amf_element_t *el, boost::uint8_t *in)
{
// GNASH_REPORT_FUNCTION;
- uint8_t buffer[AMF_PACKET_SIZE];
- uint8_t *tmpptr = in;
- int16_t length;
+ boost::uint8_t buffer[AMF_PACKET_SIZE];
+ boost::uint8_t *tmpptr = in;
+ boost::int16_t length;
if (el == 0) {
return 0;
Index: amf.h
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- amf.h 19 Dec 2007 21:04:11 -0000 1.26
+++ amf.h 26 Dec 2007 05:37:32 -0000 1.27
@@ -174,9 +174,9 @@
struct amf_element_t {
astype_e type;
- int16_t length;
+ boost::int16_t length;
std::string name;
- uint8_t *data;
+ boost::uint8_t *data;
amf_element_t()
:
@@ -206,13 +206,13 @@
///
/// @return an amf packet (header,data)
///
- uint8_t* encodeElement(astype_e type, const void *in, int nbytes);
+ boost::uint8_t* encodeElement(astype_e type, const void *in, int nbytes);
/// Encode a string
///
/// @return an amf packet (header,data)
///
- uint8_t* encodeString(const char *str) {
+ boost::uint8_t* encodeString(const char *str) {
return encodeElement (STRING, str, strlen(str));
};
@@ -220,7 +220,7 @@
///
/// @return an amf packet (header,data)
///
- uint8_t* encodeNumber(amfnum_t num) {
+ boost::uint8_t* encodeNumber(amfnum_t num) {
return encodeElement (NUMBER, &num, AMF_NUMBER_SIZE);
};
@@ -230,7 +230,7 @@
/// @ return an element all filled in correctly for passing to other
/// methods.
amf_element_t *createElement(amf_element_t *el, astype_e type,
- const std::string &name, uint8_t *data, int
nbytes);
+ const std::string &name, boost::uint8_t *data,
int nbytes);
amf_element_t *createElement(amf_element_t *el, const std::string &name,
amfnum_t data);
amf_element_t *createElement(amf_element_t *el, const char *name,
@@ -259,43 +259,43 @@
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(const char *name);
+ boost::uint8_t* encodeVariable(const char *name);
/// Encode a variable.
//
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(amf_element_t &el);
- uint8_t* encodeVariable(amf_element_t *el);
+ boost::uint8_t* encodeVariable(amf_element_t &el);
+ boost::uint8_t* encodeVariable(amf_element_t *el);
/// Encode a boolean variable. This is a name followed by a boolean value.
//
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(const char *name, bool flag);
+ boost::uint8_t* encodeVariable(const char *name, bool flag);
/// Encode a variable.
//
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(const char *name, amfnum_t num);
+ boost::uint8_t* encodeVariable(const char *name, amfnum_t num);
/// Encode a variable.
//
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(std::string &name, std::string &val);
+ boost::uint8_t* encodeVariable(std::string &name, std::string &val);
/// Encode a variable.
//
/// @return a newly allocated byte array,
/// to be deleted by caller using delete [] operator, or NULL
///
- uint8_t* encodeVariable(const char *name, const char *val);
+ boost::uint8_t* encodeVariable(const char *name, const char *val);
void *encodeRTMPHeader(int amf_index, amf_headersize_e head_size, int
total_size,
content_types_e type, amfsource_e routing);
@@ -303,7 +303,7 @@
// amfbody_t *encodeBody(amfutf8_t *target, amfutf8_t *response, int
nbytes, void *data);
// amfpacket_t *encodePacket(std::vector<amfhead_t *> messages);
- uint8_t *readElement(void *in);
+ boost::uint8_t *readElement(void *in);
/// Extract the string from a string-type AMF packet
//
@@ -312,20 +312,20 @@
///
/// Caller is responsible for deletion using delete [] operator.
///
- int8_t *extractString(const uint8_t* in);
+ boost::int8_t *extractString(const boost::uint8_t* in);
- amfnum_t *extractNumber(const uint8_t *in);
- amf_element_t *extractObject(const uint8_t *in);
+ amfnum_t *extractNumber(const boost::uint8_t *in);
+ amf_element_t *extractObject(const boost::uint8_t *in);
- unsigned char *extractVariable(amf_element_t *el, uint8_t *in);
+ unsigned char *extractVariable(amf_element_t *el, boost::uint8_t *in);
- bool parseAMF(uint8_t *in);
+ bool parseAMF(boost::uint8_t *in);
static int headerSize(int8_t header);
int packetReadAMF(int bytes);
- int parseHeader(uint8_t *in);
+ int parseHeader(boost::uint8_t *in);
int parseBody();
- int parseBody(uint8_t *in, int bytes);
+ int parseBody(boost::uint8_t *in, int bytes);
int getHeaderSize() { return _header_size; };
int getTotalSize() { return _total_size; };
@@ -336,9 +336,9 @@
content_types_e getType() { return _type; };
- uint8_t *addPacketData(uint8_t *data, int bytes);
+ boost::uint8_t *addPacketData(boost::uint8_t *data, int bytes);
std::map<std::string, amf_element_t *> *getElements() { return &_elements;
};
- uint8_t *appendPtr(uint8_t *data, uint8_t *var, int bytes) {
+ boost::uint8_t *appendPtr(boost::uint8_t *data, boost::uint8_t *var, int
bytes) {
memcpy(data, var, bytes);
return data += bytes;
}
@@ -352,8 +352,8 @@
int _header_size;
int _total_size;
int _packet_size;
- uint8_t *_amf_data;
- uint8_t *_seekptr;
+ boost::uint8_t *_amf_data;
+ boost::uint8_t *_seekptr;
int _mystery_word;
amfsource_e _src_dest;
};
Index: sol.h
===================================================================
RCS file: /sources/gnash/gnash/libamf/sol.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- sol.h 19 Dec 2007 05:18:46 -0000 1.3
+++ sol.h 26 Dec 2007 05:37:33 -0000 1.4
@@ -47,11 +47,11 @@
size_t size() { return _amfobjs.size(); };
// extract the header
- bool extractHeader(std::vector<uint8_t> &data);
+ bool extractHeader(std::vector<boost::uint8_t> &data);
bool extractHeader(std::string &filespec);
// Create the header
- bool formatHeader(std::vector<uint8_t> &data);
+ bool formatHeader(std::vector<boost::uint8_t> &data);
bool formatHeader(std::string &name);
bool formatHeader(std::string &name, int filesize);
@@ -64,7 +64,7 @@
// read the .sol file from disk
bool readFile(std::string &filespec);
- std::vector<uint8_t> getHeader() { return _header; };
+ std::vector<boost::uint8_t> getHeader() { return _header; };
// Add the AMF objects that are the data of the file
void addObj(AMF::amf_element_t &x);
@@ -80,8 +80,8 @@
std::string &getObjectName() { return _objname; };
private:
- std::vector<uint8_t> _header;
- std::vector<uint8_t> _data;
+ std::vector<boost::uint8_t> _header;
+ std::vector<boost::uint8_t> _data;
std::string _objname;
std::string _filespec;
std::vector<AMF::amf_element_t> _amfobjs;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/libamf amf.cpp amf.h sol.h,
Zou Lunkai <=