diff --git a/include/wx/bmpbndl.h b/include/wx/bmpbndl.h index ad57680687..442a7faaa7 100644 --- a/include/wx/bmpbndl.h +++ b/include/wx/bmpbndl.h @@ -76,6 +76,9 @@ public: // This overload currently makes a copy of the data. static wxBitmapBundle FromSVG(const char* data, const wxSize& sizeDef); + // This overload works for data not terminated with 0 + static wxBitmapBundle FromSVG(const wxByte* data, size_t len, const wxSize& sizeDef); + // Load SVG image from the given file (must be a local file, not an URL). static wxBitmapBundle FromSVGFile(const wxString& path, const wxSize& sizeDef); diff --git a/src/common/artstd.cpp b/src/common/artstd.cpp index 2e6c686821..252d712744 100644 --- a/src/common/artstd.cpp +++ b/src/common/artstd.cpp @@ -279,7 +279,7 @@ wxDefaultArtProvider::CreateBitmapBundle(const wxArtID& id, sizeDef = wxSize(16, 16); } - bb = wxBitmapBundle::FromSVG((const char*)wxlogo_svg_data, sizeDef); + bb = wxBitmapBundle::FromSVG(wxlogo_svg_data, sizeof(wxlogo_svg_data), sizeDef); } #else // !wxHAS_SVG wxUnusedVar(id); diff --git a/src/generic/bmpsvg.cpp b/src/generic/bmpsvg.cpp index d3c5f030f9..37928bc89f 100644 --- a/src/generic/bmpsvg.cpp +++ b/src/generic/bmpsvg.cpp @@ -218,6 +218,15 @@ wxBitmapBundle wxBitmapBundle::FromSVG(const char* data, const wxSize& sizeDef) return FromSVG(copy.data(), sizeDef); } +/* static */ +wxBitmapBundle wxBitmapBundle::FromSVG(const wxByte* data, size_t len, const wxSize& sizeDef) +{ + wxCharBuffer copy(len); + memcpy(copy.data(), data, len); + + return FromSVG(copy.data(), sizeDef); +} + /* static */ wxBitmapBundle wxBitmapBundle::FromSVGFile(const wxString& path, const wxSize& sizeDef) {