diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-15 23:32:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-16 09:16:08 +0100 |
commit | eef23a3f537320267583f5fc2e145f66d520fe23 (patch) | |
tree | d2e9cb34c4b6139912a58be7e6c6d81ce0178f96 /tools/bootstrp | |
parent | d12ddc8f86194ab7699646a302efb6d35b24b1fd (diff) |
ByteString -> rtl::OString
Diffstat (limited to 'tools/bootstrp')
-rw-r--r-- | tools/bootstrp/md5.cxx | 13 | ||||
-rw-r--r-- | tools/bootstrp/md5.hxx | 4 | ||||
-rw-r--r-- | tools/bootstrp/so_checksum.cxx | 12 |
3 files changed, 16 insertions, 13 deletions
diff --git a/tools/bootstrp/md5.cxx b/tools/bootstrp/md5.cxx index 1df85d32ff80..2c8a30a5c66b 100644 --- a/tools/bootstrp/md5.cxx +++ b/tools/bootstrp/md5.cxx @@ -34,7 +34,7 @@ #include <cstddef> #include <stdio.h> -#include <tools/string.hxx> +#include <rtl/strbuf.hxx> #ifdef WNT #define FILE_OPEN_READ "rb" @@ -93,13 +93,14 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) } } -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) { const size_t BUFFER_SIZE = 0x1000; const size_t MINIMAL_SIZE = 512; sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5]; - rtlDigestError error = rtl_Digest_E_None; + rtlDigestError error = rtl_Digest_E_None; + rtl::OStringBuffer aChecksumBuf; FILE *fp = fopen( filename, FILE_OPEN_READ ); @@ -136,8 +137,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) for ( std::size_t i = 0; i < sizeof(checksum); i++ ) { if ( checksum[i] < 16 ) - aChecksum.Append( "0" ); - aChecksum += ByteString::CreateFromInt32( checksum[i], 16 ); + aChecksumBuf.append('0'); + aChecksumBuf.append(checksum[i], 16); } } @@ -146,6 +147,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) else error = rtl_Digest_E_Unknown; + rChecksum = aChecksumBuf.makeStringAndClear(); + return error; } diff --git a/tools/bootstrp/md5.hxx b/tools/bootstrp/md5.hxx index f8d6e6b9695a..9f6e4aea6100 100644 --- a/tools/bootstrp/md5.hxx +++ b/tools/bootstrp/md5.hxx @@ -27,8 +27,8 @@ ************************************************************************/ #include <rtl/digest.h> -class ByteString; +#include <rtl/string.hxx> -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ); +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/so_checksum.cxx b/tools/bootstrp/so_checksum.cxx index e38252ea2f70..9ff6a6832379 100644 --- a/tools/bootstrp/so_checksum.cxx +++ b/tools/bootstrp/so_checksum.cxx @@ -31,20 +31,20 @@ #include "md5.hxx" -#include <stdio.h> +#include <rtl/string.hxx> -#include <tools/string.hxx> +#include <stdio.h> int main( int argc, char * argv[] ) { - for ( int n = 1; n < argc; n++ ) + for (int n = 1; n < argc; ++n) { - ByteString aChecksum; - rtlDigestError error = calc_md5_checksum( argv[n], aChecksum ); + rtl::OString aChecksum; + rtlDigestError error = calc_md5_checksum(argv[n], aChecksum); if ( rtl_Digest_E_None == error ) { - printf( "%s %s\n", aChecksum.GetBuffer(), argv[n] ); + printf( "%s %s\n", aChecksum.getStr(), argv[n] ); } else printf( "ERROR: Unable to calculate MD5 checksum for %s\n", argv[n] ); |