diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 00:10:08 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-22 00:10:08 +0000 |
commit | 20d95e085600c007a6faac7dec0da0f8e9e45cd2 (patch) | |
tree | f8b760b9741872d0f44d3a7c351211c43d714fe4 /base/string_util.h | |
parent | c71b654ff294d084ab7e3f24559867cf729f37b8 (diff) | |
download | chromium_src-20d95e085600c007a6faac7dec0da0f8e9e45cd2.zip chromium_src-20d95e085600c007a6faac7dec0da0f8e9e45cd2.tar.gz chromium_src-20d95e085600c007a6faac7dec0da0f8e9e45cd2.tar.bz2 |
Adding a HexEncode function to string_utils.
This function takes a pointer to a chunk of memory and formats the bytes as hex.
Review URL: http://codereview.chromium.org/18452
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r-- | base/string_util.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/base/string_util.h b/base/string_util.h index 6d7ff94..68142cb 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -539,5 +539,13 @@ bool ElideString(const std::wstring& input, int max_len, std::wstring* output); bool MatchPattern(const std::wstring& string, const std::wstring& pattern); bool MatchPattern(const std::string& string, const std::string& pattern); -#endif // BASE_STRING_UTIL_H_ +// Returns a hex string representation of a binary buffer. +// The returned hex string will be in upper case. +// This function does not check if |size| is within reasonable limits since +// it's written with trusted data in mind. +// If you suspect that the data you want to format might be large, +// the absolute max size for |size| should be is +// std::numeric_limits<size_t>::max() / 2 +std::string HexEncode(const void* bytes, size_t size); +#endif // BASE_STRING_UTIL_H_ |