gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9911: call hexify() ourselves to be


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9911: call hexify() ourselves to be more convienient when debugging Buffer contents.
Date: Sat, 27 Dec 2008 09:51:48 -0700
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9911
committer: address@hidden
branch nick: rtmp
timestamp: Sat 2008-12-27 09:51:48 -0700
message:
  call hexify() ourselves to be more convienient when debugging Buffer contents.
modified:
  libamf/buffer.cpp
  libamf/buffer.h
=== modified file 'libamf/buffer.cpp'
--- a/libamf/buffer.cpp 2008-12-23 02:57:22 +0000
+++ b/libamf/buffer.cpp 2008-12-27 16:51:48 +0000
@@ -95,6 +95,25 @@
     return *this;
 }
 
+// Convert each byte into its hex representation
+std::string
+Buffer::hexify ()
+{
+    return gnash::hexify(_data.get(), allocated(), false);
+}
+
+std::string
+Buffer::hexify (bool ascii)
+{
+    return gnash::hexify(_data.get(), allocated(), ascii);
+}
+
+std::string
+Buffer::hexify (amf::Buffer &buf, bool ascii)
+{
+    return gnash::hexify(buf.reference(), buf.allocated(), ascii);
+}
+
 /// \brief Initialize a block of memory for this buffer.
 ///            This should only be used internally by the Buffer
 ///            class.

=== modified file 'libamf/buffer.h'
--- a/libamf/buffer.h   2008-12-20 17:11:55 +0000
+++ b/libamf/buffer.h   2008-12-27 16:51:48 +0000
@@ -79,6 +79,21 @@
     ///                primary used only for testing to create binary data
     ///                from an easy to read and edit format.
     Buffer &hex2mem(const std::string &str);
+
+    /// \brief Output a debug version of the Buffer's data.
+    ///                This just calls the gnash::Logfile::hexify(), but is
+    ///                more convienient as we don't have to extract the pointer
+    ///                and the byte count to hexify() a Buffer.
+    ///
+    /// @param ascii True if ASCII characters should be printed, false
+    ///                if only hex is desired.
+    ///
+    /// @param buf The buffer to hexify().
+    ///
+    /// @return A string of the debug output
+    std::string hexify();
+    std::string hexify(bool ascii);
+    std::string hexify(Buffer &buf, bool ascii);
     
     /// \brief Clear the contents of the buffer by setting all the bytes to
     ///                zeros.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]