X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/193d0c93106d21067107c262874763d4c0921707..b1f8fd3b411a0e36407ea6d2218a61e5a262f309:/src/common/colourcmn.cpp?ds=sidebyside diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp index 3d401098e3..a6626f91e2 100644 --- a/src/common/colourcmn.cpp +++ b/src/common/colourcmn.cpp @@ -34,9 +34,9 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT) // wxString <-> wxColour conversions // ============================================================================ -bool wxColourBase::FromString(const wxChar *str) +bool wxColourBase::FromString(const wxString& str) { - if ( str == NULL || str[0] == wxT('\0')) + if ( str.empty() ) return false; // invalid or empty string if ( wxStrncmp(str, wxT("RGB"), 3) == 0 || @@ -46,7 +46,7 @@ bool wxColourBase::FromString(const wxChar *str) // according to http://www.w3.org/TR/REC-CSS2/syndata.html#color-units // values outside 0-255 range are allowed but should be clipped int red, green, blue; - if (wxSscanf(&str[3], wxT("(%d, %d, %d)"), &red, &green, &blue) != 3) + if (wxSscanf(str.wx_str() + 3, wxT("(%d, %d, %d)"), &red, &green, &blue) != 3) return false; Set((unsigned char)wxClip(red,0,255), @@ -57,7 +57,7 @@ bool wxColourBase::FromString(const wxChar *str) { // hexadecimal prefixed with # (HTML syntax) unsigned long tmp; - if (wxSscanf(&str[1], wxT("%lx"), &tmp) != 1) + if (wxSscanf(str.wx_str() + 1, wxT("%lx"), &tmp) != 1) return false; Set((unsigned char)(tmp >> 16),