X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/044077236a9a78b519254789e70f7ab23fde7e97..b1f8fd3b411a0e36407ea6d2218a61e5a262f309:/src/common/colourcmn.cpp

diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp
index 3c238495d4..a6626f91e2 100644
--- a/src/common/colourcmn.cpp
+++ b/src/common/colourcmn.cpp
@@ -22,18 +22,21 @@
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/utils.h"
+    #include "wx/gdicmn.h"
+    #include "wx/wxcrtvararg.h"
 #endif
 
-#include "wx/gdicmn.h"
-
+#if wxUSE_VARIANT
+IMPLEMENT_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLEXPORT)
+#endif
 
 // ============================================================================
 // 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 ||
@@ -43,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),
@@ -54,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),