gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10123: Since Buffer now has a begin


From: Bastiaan Jacques
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10123: Since Buffer now has a begin() and an end(), we can use std::find
Date: Mon, 27 Oct 2008 03:12:41 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10123
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Mon 2008-10-27 03:12:41 +0100
message:
  Since Buffer now has a begin() and an end(), we can use std::find
  instead of specialized search methods, as demonstrated.
modified:
  libamf/buffer.cpp
  libamf/buffer.h
=== modified file 'libamf/buffer.cpp'
--- a/libamf/buffer.cpp 2008-10-26 23:39:56 +0000
+++ b/libamf/buffer.cpp 2008-10-27 02:12:41 +0000
@@ -507,42 +507,6 @@
      return false;
 }
 
-/// \brief Find a byte in the buffer
-///
-/// @param byte The bytes to find in the buffer.
-///
-/// @param size The size of the bytes being searched for.
-///
-/// @return A real pointer to the address of the byte in the buffer.
-Network::byte_t *
-Buffer::find(Network::byte_t *b, size_t size)
-{
-//    GNASH_REPORT_FUNCTION;
-    for (size_t i=0; i< _nbytes; i++) {
-       if (memcmp((_data.get() + i), b, size) == 0) {
-           return _data.get() + i;
-       }
-    }
-    return 0;
-}
-
-/// \brief Find a byte in the buffer
-///
-/// @param byte The byte to find in the buffer.
-///
-/// @return A pointer to the address of the byte in the buffer.
-Network::byte_t *
-Buffer::find(Network::byte_t c)
-{
-//    GNASH_REPORT_FUNCTION;
-    for (size_t i=0; i< _nbytes; i++) {
-       if (*(_data.get() + i) == c) {
-           return _data.get() + i;
-       }
-    }
-    return 0;
-}
-
 /// \brief Drop a byte without resizing.
 ///            This will remove the byte from the Buffer, and then
 ///            move the remaining data to be in the correct
@@ -555,7 +519,7 @@
 Buffer::remove(Network::byte_t c)
 {
 //    GNASH_REPORT_FUNCTION;
-    Network::byte_t *start = find(c);
+    Network::byte_t *start = std::find(begin(), end(), c);
 
 //    log_debug("Byte is at %x", (void *)start);
     

=== modified file 'libamf/buffer.h'
--- a/libamf/buffer.h   2008-10-26 23:35:38 +0000
+++ b/libamf/buffer.h   2008-10-27 02:12:41 +0000
@@ -234,22 +234,6 @@
     /// @return A reference to a Buffer.
     Buffer &operator+=(bool);
     
-    /// \brief Find a byte in the buffer
-    ///
-    /// @param byte The byte to find in the buffer.
-    ///
-    /// @return A pointer to the address of the byte in the buffer.
-    gnash::Network::byte_t *find(gnash::Network::byte_t byte);
-    /// \brief Find a byte in the buffer
-    ///
-    /// @param byte The bytes to find in the buffer.
-    ///
-    /// @param size The size of the bytes being searched for.
-    ///
-    /// @return A real pointer to the address of the byte in the buffer.
-    gnash::Network::byte_t *find(gnash::Network::byte_t *byte, size_t size);
-//    Network::byte_t *find(char c);
-    
     /// \brief Drop a byte without resizing.
     ///                This will remove the byte from the Buffer, and then
     ///                move the remaining data to be in the correct


reply via email to

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