-//
-inline bool operator==(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) == 0; }
-//
-inline bool operator==(const wxString& s1, const char * s2) { return s1.Cmp(s2) == 0; }
-//
-inline bool operator==(const char * s1, const wxString& s2) { return s2.Cmp(s1) == 0; }
-//
-inline bool operator!=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) != 0; }
-//
-inline bool operator!=(const wxString& s1, const char * s2) { return s1.Cmp(s2) != 0; }
-//
-inline bool operator!=(const char * s1, const wxString& s2) { return s2.Cmp(s1) != 0; }
-//
-inline bool operator< (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) < 0; }
-//
-inline bool operator< (const wxString& s1, const char * s2) { return s1.Cmp(s2) < 0; }
-//
-inline bool operator< (const char * s1, const wxString& s2) { return s2.Cmp(s1) > 0; }
-//
-inline bool operator> (const wxString& s1, const wxString& s2) { return s1.Cmp(s2) > 0; }
-//
-inline bool operator> (const wxString& s1, const char * s2) { return s1.Cmp(s2) > 0; }
-//
-inline bool operator> (const char * s1, const wxString& s2) { return s2.Cmp(s1) < 0; }
-//
-inline bool operator<=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) <= 0; }
-//
-inline bool operator<=(const wxString& s1, const char * s2) { return s1.Cmp(s2) <= 0; }
-//
-inline bool operator<=(const char * s1, const wxString& s2) { return s2.Cmp(s1) >= 0; }
-//
-inline bool operator>=(const wxString& s1, const wxString& s2) { return s1.Cmp(s2) >= 0; }
-//
-inline bool operator>=(const wxString& s1, const char * s2) { return s1.Cmp(s2) >= 0; }
-//
-inline bool operator>=(const char * s1, const wxString& s2) { return s2.Cmp(s1) <= 0; }
+
+inline bool operator==(const wxString& s1, const wxString& s2)
+ { return (s1.Len() == s2.Len()) && (s1.Cmp(s2) == 0); }
+inline bool operator==(const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) == 0; }
+inline bool operator==(const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) == 0; }
+inline bool operator!=(const wxString& s1, const wxString& s2)
+ { return (s1.Len() != s2.Len()) || (s1.Cmp(s2) != 0); }
+inline bool operator!=(const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) != 0; }
+inline bool operator!=(const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) != 0; }
+inline bool operator< (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) < 0; }
+inline bool operator< (const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) < 0; }
+inline bool operator< (const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) > 0; }
+inline bool operator> (const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) > 0; }
+inline bool operator> (const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) > 0; }
+inline bool operator> (const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) < 0; }
+inline bool operator<=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) <= 0; }
+inline bool operator<=(const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) <= 0; }
+inline bool operator<=(const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) >= 0; }
+inline bool operator>=(const wxString& s1, const wxString& s2)
+ { return s1.Cmp(s2) >= 0; }
+inline bool operator>=(const wxString& s1, const wxChar * s2)
+ { return s1.Cmp(s2) >= 0; }
+inline bool operator>=(const wxChar * s1, const wxString& s2)
+ { return s2.Cmp(s1) <= 0; }
+
+// comparison with char
+inline bool operator==(wxChar c, const wxString& s) { return s.IsSameAs(c); }
+inline bool operator==(const wxString& s, wxChar c) { return s.IsSameAs(c); }
+inline bool operator!=(wxChar c, const wxString& s) { return !s.IsSameAs(c); }
+inline bool operator!=(const wxString& s, wxChar c) { return !s.IsSameAs(c); }
+
+#if wxUSE_UNICODE
+inline bool operator==(const wxString& s1, const wxWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) == 0); }
+inline bool operator==(const wxWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) == 0); }
+inline bool operator!=(const wxString& s1, const wxWCharBuffer& s2)
+ { return (s1.Cmp((const wchar_t *)s2) != 0); }
+inline bool operator!=(const wxWCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const wchar_t *)s1) != 0); }
+#else // !wxUSE_UNICODE
+inline bool operator==(const wxString& s1, const wxCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) == 0); }
+inline bool operator==(const wxCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) == 0); }
+inline bool operator!=(const wxString& s1, const wxCharBuffer& s2)
+ { return (s1.Cmp((const char *)s2) != 0); }
+inline bool operator!=(const wxCharBuffer& s1, const wxString& s2)
+ { return (s2.Cmp((const char *)s1) != 0); }
+#endif // wxUSE_UNICODE/!wxUSE_UNICODE