gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10151: Use std::search instead of d


From: Bastiaan Jacques
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10151: Use std::search instead of defining our own search method.
Date: Mon, 27 Oct 2008 19:37:05 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10151
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Mon 2008-10-27 19:37:05 +0100
message:
  Use std::search instead of defining our own search method.
modified:
  libamf/buffer.cpp
  libamf/buffer.h
  testsuite/libamf.all/test_buffer.cpp
=== modified file 'libamf/buffer.cpp'
--- a/libamf/buffer.cpp 2008-10-27 12:13:36 +0000
+++ b/libamf/buffer.cpp 2008-10-27 18:37:05 +0000
@@ -506,18 +506,6 @@
      return false;
 }
 
-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 Drop a byte without resizing.
 ///            This will remove the byte from the Buffer, and then
 ///            move the remaining data to be in the correct

=== modified file 'libamf/buffer.h'
--- a/libamf/buffer.h   2008-10-27 02:28:31 +0000
+++ b/libamf/buffer.h   2008-10-27 18:37:05 +0000
@@ -234,15 +234,6 @@
     /// @return A reference to a Buffer.
     Buffer &operator+=(bool);
     
-    /// \brief Find a set of bytes 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);
-    
     /// \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

=== modified file 'testsuite/libamf.all/test_buffer.cpp'
--- a/testsuite/libamf.all/test_buffer.cpp      2008-10-27 02:28:31 +0000
+++ b/testsuite/libamf.all/test_buffer.cpp      2008-10-27 18:37:05 +0000
@@ -338,7 +338,7 @@
 
     const char *sub = "fgh";
     Network::byte_t *ptr2 = const_cast<Network::byte_t 
*>(reinterpret_cast<const Network::byte_t *>(sub));
-    fptr = buf1.find(ptr2, 3);
+    fptr = std::search(buf1.begin(), buf1.end(), sub, sub+3);
     if (fptr == (ptr1 + 5)) {
          runtest.pass ("Buffer::find(Network::byte_t *, size_t)");
     } else {


reply via email to

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