|
Boost-Commit : |
From: dwalker07_at_[hidden]
Date: 2008-08-28 18:04:39
Author: dlwalker
Date: 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
New Revision: 48428
URL: http://svn.boost.org/trac/boost/changeset/48428
Log:
Revised interface by removing byte_coding_shell::operator() and renaming 'compute_md5' to 'md5'; updated other code and comments to match; ensured that MD5-checking example does not skip bytes that match white-space characters
Text files modified:
sandbox/md5/boost/coding.hpp | 2 +-
sandbox/md5/boost/coding/coding_shell.hpp | 17 +----------------
sandbox/md5/boost/coding/md5.hpp | 2 +-
sandbox/md5/boost/coding/md5_computer.hpp | 2 +-
sandbox/md5/boost/coding/md5_digest_core.hpp | 2 +-
sandbox/md5/libs/coding/example/md5basic.cpp | 6 +++---
sandbox/md5/libs/coding/example/md5check.cpp | 6 +++---
sandbox/md5/libs/coding/test/md5_computer_test.cpp | 14 +++++---------
8 files changed, 16 insertions(+), 35 deletions(-)
Modified: sandbox/md5/boost/coding.hpp
==============================================================================
--- sandbox/md5/boost/coding.hpp (original)
+++ sandbox/md5/boost/coding.hpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -30,7 +30,7 @@
using coding::md5_context;
using coding::md5_byte_context;
using coding::md5_computer;
-using coding::compute_md5;
+using coding::md5;
} // namespace boost
Modified: sandbox/md5/boost/coding/coding_shell.hpp
==============================================================================
--- sandbox/md5/boost/coding/coding_shell.hpp (original)
+++ sandbox/md5/boost/coding/coding_shell.hpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -144,10 +144,7 @@
//! Equals
bool operator ==( self_type const &o ) const;
//! Not-equals
- bool operator !=( self_type const &o ) const;
-
- //! Application
- value_type operator ()() const;//@} // remove?
+ bool operator !=( self_type const &o ) const;//@}
}; // byte_coding_shell
@@ -314,18 +311,6 @@
byte_coding_shell<ByteProcessor>::operator !=( self_type const &o ) const
{ return !this->operator ==( o ); }
-/** Computes the check-sum of the submitted data, through a standard generator
- interface.
-
- \return The generated check-sum.
-
- \see #checksum()const
- */
-template < class ByteProcessor >
-inline typename byte_coding_shell<ByteProcessor>::value_type
-byte_coding_shell<ByteProcessor>::operator ()() const
-{ return this->checksum(); }
-
// Byte-processing bit-processor wrapper class template declaration --------//
Modified: sandbox/md5/boost/coding/md5.hpp
==============================================================================
--- sandbox/md5/boost/coding/md5.hpp (original)
+++ sandbox/md5/boost/coding/md5.hpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -50,7 +50,7 @@
\see boost::coding::md5_digest
\see boost::coding::md5_byte_context
*/
-inline md5_digest compute_md5( void const *buffer, std::size_t byte_count )
+inline md5_digest md5( void const *buffer, std::size_t byte_count )
{
md5_byte_context c;
unsigned char const * b = static_cast<unsigned char const *>( buffer );
Modified: sandbox/md5/boost/coding/md5_computer.hpp
==============================================================================
--- sandbox/md5/boost/coding/md5_computer.hpp (original)
+++ sandbox/md5/boost/coding/md5_computer.hpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -51,7 +51,7 @@
\see boost::coding::md5_digest
\see boost::coding::md5_context
- \see boost::coding::compute_md5(void const*,std::size_t)
+ \see boost::coding::md5(void const*,std::size_t)
*/
class md5_computer
: public bit_coding_shell<md5_context, true>
Modified: sandbox/md5/boost/coding/md5_digest_core.hpp
==============================================================================
--- sandbox/md5/boost/coding/md5_digest_core.hpp (original)
+++ sandbox/md5/boost/coding/md5_digest_core.hpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -55,7 +55,7 @@
\see boost::coding::md5_context
\see boost::coding::md5_computer
- \see boost::coding::compute_md5(void const*,std::size_t)
+ \see boost::coding::md5(void const*,std::size_t)
*/
struct md5_digest
{
Modified: sandbox/md5/libs/coding/example/md5basic.cpp
==============================================================================
--- sandbox/md5/libs/coding/example/md5basic.cpp (original)
+++ sandbox/md5/libs/coding/example/md5basic.cpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -6,7 +6,7 @@
// See <http://www.boost.org/libs/coding> for the library's home page.
-#include <boost/coding/md5.hpp> // for boost::coding::compute_md5
+#include <boost/coding/md5.hpp> // for boost::coding::md5
#include <cstring> // for std::strlen
#include <cstdlib> // for EXIT_SUCCESS, EXIT_FAILURE
@@ -27,8 +27,8 @@
{
// Check-sum each command-line string
for ( int i = 1 ; i < argc ; ++i )
- std::cout << boost::coding::compute_md5( argv[i], std::strlen(argv[
- i ]) ) << endl;
+ std::cout << boost::coding::md5( argv[i], std::strlen(argv[ i ]) ) <<
+ endl;
return EXIT_SUCCESS;
}
Modified: sandbox/md5/libs/coding/example/md5check.cpp
==============================================================================
--- sandbox/md5/libs/coding/example/md5check.cpp (original)
+++ sandbox/md5/libs/coding/example/md5check.cpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -13,7 +13,7 @@
#include <algorithm> // for std::for_each
#include <exception> // for std::exception
#include <iostream> // for std::cerr, cout, cin
-#include <iterator> // for std::istream_iterator
+#include <iterator> // for std::istreambuf_iterator
#include <ostream> // for std::endl
@@ -44,7 +44,7 @@
using boost::coding::md5_digest;
using std::cout;
- typedef std::istream_iterator<unsigned char> byte_read_iterator;
+ typedef std::istreambuf_iterator<char> byte_read_iterator;
// Perform a MD5 checksum over the bytes read from standard input.
// (TODO: put code to force std::cin into binary mode)
@@ -53,7 +53,7 @@
checksummer.bytes = std::for_each( byte_read_iterator(std::cin),
byte_read_iterator(), checksummer.bytes );
- md5_digest const fingerprint = checksummer();
+ md5_digest const fingerprint = checksummer.checksum();
// Use the results based on the program's mode
switch ( argc )
Modified: sandbox/md5/libs/coding/test/md5_computer_test.cpp
==============================================================================
--- sandbox/md5/libs/coding/test/md5_computer_test.cpp (original)
+++ sandbox/md5/libs/coding/test/md5_computer_test.cpp 2008-08-28 18:04:38 EDT (Thu, 28 Aug 2008)
@@ -21,7 +21,7 @@
#include <algorithm> // for std::reverse, for_each
#include <climits> // for CHAR_BIT
-#include <cstddef> // for std::size_t
+#include <cstddef> // for std::size_t, NULL
#include <istream> // for std::basic_istream
#include <ostream> // for std::basic_ostream
#include <sstream> // for std::stringstream
@@ -471,10 +471,6 @@
BOOST_CHECK_EQUAL( s1, md5_empty_data );
- // Application operator interface
- md5_digest const s2 = c1();
- BOOST_CHECK_EQUAL( s1, s2 );
-
// Non-empty message below the limit of padding wrap-around
c1.process_octet( 0x61u ); // 'a' in ASCII
BOOST_REQUIRE( c1.bits_unbuffered() > 0u );
@@ -732,19 +728,19 @@
}
// Single-call function test
-BOOST_AUTO_TEST_CASE( compute_md5_test )
+BOOST_AUTO_TEST_CASE( md5_function_test )
{
- using boost::coding::compute_md5;
+ using boost::coding::md5;
// Empty check
- BOOST_CHECK_EQUAL( compute_md5(0, 0), md5_empty_data );
+ BOOST_CHECK_EQUAL( md5(NULL, 0u), md5_empty_data );
// Check against another component
unsigned char const test_value = 0x6Fu;
md5_computer scratch;
scratch.process_byte( test_value );
- BOOST_CHECK_EQUAL( compute_md5(&test_value, 1u), scratch.checksum() );
+ BOOST_CHECK_EQUAL( md5(&test_value, 1u), scratch.checksum() );
// How do we get consistent data when we can't count on CHAR_BIT being the
// same everywhere? Do we just screw over testers without 8-bit bytes or
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk