X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4db03d266bba0da0fa2d96c408fb3bb697b96128..cbef7338c1c7763042704c74d5ee6f62c7e10733:/include/wx/base64.h diff --git a/include/wx/base64.h b/include/wx/base64.h index 709fb1dd1e..1632e60e7e 100644 --- a/include/wx/base64.h +++ b/include/wx/base64.h @@ -89,6 +89,17 @@ wxBase64Decode(void *dst, size_t dstLen, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, size_t *posErr = NULL); +inline size_t +wxBase64Decode(void *dst, size_t dstLen, + const wxString& src, + wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, + size_t *posErr = NULL) +{ + // don't use str.length() here as the ASCII buffer is shorter than it for + // strings with embedded NULs + return wxBase64Decode(dst, dstLen, src.ToAscii(), wxNO_LEN, mode, posErr); +} + // decode the contents of the given string; the returned buffer is empty if an // error occurs during decoding WXDLLIMPEXP_BASE wxMemoryBuffer @@ -96,6 +107,16 @@ wxBase64Decode(const char *src, size_t srcLen = wxNO_LEN, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, size_t *posErr = NULL); +inline wxMemoryBuffer +wxBase64Decode(const wxString& src, + wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, + size_t *posErr = NULL) +{ + // don't use str.length() here as the ASCII buffer is shorter than it for + // strings with embedded NULs + return wxBase64Decode(src.ToAscii(), wxNO_LEN, mode, posErr); +} + #endif // wxUSE_BASE64 #endif // _WX_BASE64_H_